-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrandRects.2dpy
47 lines (42 loc) · 1.08 KB
/
randRects.2dpy
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
def Init():
# --- author : rickb
STR.SetFParam0Name("Decay")
STR.SetFParam1Name("Color Adjust")
STR.SetFParam2Name("Size")
GLB.a = 0
GLB.mode = 0
GLB.delta = 0
# --- accent : Double Rect
# --- trigger : Rotate Mode
def Render(cr):
# ---- clear screen
f0 = STR.F0mix(0.00,.35)
f1 = STR.F1mix(-0.5,0.5)
f2 = STR.F2()
cr.set_source_rgba(0,0,0,f0)
cr.rectangle(0,0,320,240)
cr.fill()
cr.set_source_rgb(0,random.random()+f1,random.random()-f1)
x = 320*random.random()
y = 240*random.random()
if STR.CheckTrigger():
GLB.mode = 0 if GLB.mode == 1 else 1
if GLB.mode == 0:
GLB.delta=0
if GLB.mode:
cr.translate(160,120)
cr.rotate(GLB.delta)
cr.translate(-160,-120)
GLB.delta = GLB.delta - 0.1
cr.set_line_width(4)
w = GLB.a*200*f2
h = GLB.a*140*f2
cr.rectangle(x,y,w,h)
if STR.CheckAccent():
cr.set_source_rgb(0,random.random()-f1,random.random()+f1)
cr.set_line_width(2)
cr.rectangle(x-10,y-10,w+20,h+20)
cr.stroke()
GLB.a = GLB.a+0.1
if GLB.a>1.0:
GLB.a=0