Angle occasion wireframe
this is css
body {
margin: 0;
height: 100vh;
user-select: none;
-webkit-user-select : none;
position: fixed;
}
// this is Java script
Comment out line 43 and uncomment line 44 to stop generating a random angle and instead set a static angle value in radians (My favorite angle so far is 4.22 but 3.2 is also cool).
let r;
let g;
let b;
let wid;
let h;
let angle;
function setup(){
createCanvas(innerWidth, innerHeight);
wid = innerWidth/2;
h = innerHeight/2;
setValues();
alert("Touch the screen to change to a different random angle.");
}
function draw(){
background(0);
translate(innerWidth/2, innerHeight/2);
var wave = sin(radians(frameCount));
var w = wave*map(0, 0, innerHeight, innerWidth, 0);
for(var i=0; i<200; ++i){
rotate(angle);
stroke(r1,g1,b1);
line(wid*2, i-w, -wid*2, ++i);
stroke(r2,g2,b2);
line(-wid*2, i-w, wid*2, ++i);
}
}
function setValues(){
r1 = random(0,255);
g1 = random(0,255);
b1 = random(0,255);
r2 = random(0,255);
g2 = random(0,255);
b2 = random(0,255);
// comment out the line out below to remove the random angle generation
angle = random(0.5,6.28);
// uncomment the line below to generate a spiral with a preset angle
// angle = 4.22;
console.log("Rotation angle in radians: " + angle);
}
function touchStarted(){
setValues();
}
Comments