Alexander Deplov

Animated circles

Animated circles

Code

var bg = new Path.Rectangle({
    size: view.bounds,
    fillColor: 'black',
    position: view.center
})
var circles = [];
var numberOfCircles = 20;
for (var i = 0; i < numberOfCircles; i++) {
    var circle = new Path.Circle({
        center: view.center,
        radius: 40,
        strokeColor: 'rgba(255,255,0,1)',
        strokeWidth: 2,
        opacity: 0.2,
    });
    circles.push(circle);
    circle.scale(i);
}
var t = 180;
var s = 0.1;

function onFrame(event) {
    for (var i = 0; i < circles.length; i++) {
        t += 180 + 0.14;
        circles[i % 5].strokeColor.hue = t;
        circles[i % 5].strokeColor.lightness = 0.5 - 1 / i;
        circles[i % 5].strokeColor.saturation = 0.5 * (Math.random() * i);
        circles[i % 5].opacity = Math.random() * ((0.5) * i);
        circles[i % 5].strokeWidth = 5;
        circles[i % 5].strokeWidth = Math.random() * (0.5) * i;
    }
}

function onResize() {
    for (var i = 0; i < circles.length; i++) {
        circles[i].position = view.center;
    }
}