Alexandre B A Villares 2018-01-21 22:29:53 -02:00
rodzic 2c9b43defd
commit 4fb2c00370
2 zmienionych plików z 6 dodań i 7 usunięć

Wyświetl plik

@ -11,9 +11,8 @@ r1 = Slider(0,500,100)
r2 = Slider(0,500,200)
np = Slider(3,50,10)
def setup():
size(500, 500, P2D)
size(500, 500, P2D) # P2D necessary! I'm changing fill() inside Shape
colorMode(HSB)
background(0)
r1.position(20, 20)
@ -23,7 +22,6 @@ def setup():
def draw():
background(0)
colorMode(HSB)
npoints, rad1, rad2 = np.val, r1.val, r2.val # I wanted to draw the star before the sliders
with pushMatrix():
translate(width / 2, height / 2)
@ -36,7 +34,7 @@ def draw():
sx = cos(a) * rad2
sy = sin(a) * rad2
cor = map(a, 0, TWO_PI, 0, 255)
fill(cor, 255, 255)
fill(cor, 255, 255) # only works on P2D & P3D renderers
vertex(sx, sy)
sx = cos(a + h_angle) * rad1
sy = sin(a + h_angle) * rad1
@ -44,6 +42,7 @@ def draw():
vertex(sx, sy)
a += angle
endShape(CLOSE)
npoints, rad1, rad2 = np.value(), r1.value(), r2.value() # this is the usual way to get values & draw the sliders
if not frameCount % 10 and frameCount < 500:
saveFrame("###.tga")
npoints, rad1, rad2 = np.value(), r1.value(), r2.value() # usual way to get values & draw the sliders
# if not frameCount % 10 and frameCount < 500: # used to make a GIF on Gimp
# saveFrame("###.tga")

Plik binarny nie jest wyświetlany.