-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjs.js
More file actions
28 lines (25 loc) · 703 Bytes
/
js.js
File metadata and controls
28 lines (25 loc) · 703 Bytes
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
let xs = []
// let form = document.getElementById('email')
// let btn = document.getElementById('circle')
// btn.addEventListener('click', ()=>{
// form.style.display = 'block';
// form.style.opacity = 100;
// form.scrollIntoView({behavior: 'smooth', block: 'center'});
// })
for(var i = 0; i < 1000; i++){
xs.push(i)
}
var t = 0
function animate(){
let points = xs.map(x =>{
let y = 100 + 10 * Math.sin((x + t)/ 10)
return [x,y]
})
let path = "M" + points.map(p =>{
return p[0] + "," +p[1]
}).join(" L")
document.querySelector("path").setAttribute("d", path)
requestAnimationFrame(animate)
t += 0.3;
}
animate()