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
43
S
13
G
8
Posts: 612
Reputation: 7,372

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
168
S
50
G
163
Posts: 8,220
Reputation: 105,059

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
43
S
13
G
8
Posts: 612
Reputation: 7,372

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
168
S
50
G
163
Posts: 8,220
Reputation: 105,059


Return to How do I....?

Who is online

Users browsing this forum: MaujDeveloper, mrkaio, user5487, Zav and 2 guests