Sample Sinus Wave for Beginners

Started by Crystal Noir, May 20, 2008, 10:51:23 AM

Previous topic - Next topic

Crystal Noir

Hello all :)

Here's a sample sinus wave. The code is very easy to understand and you can make cool effect with.

To run this sample you have to download this picture :

Here's the code

PlayBASIC Code: [Select]
; PROJECT : sinus
; AUTHOR : Crystal Noir
; CREATED : 19/05/2008
; EDITED : 20/05/2008
; ---------------------------------------------------------------------

;Variables for angles
Global starangle#
Global angle#


;Image Loading
LoadImage "bigmac.jpg",1


;Array to store coordinates of sinus wave
Dim TableSin(360)
For angle# = 0 To 359
TableSin(angle#) = 50 * Sin(angle#)
Next

starangle# = 0


;Main Loop

Repeat
Cls RGB(0,0,0)
angle# = starangle#
For y = 0 To 266
CopyStripH 1,y,0,385,0,TableSin(angle#),y
angle# = angle# +1
If angle# > 359
angle# = 0
EndIf
Next y
starangle# = starangle# + 1
If starangle# > 359
starangle# = 0
EndIf

Sync
Until EscKey() = True



  (Dead links removed)