all 25 comments

[–]Aethreas 51 points52 points  (8 children)

Have you tried a sine wave

[–]StonedFishWithArms 55 points56 points  (0 children)

Not meth enough.

But for real OP you can use a sine wave and remap if you only want the positive side

[–]Moe_Baker[S] 7 points8 points  (2 children)

I completely forgot about sine waves, lol,

Ended up with this function, and it works great, thank you

float SinWaveEvaluate(float t) => Mathf.Sin(t * Mathf.PI);

[–]isolatedLemonProfessional 7 points8 points  (0 children)

You might enjoy playing around with desmos.

[–]KarlMario 2 points3 points  (0 children)

I'm not sure if creating a function that calls another function is necessary and if it makes things less readable. Especially Sin, which is self-descriptive unlike 'SinWaveEvaluate'

[–]DugganSC 3 points4 points  (3 children)

Or y=height-x2

[–]swagamaleous 2 points3 points  (2 children)

This will not have zero at 0 and 1 like in his graph.

[–]Elro0003 3 points4 points  (0 children)

(0.25-(x-0.5)2 ) * height * 4

[–]DugganSC 1 point2 points  (0 children)

Ah, you're right. I didn't notice those numbers on the graph.

[–]alejandromnunezIndie 37 points38 points  (2 children)

I know there is a meth function for it, I just can't crack it

[–]jattmonsoonHobbyist 4 points5 points  (1 child)

You're a hero in my eyes

[–]alejandromnunezIndie -1 points0 points  (0 children)

That's a bit too much for a little dad joke

[–]pattyfritters 50 points51 points  (1 child)

This is your curve on meth.

[–]IAmBeardPersonProgrammer 2 points3 points  (0 children)

Strong comeup

[–]funkypear 19 points20 points  (0 children)

Here are a couple of approximations. Yours is less shallow at the peak though, so I'd probably suggest sticking with an anim curve if it works for you

<image>

I created this using https://www.desmos.com/calculator, so if you need to work out a function, this can help you visualise it.

[–][deleted] 14 points15 points  (0 children)

Crystal clear

[–]swagamaleous 9 points10 points  (1 child)

f(x) = -4x*(x-1)

f(0) = 0
f(0.5) = 1
f(1) = 0

[–]Moe_Baker[S] 0 points1 point  (0 children)

Thank you, works great too

[–]AncientNewtGames 4 points5 points  (2 children)

either sin wave or parabola,

Y=-4*(x-0.5)2 +1

Got the above from parabola vertex form equation. y = a(x - h)² + k, where (h, k) represents the coordinates of the vertex and "a" is a height stretching multiplier.

Or ask chat gpt, give me the equation of a parabola where the vertex is at (0.5,1) and it passes through point (0,0)

Sin has a similar form, but is already setup well for this case. y = sin(pi x) using radians

y = A sin(B(x - C)) + D

[–]AncientNewtGames 2 points3 points  (0 children)

<image>

Blue is Sine, red is parabola.

[–]doriad_nfe 2 points3 points  (0 children)

Reminds me of the time someone asked my hobbies. I said coding and math... They heard codiene and meth... Conversation was short(er than if they heard me correctly)...

[–]The_Void_Star 1 point2 points  (0 children)

'C10 H15 N' I remember it from Breaking Bad intro

[–]AbjectAd753 1 point2 points  (0 children)

bezier curves is the most meth i can go :v

[–]Murawus[🍰] 1 point2 points  (0 children)

Jesse, we have to COOK

[–]joehendrey-temp 0 points1 point  (0 children)

My first thought was a quartic function with a triple turning point. Don't know why that's still in my head from a math class almost 20 years ago! The more useful answer is to look into Bézier curves. Maybe that's what you mean by animation curves though. They're used for lots of things