Math help - sinus graph


I am trying to make a mathematic formula, which if multiplied by a continuisly increasing variable (this case Time.deltaTime)
it will produce a sinus-graph like value increase:
like it starts increasing slowly, than it reaches full speed, than it starts to decrease slowly;kind of like watertides licking the beach sand.

I lack the necessary knowledge with sin,cos and radians ,so if you could help me out, that would be greatly appriciated.


First, Time.deltaTime isn't constantly increasing as it is the time past since the last frame. It's usually under 0,1. You're talking about Time.time, the time past since the begin (scaled by timeScale).

Now, to do what you're talking about, just write

fx = Mathf.Abs( Mathf.Sin( Time.time * Mathf.PI * speed ) ) * amplitude;

That way, fx will vary between 0 and amplitude in one second *speed. Alternatively, take a look at Mathf.Repeat (//////) and Mathf.PingPong (/\/\/\/\/\) instead of the trigo functions (/¯\_ /¯\_/¯\).

Finally, if you want a better control over all those things, there is the AnimationCurve class, which isn't that hard to use.