Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- tunnel3d :
- # Generate random 3D coordinates for tunnel center.
- 8,1,1,2,"f = sin(2*pi*x/(w-1)); 2.5*f*[g,g]" r. 64,1,1,2,5 b. x,3,2 => coords
- # Create 3D tunnel mesh.
- +r[coords] {2*w#$coords},1,1,100%,0,2 s. c store[-2,-1] _X,_Y
- curve3d "begin(X = get('_X',2*w#$coords)); X[t]",\
- "begin(Y = get('_Y',2*w#$coords)); Y[t]",\
- t,1.25,{2*w#$coords},0,{2*w#$coords-1},16 rv3d.
- l. { # Set colors and opacities
- s3d
- 1,100%,1,3,"xor(int(y/16),y)%2?[ 255,0,y/1000 ]:[ 255,255,255 - y/1000 ]" permute. cyzx y. rv[-3,-1] rm.
- f. "y<h-32?1:0"
- a y
- } => mesh3d
- # Display animation.
- nbf=200
- r[coords] {coords,w+1},1,1,2,0,2
- repeat $nbf { f=$>
- e[] "\r > Frame "{$f+1}/$nbf
- cx,cy,cz:="cz = lerp(0,w#$coords - 1,$>/$nbf);
- cx = i(#$coords,cz,0,0,0,2);
- cy = i(#$coords,cz,0,0,1,2);
- [ cx,cy,cz ]"
- ++3d[mesh3d] {-[$cx,$cy,$cz]}
- r3d. 0,0,1,{180*cos(2*pi*$>/$nbf)}
- 600,600,1,3 j3d. ..,50%,50%,-500,1,4,0,0,500
- 600,600,1,3 j3d. ...,50%,50%,-500,1,2,0,0,500 g. xy,1 a[-2,-1] c norm. !=. 0 b. 1 n. 0,1
- 100%,100%,1,3 j... .,0,0,0,0,1,..
- rm[-4,-2,-1]
- w.
- }
- k[2--2] a z n 0,255 contrast 20 s z rs 50%
Advertisement
Add Comment
Please, Sign In to add comment