xxxxxxxxxx
142
let output;
let fanMove;
let system;
let pVelocity;
let pVelocityY;
let degree;
let xtime
let GREEN
let BLUE
let RED
let arcRing;
let alphaMap;
let fanAngle;
function setup() {
createCanvas(windowWidth, windowHeight);
angleMode(DEGREES);
pVelocity = degree
fanMove = 1;
GREEN = 60;
BLUE = 120;
RED = 100;
}
function draw() {
background(0);
fanMove = mouseX;
pVelocity = map(degree, 180, 360, 0, 20);
pVelocityY = map(degree, 180, 360, 0, -20);
arcRing = map(degree, 280, 360, 0, windowWidth);
//fan mask
noStroke();
output = map(fanMove, 0, windowWidth, 0, 255);
degree = map(output, 0, 255, 180, 360);
fanAngle = map(mouseX, 0, width, 0, 255);
fanSegment();
background_grad();
}
function fanSegment(){
//White fins
for (let d = 180; d > -180; d -= 5) {
fill(255);
arc(width / 2, height / 2, arcRing, arcRing, degree + d, -degree + d, PIE);
}
//Red fins
for (let d = 90; d > -90; d -= 20) {
fill(200, 0, 0);
arc(width / 2, height / 2, arcRing, arcRing, degree + d, -degree + d, PIE);
}
//PurpleBlades
for (let d = 360; d > -360; d -= 60) {
fill(BLUE, 0, 200, (-15, output));
arc(width / 2, height / 2, arcRing, arcRing, degree + d, -degree + d, PIE);
}
fill(0, GREEN, BLUE);
arc(width / 2, height / 2, 400, 400, degree - 90, -degree - 90, PIE);
noFill();
strokeWeight(5);
stroke(BLUE, 150, 50);
arc(width / 2, height / 2, 400, 400, -degree - 80, degree - 100);
strokeWeight(5);
stroke(0, 100, BLUE);
arc(width / 2, height / 2, arcRing, arcRing, -degree - 80, degree - 100);
stroke(0, 100, BLUE);
arc(width / 2, height / 2, arcRing - 20, arcRing - 20, -degree - 80, degree - 100);
}
function background_grad() {
xtime += 10
if (xtime > 0 && xtime <= 50) {
GREEN++
} else if (xtime > 50 && xtime <= 100) {
GREEN--
BLUE += 5
} else if (xtime > 100 && xtime <= 150) {
GREEN += 5
BLUE--
} else if (xtime > 150 && xtime <= 255) {
GREEN--
} else {
xtime = 1;
// GREEN = 80
// BLUE = 150
}
}