xxxxxxxxxx
85
/*
Author: Ahmad Moussa || Gorilla Sun
Twitter:@gorillasu
Weekly Challenge Submission for @Sableraph's stream
*/
/*
_______ .---. .-''-. ,---. .--. ______
\ ____ \ | ,_| .'_ _ \ | \ | || _ `''.
| | \ | ,-./ ) / ( ` ) '| , \ | || _ | ) _ \
| |____/ / \ '_ '`) . (_ o _) || |\_ \| ||( ''_' ) |
| _ _ '. > (_) ) | (_,_)___|| _( )_\ || . (_) `. |
| ( ' ) \( . .-' ' \ .---.| (_ o _) ||(_ ._) '
| (_{;}_) | `-'`-'|___\ `-' /| (_,_)\ || (_.\.' /
| (_,_) / | \\ / | | | || .'
/_______.' `--------` `'-..-' '--' '--''-----'`
*/
//// Boilerplate Stuff 🔧 ////
// Setup
function setup() {
wSize = min(windowWidth, windowHeight);
createCanvas(wSize, wSize);
background(0);
}
// Window resize
function windowResized(){
wSize = min(windowWidth, windowHeight);
resizeCanvas(wSize, wSize);
background(0)
}
//// Play with these 🎮 ////
// Affects shape of drawn figure
const shape = 2 //values between 0 and TWO_PI
// Affects motion of points drawing the figure
const offset = 3 // larger than 1 and not 0
//// Sketch goes here 🌺 ////
let t = 0; //placeholder
function draw() {
// background(0,0,0,10) // uncomment to see what's happening
blendMode(BLEND);
noFill();
//time stored in t since it's reused in several places
t = millis() / 500;
let lt = TAU * ((frameCount / 160) % offset);
/*
RED and GREEN channels are modulated
BLUE channel is fixed
This gives these green-rosey colors
*/
stroke(127.5 + 127.5 * sin(t/4),
127.5 + 127.5 * cos(t/4),
75);
// Different stroke sizes have different effects
strokeWeight(wSize / 30);
const AA_cancel_loop_count = 25; // dirty hack :/ fix for noSmooth not working
// Main Loop that draws the points
for (x = 0; x < PI/2; x += 0.1) {
for (let i=0; i<AA_cancel_loop_count; i++)
point(
wSize / 2 +
(wSize / 3 + (wSize / 8) * sin(x + shape + lt)) * cos(x + lt / offset),
wSize / 2 +
(wSize / 3 + (wSize / 8) * cos(x + lt)) * sin(x + lt / offset)
);
}
}