Easy Ease

  • 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.

  • LiteTween is a great plugin for this kind of thing.

  • 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

  • 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?

  • AnD4D

    What about unlerp from HERE?

  • zenox98 Can unlerp be tied in with lerp?

  • 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:

    unlerp

  • 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.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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.

  • 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.

  • You can make it ease in if you replace the actions in your last event with:

    Camera: Rotate 100/anglediff(Camera.Angle, Pointers.Angle) degrees toward Pointer.Angle

    System: Set layout angle to Camera.Angle+90

    But then the rotation has a jarring stop instead of a jarring start. You could also use clamp to cap the maximum speed to reduce the jarring.

  • R0J0hound

    Thanks! I'm looking to combine the two... so it will smoothly begin to rotate, speed up, and then smoothly come to a stop. EaseInOut.

    Interesting about the 100/anglediff though. Didn't know that!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)