Hey everyone,
i’m using
background(0, 10);
to get a trail effect, but i get these weird permanent trails that dont go away. Usually the screen should be black again if the background has been drawn enough times. Not sure where they come from, anyone got an idea?
Gif for reference:
The code:
let sinAngle = 0;
let diameter = 200;
function setup() {
createCanvas(screen.width, screen.height);
angleMode(DEGREES);
frameRate(80);
}
let symmetry = 6;
function draw() {
background(0, 2);
//console.log(frameRate());
translate(width / 2, height / 2);
let mx = mouseX - width / 2;
let my = mouseY - height / 2;
let pmx = pmouseX - width / 2;
let pmy = pmouseY - height / 2;
//if (mouseIsPressed) {
stroke(255);
let angle = 360 / symmetry;
let rotation;
sinAngle += 0.9;
for (let i = 0; i < symmetry; i++) {
//smooth();
rotate(angle);
let d = dist(mx, my, pmx, pmy);
let sw = map(d, 0, 20, 1, 5);
strokeWeight(sw);
line(mx, my, pmx, pmy);
//fill(0);
push();
let d2 = 600 + (sin(sinAngle) * 800) / 2 + 800 / 2;
rotation = frameCount/(mouseX/100)
rotate(rotation);
let d1 = 15 + (sin(sinAngle) * 200) / 2 + 200 / 2;
rect(d1, 0, 20, 20);
pop();
//point(mx, my);
}
console.log(rotation);
//}
}