Dark Bit Factory & Gravity

PROGRAMMING => Freebasic => Topic started by: Cod1ngFreak on April 15, 2012

Title: Need Help Waving PIC
Post by: Cod1ngFreak on April 15, 2012
Hi,
I need a little help, and that I wanted a wavy image animation program.

This should look something like:


The X are the Pixels from the image

 XXXXXXXX -->
XXXXXXXX
XXXXXXXX

 XXXXXXXX
XXXXXXXX - >

       XXXXXXXX
  <--XXXXXXXX


  <--XXXXXXXX
XXXXXXXX

I hope you understand my question based on the description.
Or is there an easier way to achieve this?

Sorry for my bad english :(

Title: Re: Need Help Waving PIC
Post by: Shockwave on April 18, 2012
Hi Cod1ngFreak.  So we can answer your question, what graphics library are you using in Freebasic (Tinyptc, fbgfx, sdl, opengl etc)?

To make a wavy offset like that, the best way is to use the sin command to generate a nice sine wave offset that can be added to each successive line of the picture when it's being drawn.

Have you written any of the code?
Title: Re: Need Help Waving PIC
Post by: Knurz on April 18, 2012
Hi.

Take a look at a NeHe-Tutorial : http://nehe.gamedev.net/tutorial/flag_effect_(waving_texture)/16002/

This explains the basics of this "effect" and gives you a sample.

Title: Re: Need Help Waving PIC
Post by: Dr_D on May 21, 2012
Hey guys... long time no see.

Cod1ngFreak, I was messing around with FreeBASIC a few years ago and made something to that effect. It's probably not what you expect... and not really what the functionality was designed for, in my opinion, but it does use a sine wave to manipulate an image as in your ascii drawing.  Hope it's useful. :)

http://drd.owlbox.net/download.php?id=108