xxxxxxxxxx
21
// https://stackoverflow.com/questions/2708476/rotation-interpolation
function rotationLerp(start, end, amount) {
let shortest_angle=((((end - start) % 360) + 540) % 360) - 180;
shortest_angle *= amount;
return (shortest_angle + 360) % 360;
}
function setup() {
createCanvas(400, 400);
colorMode(HSB, 360);
const c0 = 0;
const c1 = 100;
const c2 = 300;
for(let x = 0; x < width; x++) {
stroke(rotationLerp(c0, c1, x/width), 360, 360);
line(x, 0, x, height/2);
stroke(rotationLerp(c0, c2, x/width), 360, 360);
line(x, height/2, x, height);
}
}