Log In  
Log In  

I'm getting back into Pico programming and wanted to do some demoscene effects to warm me up like simple sinewave text. Have trouble with math behind it though.

I want to do first as simple bopping up/down sprite that uses sine behind it. I want to be able to control its amplitude (defined as y offset in pixels from the baseline) and frequency (speed). For now I have formula that goes somewhere like:


where upoffset is mentioned amplitude control defined as max possible deviation from baseline, whether positive or negative, t is time elapsed since start (needed so it will actually bop instead of staying in place) and speed is, well, speed.

Unfortunately speed is somewhat coupled with amp control so when I try to increase speed at which things go, it gets too high/low and vice versa - changing amplitude changes speed at which things go.

Any help? This is best I could come up with and at the rate I'm pulling my hair right now, I estimate to go blind in 36 minutes, 43 seconds and 234 milliseconds.

No need for sample code, the formula will do.

P#19516 2016-03-31 18:19 ( Edited 2016-04-01 09:15)

it seems your upoffset should be outside of the sin :
basey + sin(tspeed)upoffset

P#19517 2016-03-31 19:15 ( Edited 2016-03-31 23:15)

Hm, okay, will test it out. Thanks, man.

P#19527 2016-04-01 05:02 ( Edited 2016-04-01 09:02)

Works great! Thanks again!

P#19528 2016-04-01 05:15 ( Edited 2016-04-01 09:15)

[Please log in to post a comment]

About | Contact | Updates | Terms of Use
Follow Lexaloffle:        
Generated 2019-05-23 19:05 | 0.010s | 2097k | Q:15