Skip to content

Commit f7daaab

Browse files
committed
Use more PShape functionality in star.py
1 parent c5ab29d commit f7daaab

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

basics/form/star.py

+14-14
Original file line numberDiff line numberDiff line change
@@ -36,25 +36,25 @@ def setup():
3636
size(640, 360)
3737

3838
star_one = star(0, 0, 5, 70, 3)
39+
star_one.translate(width * 0.2, height * 0.5)
40+
3941
star_two = star(0, 0, 80, 100, 40)
42+
star_two.translate(width * 0.5, height * 0.5)
43+
4044
star_three = star(0, 0, 30, 70, 5)
45+
star_three.translate(width * 0.8, height * 0.5)
46+
4147

4248
def draw():
4349
background(102)
44-
with push_matrix():
45-
translate(width * 0.2, height * 0.5)
46-
rotate(frame_count / 200)
47-
draw_shape(star_one)
48-
49-
with push_matrix():
50-
translate(width * 0.5, height * 0.5)
51-
rotate(frame_count / 400)
52-
draw_shape(star_two)
53-
54-
with push_matrix():
55-
translate(width * 0.8, height * 0.5)
56-
rotate(frame_count / -100)
57-
draw_shape(star_three)
50+
star_one.rotate(0.005)
51+
draw_shape(star_one)
52+
53+
star_two.rotate(0.0025)
54+
draw_shape(star_two)
55+
56+
star_three.rotate(-0.01)
57+
draw_shape(star_three)
5858

5959
if __name__ == '__main__':
6060
run()

0 commit comments

Comments
 (0)