Code
var bg = new Path.Rectangle({
size: view.bounds,
fillColor: 'black',
position: view.center
})
var xspacing = 15; // Distance between each horizontal location
var w; // Width of entire wave
var theta = 0; // Start angle at 0
var amplitude = 70 // Height of wave
var yvalues; // Using an array to store height values for the wave
var animationSpeed = 0.02
var waveXSize = 25.4 // From 25.1 to 25.9
w = view.size.width
yvalues = new Array(Math.floor(w / xspacing))
function calcWave() {
theta += animationSpeed
var x = theta;
for (var i = 0; i < yvalues.length; i++) {
yvalues[i] = Math.sin(x) * amplitude;
x += waveXSize;
}
}
function onFrame(event) {
calcWave()
renderWave()
}
var array = []
for (var i = 0; i < 100; i++) {
var path = new Path.Circle({
radius: 1.5,
strokeColor: 'white',
center: view.center,
})
array.push(path)
}
function renderWave() {
array.map(function(object, i) {
object.position.x = i * xspacing
object.position.y = view.center.y + yvalues[i]
})
}