Author Topic: Wobbly Picture Effect  (Read 3036 times)

0 Members and 1 Guest are viewing this topic.

Offline Hotshot

  • DBF Aficionado
  • ******
  • Posts: 2114
  • Karma: 91
    • View Profile
Wobbly Picture Effect
« on: October 09, 2007 »
Specail thanks to Graham K for fixing few things.

I dont know if this one run faster on COBRA full version but let me know will ya  8)

At the moment I playing around with COBRA 2D and 3D.

I have attach the picture ( anhk.jpg ) for this program

hope you like it

Code: [Select]
// WOBBLY EFFECT PICTURE
program
  uses pure2d,keyset

Const wobblyspeed=0.5
Const wobblymin=1
Const wobblymax=100
 
var
  coolpic : element
  wobblydir:real = wobblyspeed
  wobbly:real = wobblymin
  move_y:integer = 1
  i:integer
  x,y,ix,iy,iw,ih:real
  angle :integer

begin
  openscreen       
  coolpic = LoadImage('anhk.jpg')
   
  repeat
    cls
    If move_y<=0   Then Move_y=1               
    If move_y>=4   Then Move_y=4
       
    For i=0 To ImageHeight(coolpic)
        x=(Sin(angle +i) * wobbly)
        y=i
        ix=50
        iy=i
        iw=ImageWidth(coolpic)
        ih=1         
        DrawImageRegion(coolpic,ix,iy,iw,ih ,25+x/2,y*Move_y)
    Next
   
    angle=angle+2
    If angle=360 Then angle=0
   
    wobbly=wobbly+wobblydir
   
    If (wobbly<=wobblymin) Or (wobbly>=wobblymax) Then wobblydir=-wobblydir
 
    flip
  until keydown(vk_escape)
 
  closescreen
end


cheers