How do I sin / cos/ lerp / derp

Get help using Construct 2

Post » Tue Nov 01, 2016 11:42 am

Are there any good existing tutorials about how to understand and work with these maths functions within C2? I don't really understand them conceptually and practically often relying on that 'liteTween' behavior. I find this video to be extremely inspiring:

https://youtu.be/M9mSpqrCcHg?t=15m22s


I would absolutely love to be able to animate with code and am looking for references in the manuals and tutorials sections but if anyone already has examples / references they can point me to that would be very much appreciated!

Best,
Mick
B
44
S
13
G
8
Posts: 622
Reputation: 7,417

Post » Tue Nov 01, 2016 1:12 pm

I think what you are looking for is the easing, rather than the interpolation.
http://gizma.com/easing/
Image ImageImage
B
172
S
50
G
182
Posts: 8,439
Reputation: 115,097

Post » Tue Nov 01, 2016 2:08 pm

@newt - yes that's part of it for sure and that is a fantastic link thank you. Fundamentally an understanding of how to reproduce the functionality of the sine behavior in code - any tutorials like that would make for a great starting point.

To extend onto it too, how do they achieve things in that video such as being able to have independent points follow a parent object while also wobbling and rotating
B
44
S
13
G
8
Posts: 622
Reputation: 7,417

Post » Tue Nov 01, 2016 2:21 pm

Trig.
x + cos(angle) * distance
Y + sin(angle) * distance
Plugging the parents xy into that while knowing each point's distance and angle will tell you where the point is.
Image ImageImage
B
172
S
50
G
182
Posts: 8,439
Reputation: 115,097


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 5 guests