-
Notifications
You must be signed in to change notification settings - Fork 0
/
legacy.txt
76 lines (65 loc) · 1.91 KB
/
legacy.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
const imageRef = useRef<HTMLImageElement>(null);
useEffect(() => {
window.onpointermove = (e) => {
const { clientX, clientY } = e;
if (imageRef.current) {
imageRef.current.animate(
{
left: `${clientX}px`,
top: `${clientY}px`,
},
{ duration: 100, fill: "forwards" }
);
}
};
}, []);
#blur {
background-color: white;
height: 34vw;
aspect-ratio: 1;
position: absolute;
left: 50%;
top: 50%;
translate: -50% -50%;
border-radius: 50%;
animation: rotate 20s infinite;
opacity: 0.4;
z-index: -2;
filter: blur(12vmax);
}
function generateInertia(scroll: number) {
console.log(scroll)
if (Math.abs(scroll) < 1) return
console.log('adding')
if (sliderRef.current?.parentElement && sliderRef.current)
sliderRef.current.parentElement.scrollLeft += scroll/10;
setTimeout(function() {
}, 100);
generateInertia(scroll/10)
}
generateInertia(10000)
function mouseDownEvent() {
setPressed(true);
if (sliderRef.current !== null)
sliderRef.current.style.cursor = "grabbing";
}
function mouseLeaveEvent() {
setPressed(false);
if (sliderRef.current !== null) sliderRef.current.style.cursor = "grab";
}
function mouseUpEvent(e: any) {
setPressed(false);
console.log("asd")
if (sliderRef.current !== null) sliderRef.current.style.cursor = "grab";
}
function mouseMoveEvent(e: any) {
if (pressed) {
if (sliderRef.current?.parentElement && sliderRef.current)
sliderRef.current.parentElement.scrollLeft -= e.movementX;
}
}
useEffect(() => {
if (sliderRef.current?.parentElement && sliderRef.current)
sliderRef.current.parentElement.scrollLeft += vertical * 1;
}, [vertical])
onMouseDown={mouseDownEvent} onMouseLeave={mouseLeaveEvent} onMouseUp={mouseUpEvent} onMouseMove={mouseMoveEvent}