xxxxxxxxxx
var gB, fullRes, windowRes;
var requiredFrames = 360;
function setup() {
windowRes = min(windowWidth, windowHeight);
createCanvas(windowRes, windowRes);
imageMode(CENTER);
gB = createGraphics(fullRes = 1024, fullRes);
gB.colorMode(HSB, 360);
gB.blendMode(DIFFERENCE);
background(100);
frameRate(60);
}
function draw() {
gB.clear();
var animationProgress = (frameCount / requiredFrames) % 1;
gB.resetMatrix();
gB.noStroke();
gB.fill(360);
gB.translate(fullRes * 0.5, fullRes * 0.5);
for (var i = 0; i < 1; i += 1 / 11) {
var thisAP = animationProgress + i;
gB.push();
gB.translate(fullRes * 0.2 * cos(thisAP * TAU), fullRes * 0.3 * sin(thisAP * TAU));
gB.ellipse(0, 0, cos(thisAP * TAU) * fullRes * 0.5);
gB.pop();
}
background(360);
displayBuffer(gB);
}
function keyPressed() {
if (key === "g") {
saveGif('export', requiredFrames, {delay: 0, units: "frames"});
}
}
function displayBuffer(buffer) {
image(buffer, windowRes/2, windowRes/2, windowRes, windowRes);
}
function windowResized() {
windowRes = min(windowWidth, windowHeight);
createCanvas(windowRes, windowRes);
}