블로그 이미지
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. 7. 5. 16:54 Code/NodeBox
프로세싱 홈피에서 다음 예제를 발견!

Storing Input.
Move the mouse across the screen to change the position of the circles. The positions of the mouse are recorded into an array and played back every frame. Between each frame, the newest value are added to the end of each array and the oldest value is deleted. (Updated 21 August 2002)

이렇게 적용!

size(200,200)
speed(100)

def setup():
    global x
    global y
    global t
    
    t=10
    x=range(t)
    y=range(t)  
   
    for t in range(10):
        x[t]=-100
        y[t]=-100
      
    
def draw():
    global x
    global y
    global t

    for i in range(t-1):
        x[i]=x[i+1]
        y[i]=y[i+1]
        
        x[t-1]=MOUSEX
        y[t-1]=MOUSEY
    
    for i in range(t):    
        rect(x[i],y[i],10,10)


#x, y range의 초기값이 자동으로 설정되어 있어서 발생하는 원치않은 이미지를 size 밖으로 빼준다.


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

popping_1.0 (수정 중)  (0) 2007.07.06
popping_0.0  (0) 2007.07.06
pop_test  (0) 2007.07.05
matrix_glimmer_dim  (0) 2007.07.04
matrix-glimmer  (0) 2007.07.04
posted by maetel