Gold Waves - johnno56 - 05-18-2026
This was a graphics demo that I converted to RCBasic some 4 or 5 years ago... I had a few minutes to spare and thought, "Why not?", and modified it to run with N7... Adjust the fwait to suit your device. I had to slow it down as it ran too fast... lol
Code: set window "Gold Waves", 600, 480, false
set redraw off
#win32
for t = 1 to 99 step 0.3
set color 64, 0, 0
cls
for y1 = 0 to 24
for x1 = 0 to 24
x=(12*(24-x1))+(12*y1)
y=(0-6*(24-x1))+(6*y1)+300
d=((10-x1)^2+(10-y1)^2)^0.5
h=60*sin(x1/4+t)+65
if t > 10 and t < 20 then
h=60*sin(y1/4+t)+65
endif
if t > 20 and t < 30 then
h=60*sin((x1-y1)/4+t)+65
endif
if t > 30 and t < 40 then
h=30*sin(x1/2+t)+30*sin(y1/2+t)+65
endif
if t > 40 and t < 50 then
h=60*sin((x1+y1)/4+t)+65
endif
if t > 50 and t < 60 then
h=60*sin(d*0.3+t)+65
endif
' Draw "wave"
set color 100+h,100+h,h
draw poly [x,y-h,x+10,y+5-h,x+20,y-h,x+10,y-5-h], true ' TOP
set color 60,60,0
draw poly [x,y-h,x+10,y+5-h,x+10,y,x,y-5], true ' FRONT-LEFT
set color 150,150,0
draw poly [x+10,y+5-h,x+10,y,x+20,y-5,x+20,y-h], true ' FRONT-RIGHT
if keydown(KEY_ESCAPE, true) then
end
endif
next
next
redraw
fwait 20
next
wait 1000
The original listing would draw all four sides of each surface and 'floodfill'... The use of the more efficient 'draw poly' is the reason for slowing it down...
RE: Gold Waves - 1micha.elok - 05-19-2026
Let's rotate the waves 
Code: set window "Gold Waves_modified", 600, 480, false
set redraw off
zoom = 1.0
angle = 0.0
do
for t = 1 to 99 step 0.3
if keydown(KEY_UP, true) and zoom < 3.0 then zoom = zoom + 0.05
if keydown(KEY_DOWN, true) and zoom > 0.2 then zoom = zoom - 0.05
angle = angle + 0.02
s = zoom
set color 64, 0, 0
cls
for y1 = 0 to 24
for x1 = 0 to 24
' Original grid position centered around origin
gx = (x1 - 12) * 20
gy = (y1 - 12) * 20
' Apply rotation around Z-axis
rx = gx * cos(angle) - gy * sin(angle)
ry = gx * sin(angle) + gy * cos(angle)
' Isometric projection
proj_x = (rx - ry) * 0.5
proj_y = (rx + ry) * 0.25
' Scale and center on screen
x = proj_x * s + 300
y = proj_y * s + 240
d = ((10 - x1)^2 + (10 - y1)^2)^0.5
h = 60 * sin(x1 / 4 + t) + 65
if t > 10 and t < 20 then h = 60 * sin(y1 / 4 + t) + 65
if t > 20 and t < 30 then h = 60 * sin((x1 - y1) / 4 + t) + 65
if t > 30 and t < 40 then h = 30 * sin(x1 / 2 + t) + 30 * sin(y1 / 2 + t) + 65
if t > 40 and t < 50 then h = 60 * sin((x1 + y1) / 4 + t) + 65
if t > 50 and t < 60 then h = 60 * sin(d * 0.3 + t) + 65
vh = h * s
hw = 10 * s
hh = 5 * s
set color 100 + h, 100 + h, h
draw poly [x, y - vh, x + hw, y + hh - vh, x + hw * 2, y - vh, x + hw, y - hh - vh], true ' TOP
set color 60, 60, 0
draw poly [x, y - vh, x + hw, y + hh - vh, x + hw, y, x, y - hh], true ' FRONT-LEFT
set color 150, 150, 0
draw poly [x + hw, y + hh - vh, x + hw, y, x + hw * 2, y - hh, x + hw * 2, y - vh], true ' FRONT-RIGHT
if keydown(KEY_ESCAPE, true) then end
next
next
redraw
fwait 20
next
loop
RE: Gold Waves - johnno56 - 05-19-2026
Cool...
RE: Gold Waves - kevin - 05-19-2026
Aawesome, thanks both. I'm always in awe that someone can come up with such effects.
|