Created
May 4, 2021 00:28
-
-
Save ippsketch/bb3610687f03598c9aade3c4b58ec8a6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var cap = true; // change this to create a gif and change stop condition | |
var start = false; | |
if (cap){var capturer = new CCapture( { format: 'png' } );} | |
var i = 0; //initiate | |
var PERIOD = 100; | |
// float t,i,p,a; | |
let t=1; | |
function setup() { | |
createCanvas(600,600); | |
pixelDensity(1) | |
} | |
function draw() { | |
if (frameCount == 1 && (cap)){capturer.start(); start=true;} | |
num1 = 199; | |
num2 = 99; | |
t-=.01; | |
background(0) | |
translate(width/2,height/2); | |
for (let i=0; i<num1; i++){ | |
for(let a=0;a<TAU-TAU/num2;a+=TAU/num2){ | |
noStroke(); | |
push(); | |
p = (i+10*(t))/num1; | |
rotate(PI*p*2); | |
for (let j=0; j<3; j++){ | |
var rm = sin(TWO_PI*(2*t-5*p+j*.01)) | |
let co = color(255,0,0) | |
if (j==1) co = color(0,255,0) | |
if (j==2) co = color(0,0,255) | |
blendMode(ADD) | |
fill(co) | |
if (rm > .5) circle(700*p*p*p*cos(a), 700*p*p*p*sin(a)+150,1*(20*(rm-.5)/.5)*p*p); | |
} | |
pop(); | |
} | |
} | |
if (cap){capturer.capture( canvas );} | |
if (cap){ if (frameCount-1== PERIOD){capturer.stop(); capturer.save(); noLoop();}} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment