블로그 이미지
Leeway is... the freedom that someone has to take the action they want to or to change their plans.
maetel

Notice

Recent Post

Recent Comment

Recent Trackback

Archive

calendar

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
  • total
  • today
  • yesterday

Category

2007. 6. 27. 17:09 Code/NodeBox


size(200,200)
speed(100)

def setup():
    global x
    global y
    global f
    global c

    f=0
    
    c=range(16) #color value
    for cell in range(16): #cell number
        c[cell]=1
    
def draw():
    global x
    global y
    global f
    global c
    
    f+=1 #frame
    x=MOUSEX
    y=MOUSEY    
    s=50 #size of a cell    
    b=1 #blue
 
    for cell in range(16):
        c[cell]-=0.05
    
    for h in range(4):
        for w in range(4):
            cell=h*4+w #cell number (defined again for visual construction)
            if ((x>=w*s)&(x<=(w+1)*s)) & ((y>=h*s)&(y<=(h+1)*s)):
                c[cell]=1
                
            fill(c[cell],c[cell],b)
            stroke(1)
            rect(w*s,h*s,s,s)
 
## my miss - range를 매개변수로서의 용도로만 한정했다.
## lesson - range는 array의 역할을 할 뿐 아니라 그 자체로 값을 가질 수 있다.

'Code > NodeBox' 카테고리의 다른 글

matrix-glimmer  (0) 2007.07.04
matrix_color_chain  (0) 2007.06.27
matrix  (0) 2007.06.27
arrive  (0) 2007.06.25
steering  (0) 2007.06.25
posted by maetel