2007. 7. 4. 17:44
Code/NodeBox
size(200,200)
speed(100)
def setup():
global x
global y
global c
global n
global m
c=range(16) #color of a cell
n=range(16) #cell number
m=range(16) #maximum color of a cell
for n in range(16):
c[n]=0
def draw():
global x
global y
global c
global n
global m
x=MOUSEX
y=MOUSEY
s=50 #size of a cell
b=1 #blue
for n in range(16):
c[n]-=0.1
for h in range(4):
for w in range(4):
n=h*4+w
if ((x>=w*s)&(x<=(w+1)*s)) & ((y>=h*s)&(y<=(h+1)*s)):
c[n]=1
m[n]=1
if (n<=11) & (c[n]>0) & (c[n]<=0.1):
c[n+4]=m[n]*0.6
m[n+4]=m[n]*0.6
stroke(1)
fill(c[n],c[n],b)
rect(w*s,h*s,s,s)
### 각 셀의 최대(색상)값을 보유하기 위해 새로운 range 변수를 쓴다.
speed(100)
def setup():
global x
global y
global c
global n
global m
c=range(16) #color of a cell
n=range(16) #cell number
m=range(16) #maximum color of a cell
for n in range(16):
c[n]=0
def draw():
global x
global y
global c
global n
global m
x=MOUSEX
y=MOUSEY
s=50 #size of a cell
b=1 #blue
for n in range(16):
c[n]-=0.1
for h in range(4):
for w in range(4):
n=h*4+w
if ((x>=w*s)&(x<=(w+1)*s)) & ((y>=h*s)&(y<=(h+1)*s)):
c[n]=1
m[n]=1
if (n<=11) & (c[n]>0) & (c[n]<=0.1):
c[n+4]=m[n]*0.6
m[n+4]=m[n]*0.6
stroke(1)
fill(c[n],c[n],b)
rect(w*s,h*s,s,s)
### 각 셀의 최대(색상)값을 보유하기 위해 새로운 range 변수를 쓴다.
'Code > NodeBox' 카테고리의 다른 글
storing_test (0) | 2007.07.05 |
---|---|
pop_test (0) | 2007.07.05 |
matrix-glimmer (0) | 2007.07.04 |
matrix_color_chain (0) | 2007.06.27 |
matrix-color change (0) | 2007.06.27 |