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:
basey+Sin(upoffset+(t*speed))
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.
it seems your upoffset should be outside of the sin :
basey + sin(tspeed)upoffset
[Please log in to post a comment]