11-26-2024, 12:44 PM
Modified version (add an interactivity)
- KEY-UP
- KEY-DOWN
- KEY-UP
- KEY-DOWN
Code:
'==================================
'Doodle (modified)
'originally written in QB64 by Dav
'converted to N7 by Johnno
'add interactivity in N7 by Micha
'==================================
'----------------
' INITIALIZATION
'----------------
#win32
w = 640
h = 640
set window "Doodle",w,h, false
set redraw off
'color definition
black = [0,0,0]
'interactivity
f = 100
'-------
' MAIN
'-------
do
'timing
t = t + 0.01
'clear background
set color black
cls
'interactivity control
if keydown(KEY_UP) then
f = f + 10
elseif keydown(KEY_DOWN) then
f = f - 10
endif
'draw waves
for i = 1 to 8
set color i*32,i*32*0.7,0 'color light transition
for x = 0 to w
y = f * sin(PI * x/w ) * sin(PI * x/w + i * t * 0.3)
draw ellipse x , h/2 + y,i,i,true 'horizontal
draw ellipse w/2 + y, x ,i,i,true 'vertical
next
next
redraw
fwait 30
until keydown(KEY_ESCAPE, true)