Easy Ease

Get help using Construct 2

Post » Sat Dec 14, 2013 2:47 am

While the lerp expression eases out, I'd like to ease in as well. Is there an expression that will allow this?

I've done a search, and found a list of examples, including a great one by Yann, but unfortunately it's over my head. I simply don't seem to grasp function parameters yet.

I'm looking to have an angle that smoothly transitions from one to another. ATM I'm using lerp, and the sudden start is a little disorientating.

Any help would be appreciated.

@bearboxmedia
www.bearboxmedia.com

Nintendo Wii U Developer using Construct 2
B
79
S
12
G
7
Posts: 961
Reputation: 10,717

Post » Sat Dec 14, 2013 3:21 am

LiteTween is a great plugin for this kind of thing.
ImageImageImage
B
71
S
21
G
221
Posts: 3,650
Reputation: 124,229

Post » Sat Dec 14, 2013 3:24 am

I second blackhornet suggestion. In fact I feel a tween beheaviour plugin shuld be default. However Lunaarry did such a fine job on the plugin that I pretty much use Litetween as a basic plugin. It's one of the few I do :D
B
90
S
18
G
9
Posts: 2,455
Reputation: 15,013

Post » Sat Dec 14, 2013 10:12 am

@blackhornet
@jayderyu

LiteTween looks good if I intend on using it for one static object, and then another... so ideal for menus... But I should have said that I'm using it as a camera which is constantly rotating the layout to the angle of the player. This means that the angle is constantly changing. At one point, you can change the focus of the camera, and I wanted it to rotate smoothly to the next angle.

With both angles constantly changing, I just got a pop.

@Ashley - Sorry to bother you. Is there such a thing as reverse lerp? Could something like this be added as default?
@bearboxmedia
www.bearboxmedia.com

Nintendo Wii U Developer using Construct 2
B
79
S
12
G
7
Posts: 961
Reputation: 10,717

Post » Sat Dec 14, 2013 10:22 am

@AnD4D
What about unlerp from HERE?
If your vision so exceeds your ability, then look to something closer.
Moderator
B
132
S
29
G
81
Posts: 5,328
Reputation: 56,655

Post » Sat Dec 14, 2013 3:31 pm

@zenox98 Can unlerp be tied in with lerp?
@bearboxmedia
www.bearboxmedia.com

Nintendo Wii U Developer using Construct 2
B
79
S
12
G
7
Posts: 961
Reputation: 10,717

Post » Sat Dec 14, 2013 7:27 pm

I don't understand what you mean, I'm afraid.

You asked specifically for a reverse lerp, and from the description in the manual, that's exactly what unlerp is.

This useful explanation and examples may be useful:

unlerpzenox982013-12-14 19:51:58
If your vision so exceeds your ability, then look to something closer.
Moderator
B
132
S
29
G
81
Posts: 5,328
Reputation: 56,655

Post » Sun Dec 15, 2013 3:40 am

It really sounds like you just want to swap the start and end values of Lerp around to make it go in the opposite direction, is that what you mean?

Edit: A capx showing what you want/are doing would really help here.Jayjay2013-12-15 03:41:05
"Construct 4 lets YOU make advanced games! (but not play them)" Construct Classic - Examples Kit
B
113
S
39
G
17
Posts: 2,184
Reputation: 19,217

Post » Sun Dec 15, 2013 5:02 am

Lerp isn't actually for easing, it's for getting a position between two points. But I get what you're saying and my guess is you're using keep in an event like this.

Every tick
---Sprite: set x to lerp(self.x, 100, 0.5)

Which gives the effect of moving fast to slow. What it's doing is just moving half the distance per frame.
You'll need to add a variable for a reverse effect.
To start it set the variable to say o.
Set speed to 0

Then every tick set a new x and increase the speed

Every tick
--- set x to min(self.x + speed, 100)
--- add 1 to speed

The min() is to keep from overshooting. Also note this only works for a positive direction. For a negative direction do this:

Every tick
--- set x to max(self.x - speed, -100)
--- subtract 1 from speed

Also you can fix it up to use dt so it behaves the same regardless of the framerate. R0J0hound2013-12-15 05:05:37
B
91
S
31
G
103
Posts: 5,238
Reputation: 67,762

Post » Sun Dec 15, 2013 12:35 pm

Thanks @R0J0hound although I should correct myself. I am using AngleLerp to rotate the layout.

Please see the below capx

https://dl.dropboxusercontent.com/u/50465867/Construct/SpaceFlight.capx

Please use the arrow keys to navigate. Note that the camera will aim at you based on the planet's perspective. When you leave that planet and approach another, the camera rotates around to look at you from that planet's perspective. This assists in landing (and is no where near finished yet).

I dislike the sudden rotation, and would like a smooth change.

Is this possible using your example? The problem with rotation is that I want it to always rotate the shortest amount needed.
@bearboxmedia
www.bearboxmedia.com

Nintendo Wii U Developer using Construct 2
B
79
S
12
G
7
Posts: 961
Reputation: 10,717

Next

Return to How do I....?

Who is online

Users browsing this forum: DrKoala and 9 guests