sketch curveDownload
function setup() {
createCanvas(480, 480);
frameRate(6);
}
function draw() {
background(255);
drawEpicloid1();
drawEpicloid2();
drawEpicloid3();
drawEpicloid4();
drawEpicloid5();
drawEpicloid6();
drawEpicloid7();
drawEpicloid8();
}
function drawEpicloid1() {push();
translate( width/2-100, height/2-100);
var x;
var y;
var a = 20;; var b = a * 3; var theta = 30;
var move = mouseY/50
fill(255, 0, 0, 50); beginShape();
for (var i = 0; i < 100; i ++) {
var theta = map ( i , 0, 100, 0, TWO_PI);
x = (a + b) * cos(theta) - b * cos (theta * (a + b) /b * move); y = (a + b) * sin (theta) - b * sin (theta * (a + b) /b * move);
vertex(x,y);
}
endShape(CLOSE);
pop();
}
function drawEpicloid2() {push();
translate( width/2-100, height/2-100);
var x;
var y;
var a = 20;; var b = a * 3; var theta = 30;
var move = mouseY/50
fill(200, 210, 0,50); beginShape();
for (var i = 0; i < 100; i ++) {
var theta = map ( i , 0, 100, 0, TWO_PI);
x = (a + b) * cos(-theta) - b * cos (-theta * (a + b) /b * move); y = (a + b) * sin (-theta) - b * sin (-theta * (a + b) /b * move);
vertex(x,y);
}
endShape(CLOSE);
pop();
}
function drawEpicloid3() {push();
translate( width/2+100, height/2-100);
var x;
var y;
var a = 20;; var b = a * 3; var theta = 30;
var move = mouseX/50
fill(200, 210, 0,50); beginShape();
for (var i = 0; i < 100; i ++) {
var theta = map ( i , 0, 100, 0, TWO_PI);
x = (a + b) * cos(theta) - b * cos (theta * (a + b) /b * move); y = (a + b) * sin (theta) - b * sin (theta * (a + b) /b * move);
vertex(x,y);
}
endShape(CLOSE);
pop();
}
function drawEpicloid4() {push();
translate( width/2+100, height/2-100);
var x;
var y;
var a = 20;; var b = a * 3; var theta = 30;
var move = mouseX/50
fill(200, 0, 0,100); beginShape();
for (var i = 0; i < 100; i ++) {
var theta = map ( i , 0, 100, 0, TWO_PI);
x = (a + b) * cos(-theta) - b * cos (-theta * (a + b) /b * move); y = (a + b) * sin (-theta) - b * sin (-theta * (a + b) /b * move);
vertex(x,y);
}
endShape(CLOSE);
pop();
}
function drawEpicloid5() {push();
translate( width/2+100, height/2+100);
var x;
var y;
var a = 20;; var b = a * 3; var theta = 30;
var move = mouseY/50
fill(200, 210, 0,50); beginShape();
for (var i = 0; i < 100; i ++) {
var theta = map ( i , 0, 100, 0, TWO_PI);
x = (a + b) * cos(theta) - b * cos (theta * (a + b) /b * move); y = (a + b) * sin (theta) - b * sin (theta * (a + b) /b * move);
vertex(x,y);
}
endShape(CLOSE);
pop();
}
function drawEpicloid6() {push();
translate( width/2+100, height/2+100);
var x;
var y;
var a = 20;; var b = a * 3; var theta = 30;
var move = mouseY/50
fill(0, 210, 0,50); beginShape();
for (var i = 0; i < 100; i ++) {
var theta = map ( i , 0, 100, 0, TWO_PI);
x = (a + b) * cos(-theta) - b * cos (-theta * (a + b) /b * move); y = (a + b) * sin (-theta) - b * sin (-theta * (a + b) /b * move);
vertex(x,y);
}
endShape(CLOSE);
pop();
}
function drawEpicloid7() {push();
translate( width/2-100, height/2+100);
var x;
var y;
var a = 20;; var b = a * 3; var theta = 30;
var move = mouseX/50
fill(0, 250, 0,130); beginShape();
for (var i = 0; i < 100; i ++) {
var theta = map ( i , 0, 100, 0, TWO_PI);
x = (a + b) * cos(theta) - b * cos (theta * (a + b) /b * move); y = (a + b) * sin (theta) - b * sin (theta * (a + b) /b * move);
vertex(x,y);
}
endShape(CLOSE);
pop();
}
function drawEpicloid8() {push();
translate( width/2-100, height/2+100);
var x;
var y;
var a = 20;; var b = a * 3; var theta = 30;
var move = mouseX/50
fill(200, 210, 0,50); beginShape();
for (var i = 0; i < 100; i ++) {
var theta = map ( i , 0, 100, 0, TWO_PI);
x = (a + b) * cos(-theta) - b * cos (-theta * (a + b) /b * move); y = (a + b) * sin (-theta) - b * sin (-theta * (a + b) /b * move);
vertex(x,y);
}
endShape(CLOSE);
pop();
}