Cos and Sin for Wavey Text?

Just starting out? Need help? Post your questions and find answers here.
Swos2009
Enthusiast
Enthusiast
Posts: 112
Joined: Sat Nov 08, 2008 8:19 pm

Cos and Sin for Wavey Text?

Post by Swos2009 »

I have started to make cos and sin to make the wavey text but I have managed make the text go up and down....

like this

Code: Select all

     angle=angle+1
    
     DrawText(x,50+4*Sin(angle), Text$, RGB(255,255,255))
my questions is how do i make wavey text like you see in amiga demo?
User avatar
Blood
Enthusiast
Enthusiast
Posts: 161
Joined: Tue Dec 08, 2009 8:34 pm
Location: United Kingdom

Re: Cos and Sin for Wavey Text?

Post by Blood »

Draw the text to an image and then chop that image up into thin vertical slices and move each one independently to achieve the effect.
C provides the infinitely-abusable goto statement, and labels to branch to. Formally, the goto is never necessary, and in practice it is almost always easy to write code without it. We have not used goto in this book. -- K&R (2nd Ed.) : Page 65
Swos2009
Enthusiast
Enthusiast
Posts: 112
Joined: Sat Nov 08, 2008 8:19 pm

Re: Cos and Sin for Wavey Text?

Post by Swos2009 »

Draw the text to an image and then chop that image up into thin vertical slices and move each one independently to achieve the effect.
I am sorry but I dont know how to achive these... I would like to make sinus scroller but i dont how to do it :(

could someone show me the code how to achive it pls?
User avatar
djes
Addict
Addict
Posts: 1806
Joined: Sat Feb 19, 2005 2:46 pm
Location: Pas-de-Calais, France

Re: Cos and Sin for Wavey Text?

Post by djes »

Where would be the fun, then? Just look at a demo and try to do it by yourself... :/
User avatar
Kaeru Gaman
Addict
Addict
Posts: 4826
Joined: Sun Mar 19, 2006 1:57 pm
Location: Germany

Re: Cos and Sin for Wavey Text?

Post by Kaeru Gaman »

plotting a function means, to draw points on the screen in that way, that the y coordinate is determed by the function value correcponding to the x value.
in case of trigonometrical functions, the x coordinate means the angle you input into the function.

so, start by programming a loop that counts the x coordinates, calculate the functional value from this x, and take the result as y coordinate.

keep in mind, that the sinus functions in PB work upon radiant values, so the waves have a phase of 2pi.
that means, you'll need to devide the x value you put into the function by a high enough value.
e.g. when you put x/16 into the function, you stretch the wave to a phase of approximately 100 pixel (16 ~ 100/2pi).
oh... and have a nice day.
Foz
Addict
Addict
Posts: 1359
Joined: Tue Nov 13, 2007 12:42 pm
Location: Manchester, UK

Re: Cos and Sin for Wavey Text?

Post by Foz »

Swos2009 wrote:I am sorry but I dont know how to achive these... I would like to make sinus scroller but i dont how to do it :(

could someone show me the code how to achive it pls?
When you originally asked about an Amiga demo, I gave you a link to a post - that still has a working demo, complete with text bitmap chopping, rotating, sine wave coasting & scrolling.
Post Reply