Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let v = 0;
- let k = 100;
- let points = [];
- function setup() {
- createCanvas(700, 400);
- noFill();
- }
- function draw() {
- background(255);
- circle1 = [cos(v), sin(v)];
- circle2 = [cos(3 * v) / 3, sin(3 * v) / 3];
- circle3 = [cos(5 * v) / 5, sin(5 * v) / 5];
- circle4 = [cos(7 * v) / 7, sin(7 * v) / 7];
- circle5 = [cos(9 * v) / 9, sin(9 * v) / 9];
- circle6 = [cos(11 * v) / 11, sin(11 * v) / 11];
- pos1 = [height / 2 + k * circle1[0], height / 2 + k * circle1[1]];
- pos2 = [pos1[0] + k * circle2[0], pos1[1] + k * circle2[1]];
- pos3 = [pos2[0] + k * circle3[0], pos2[1] + k * circle3[1]];
- pos4 = [pos3[0] + k * circle4[0], pos3[1] + k * circle4[1]];
- pos5 = [pos4[0] + k * circle5[0], pos4[1] + k * circle5[1]];
- pos6 = [pos5[0] + k * circle6[0], pos5[1] + k * circle6[1]];
- points.splice(0, 0, pos6[1]);
- if (points.length > 120) points.splice(119, 120);
- // Draws Circles
- strokeWeight(1);
- let d = 2*k
- circle(height/2, height/2, d);
- circle(pos1[0], pos1[1], d/3);
- circle(pos2[0], pos2[1], d/5);
- circle(pos3[0], pos3[1], d/7);
- circle(pos4[0], pos4[1], d/9);
- circle(pos5[0], pos5[1], d/11);
- // Draws Graph
- for (i = 0; i < points.length-1; i++)
- line(400+2*(i-1), points[i], 400+2*(i), points[i+1]);
- // Draws line from circle to graph
- line(pos6[0], pos6[1], 400, pos6[1]);
- // Draws all dots
- strokeWeight(4);
- point(pos1[0], pos1[1]);
- point(pos2[0], pos2[1]);
- point(pos3[0], pos3[1]);
- point(pos4[0], pos4[1]);
- point(pos5[0], pos5[1]);
- point(pos6[0], pos6[1]);
- v -= 0.05;
- if (v < TAU) v += TAU;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement