xxxxxxxxxx
var lazy_x = 0;
var lazy_y = 0;
var easing = .04;
function setup() {
createCanvas(windowWidth, windowHeight);
background(255);
}
var i = 0;
function draw() {
var targetX = mouseX;
var dx = targetX-lazy_x;
lazy_x += dx * easing;
var targetY = mouseY;
var dy = targetY-lazy_y;
lazy_y += dy * easing;
translate(lazy_x, lazy_y);
var a = atan2(mouseY - height / 2, mouseX - width / 2);
rotate(a);
var degs = degrees(a);
degs = map(degs, -180, 180, 0, 360, true);
degs = int(degs);
var c = color('hsla('+degs+',100%,50%,.01)');
fill(c)
noStroke();
if (i==0) {
beginShape();
}
if ( i > 0 && i < 100) {
//draw shape
var radius = width * 0.50;
ellipse(0, 0, radius*2, radius*2);
fill("white");
rotate(radians(random(100)));
var steps = 10;
var step_change = 360/steps;
for (var j = 0; j<250; j=j+step_change) {
var x = cos(radians(j)) * radius;
var y = sin(radians(j)) * radius;
triangle(x, y, 50, 50, x*12, y*8);
endShape(CLOSE);
}
}
i += 1;
if (i >= 100) {
endShape(CLOSE);
i = 0;
}
}