Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import appuifw as A
- import math
- import random
- def stop():
- global running
- running=0
- A.app.screen='full'
- running=1
- c=A.Canvas()
- A.app.body=c
- A.app.exit_key_handler=stop
- cx=c.size[0]/2
- cy=c.size[1]/2
- dist=160
- PX=0
- PY=0
- PZ=200
- SZ=8
- rand=random.randrange
- V=[[rand(-40,40),rand(-40,40),rand(-40,40)]]
- AX=AY=AZ=0
- while running:
- sinx=math.sin(AX*math.pi/180)
- cosx=math.cos(AX*math.pi/180)
- siny=math.sin(AY*math.pi/180)
- cosy=math.cos(AY*math.pi/180)
- sinz=math.sin(AZ*math.pi/180)
- cosz=math.cos(AZ*math.pi/180)
- c.clear(0)
- for n in range(len(V)):
- ZX=V[n][0]*cosz - V[n][1]*sinz - V[n][0]
- ZY=V[n][1]*sinz + V[n][1]*cosz - V[n][1]
- YX=(V[n][0]+ZX)*cosy - V[n][2]*siny - (V[n][0]+ZX)
- YZ=(V[n][0]+ZX)*siny + V[n][2]*cosy - V[n][2]
- XY=(V[n][1]+ZY)*cosx - (V[n][2]+YZ)*sinx - (V[n][1]+ZY)
- XZ=(V[n][1]+ZY)*sinx + (V[n][2]+YZ)*cosx - (V[n][2]+YZ)
- z=(V[n][2]+PZ+(XZ+YZ))/dist
- if z < 0.01:
- z=0.01
- x=(V[n][0]+PX+(YX+ZX))/z
- y=(V[n][1]+PY+(ZY+XY))/z
- c.point((cx+x,cy+y),0xdfdf00,width=SZ/z)
- A.e32.ao_sleep(0.01)
- PZ-=2
- V.append([rand(-40,40),rand(-40,40),rand(-40,40)])
- PZ%=160
- if len(V)>25:
- V.pop(0)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement