Qbasicnews.com

Full Version: Sound Wave Bar.....
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5 6 7 8
ok, here goes

Code:
SCREEN 19, 32, 2, 1
amp = 100
FOR x = 1 TO 800
PSET (x, 300 - (amp * SIN(ang * 3.24/180))), RGB(0,255,0)
ang = ang + 1
PSET (x ,300 - (amp / SIN(ang * 3.24/180)) ),rgb(0,x,0)
LINE (0,300)-(800, 300), RGB(ang,0,0)
line (0,450)-(800, 450), rgb(ang -1,10,0)
line (0,0)-(800,200),0,bf : sleep 5 : NEXT : sleep

i know, i cheated... its supposed to look like a reflection :wink:
Smile Thats fine, I put above you could put more line if you'd just try, heh,.. you can add more if you need to to make it reflect better,.. cool anyway.. Big Grin

Here is my rule braker... FB, looks loads better..
Code:
SCREEN 19, 32, 2, 1
amp = 1
DO
   LINE (0,0)-(800, 600), 0, BF
   LINE (0,300)-(800, 300), RGB(0,0,255)
   FOR x = 1 TO 800
      y! = amp * SIN(ang * 3.24/180)
      PSET (x, 300 - y!), RGB(0,255,0)
      ang = ang + 1
   NEXT
   WAIT &H3DA, 8
   amp = (amp + 1) MOD 200
LOOP UNTIL INKEY$ <> ""
SLEEP

QB version, close, lil cooler effect, runs in FB also.. :wink:
Code:
SCREEN 13
amp = 1
DO
   LINE (0,0)-(320, 200), 0, BF
   LINE (0,100)-(320, 100), 9
   FOR x = 1 TO 320
      y! = amp * SIN(ang * 3.24/180)
      PSET (x, 100 - y!), 10
      ang = ang + 1
   NEXT
   WAIT &H3DA, 8
   amp = (amp + 1) MOD 100
LOOP UNTIL INKEY$ <> ""
SLEEP

Enjoy! These keep moving!! Big Grin
well, while were breaking rules, i got another.. its soooo breaking the rules its not even funny!!!

Code:
declare function goright(amp,x,y)
declare function goleft(amp,x,y)
screen 19,32,2,1
amp = 5
y = 300
i = 10
do
   amp = amp + 5
do
line (0,300)-(800,300),rgb(y * amp,0,x)
   goright(amp,x,y)
loop until x = 800
do
line (0,300)-(800,300),rgb(y * amp,0,x)
   goleft(amp,x,y)
loop until x = 1
loop
function goright(amp,x,y)
do
pset (x, y - (amp * sin(angle * 3.14 / 180))), rgb (0,200,10)
angle = angle + 1
sleep .6
x = x + 1
loop until x = 800
end function
function goleft(amp,x,y)
do
pset (x, y - (amp * sin(angle * 3.14 / 180))), rgb (0,200,10)
angle = angle + 1
sleep .6
x = x - 1
loop until x = 1
end function

33 lines!! yaaaay! :bounce:
Smile Cool, Back n forth, back n forth.... :rotfl: Your getting right good. Big Grin
My small entry:

[syntax="QBASIC"]
1 amp! = 50.0
2 while inkey$ = ""
3 if t! = 0.0 then screen 13 else wait &H3DA, 8
4 line (319, 99)-(0, 99), 8
5 for x! = 0.0 to 319.0 step 1.0
6 if x! < t! and x! > t! - 15.0 then line (int(x!) - 1, 99 + int(amp! * sin(2 * 3.141592654 * ((x! - 1) / (334.0 / 3.0)))))-(int(x!), 99 + int(amp! * sin(2 * 3.141592654 * (x! / (334.0 / 3.0))))), 31 - int(t! - x!)
7 next x!
8 if t! < 334.0 then t! = t! + 1.0 else t! = 1.0
9 wend
[/syntax]

I can't test this in QB, but it should theoretically work. [EDIT: written/tested in FreeBASIC].

-shiftLynx
dangit, just when i thought i pwned this compo shiftlynx has to step in and put me in my place :normal:

shift, great entry man Big Grin :o
yay.. i drew just a normal sin, nothin fancy in 6 lines! :o

Code:
screen 19,32,2
amp = 100
line (0,300)-(800,300),rgb (150,0,0)
for x = 1 to 800
pset (x,y - (amp * sin(x * 3.14 / 180)) + 300), rgb(100,255,50) next
sleep


bwa ha haaa!
Lynx owned you Tongue
Sad
Don't be sad....I did even do one... Big Grin
Pages: 1 2 3 4 5 6 7 8