0
\$\begingroup\$

I'm trying to solve a challenge with linearity of my animation. Let say we have a Tug of war mechanic. One team is much stronger and it moves line from point A(0) to point B(10) with a speed of 1 unit per second. It's easy to calculate it takes 10 second to move the line from 0 to 10.

Now the problem is that I want to simulate that both teams are fighting with each other, trying to win so value is fluctuating, being very chaotic, but final result is that after 10 seconds it's in point B(10).

The initial idea was to use random easing functions with intervals <0,1> so without outBack, OutElastic, etc., because I don't want to go with value under 0 and beyond 10. The issue is that easing functions are good for smooth animations, but not to simulate fighting.

My second idea was to use multiple random easing functions. For example between <0,1> I use InQuad, <1,2> Out Expo ... <9,10> InOutCirc. I expect it to seem much more random than just using 1 easing function for whole animation.

I want to ask if you know of any algorithm or other solution to my problem that is better fit than combining easing functions?

\$\endgroup\$

1 Answer 1

1
\$\begingroup\$

Add a sine curve to the value. It makes the value seem fluctuate. But the integral of the sine function is 0, so in the long run it doesn't change the result.

\$\endgroup\$
1
  • 1
    \$\begingroup\$ Perlin noise could be another option, to make the result less regular while maintaining bounds on how far it strays from zero \$\endgroup\$ Commented Dec 7, 2022 at 12:36

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.