Tag Archives: 3d

BASIC-256 3D Polygons

Here it is:


graphsize 600,600
x=300
y=300
h=50 # Height
color rgb(0,50,100)
poly {(10*n),y-h,(10*n)+10,y+5-h,(10*n)+20,y-h,(10*n)+10,y-5-h}
color rgb(0,30,60)
poly {(10*n),y-h,(10*n)+10,y+5-h,(10*n)+10,y,(10*n),y-5}
color rgb(0,75,150)
poly {(10*n)+10,y+5-h,(10*n)+10,y,(10*n)+20,y-5,(10*n)+20,y-h}
next n
refresh
t+=0.1
end while

BASIC-256 3D Sine Wave Generator

The Code:

graphsize 600,600
color red
fastgraphics
t=0
while true
clg
color grey
rect 0,0,600,600
j = mousex
color red
if j>100 then color orange
if j>150 then color yellow
if j>200 then color green
if j>250 then color blue
if j>270 then color purple
for n = 1 to 600 step 2
y=300
h=(mousey/20)*sin(t+n*(mousex/100))
#r=(mousey/20)*cos(t+n*(mousex/100))
#r=(mousey/20)*tan(t+n*(mousex/100))
color rgb(0,50,100)
poly {(10*n),y-h,(10*n)+10,y+5-h,(10*n)+20,y-h,(10*n)+10,y-5-h}
color rgb(0,30,60)
poly {(10*n),y-h,(10*n)+10,y+5-h,(10*n)+10,y,(10*n),y-5}
color rgb(0,75,150)
poly {(10*n)+10,y+5-h,(10*n)+10,y,(10*n)+20,y-5,(10*n)+20,y-h}
next n
refresh
t+=0.1
end while