Test Spiral
JS snippets from 2017
Created 10 December 2024 - Last updated: 12 December 2024
Seeding 🌱
fur
cleaning
JS code
function DrawPopArtSpiralRight (SpiralLength, white_space){
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
for (let n = 0; n < SpiralLength; n+=1) {
let rad_enlarge = 0.0003;
context.beginPath();
radius1 = rad_enlarge*(n);
angle1 = (Math.PI * 2 * (n)) / 1000;
radius2 = rad_enlarge*(n+1);
angle2 = (Math.PI * 2 * (n+1)) / 1000;
let x1 = canvas.width / 2 + radius1 * Math.cos(angle1) * angle1;
let y1 = canvas.height / 2 + radius1 * Math.sin(angle1) * angle1;
let x2 = canvas.width / 2 + radius2 * Math.cos(angle2) * angle2;
let y2 = canvas.height / 2 + radius2 * Math.sin(angle2) * angle2;
context.moveTo(x1,y1);
context.lineTo(x2,y2);
context.lineWidth = 0.006*n;
context.globalAlpha = Math.cos(angle1*white_space)*Math.cos(angle1*white_space);
context.stroke();
}
}