-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsketch.js
69 lines (60 loc) · 1.94 KB
/
sketch.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
//this is the angle at which the shapes will rotate
let angle = 200;
let paper;
// let petals;
// let middle;
// let bottom;
function setup() {
createCanvas(windowWidth, windowHeight);
//switching the angleMode from radians to degrees
angleMode(DEGREES);
frameRate(600);
paper = color('#F8F1FFEF');
// petals = color('##EFCB68');
// middle = color('##EE9344');
// bottom = color('##3F292B');
}
function draw() {
background("rgba(18, 19, 23, 0.95)");
noFill();
stroke(paper);
strokeWeight(2.1);
// Moire Flower
push(); //change the style and transformation settings
//a point of origin for rotation -- the middle of the window screen
translate(windowWidth/2, windowHeight/2);
// outer loop
for(let cycle = 0; cycle < 80; cycle++) {
rotate(angle * 2);
circle(100, 100, 60);
}
// middle loop
for(let cycle = 0; cycle < 100; cycle++) {
rotate(angle * 2);
circle(75, 80, 30);
}
//inner loop
for(let cycle2 = 0; cycle2 < 45; cycle2++) {
rotate(angle * 2);
circle(40, 40, 100);
}
//rotate the shapes at this expression with every iteration
angle += 0.07;
pop(); //return to original style and transformation settings
//Grid Background
//begin drawing new shape
beginShape(LINES);
//these loops draw x and y grid lines for the background
//the xGrid lines start at 0 and go across the full width of the window screen by incrementing by 10
for (let xGrid = 0; xGrid <= windowWidth; xGrid += 10) {
//while the xGrid lines form, the yGrid lines start at 0 and go across the full height of the window screen by incrementing by 1 -- looking more like solid lines than the xGrid lines do
for (yGrid = 0; yGrid <= windowHeight; yGrid++) {
strokeWeight(0.07);
//within the loops, I determined the vertices of the grid lines
//the yGrid lines are positioned with an increment of one
vertex(xGrid, yGrid++);
}
}
//end of Grid Background
endShape();
}