Creating a smooth sliding effect with Lerp

2

Stats

9,117 visits, 14,170 views

Tools

Translations

This tutorial hasn't been translated.

License

This tutorial is licensed under CC BY 4.0. Please refer to the license text if you wish to reuse, share or remix the content contained within this tutorial.

Published on 16 Sep, 2012. Last updated 19 Feb, 2019

UPDATE: 18-09-2012

Check out EaseTween!

I recommend to check out the EaseTween behaviour as well. It will save you time, and add awesome effects!

Edit(Might also be Buggy sometimes!)

Here is a comparison of my lerp slide, and slides using EaseTween:

Comparison of Lerp and Ease Tween in project.

EaseTween can be found here:

EaseTween

------------------------------------------------------------------------------------------------------------

While I am working on a project for a competition I made this CAPX you might find useful.

I use it to create slides that look like a PowerPoint presentation.

Sneak Peak:

Slide Example

.

OK, let's talk a little about Lerp:

------------------------------------------------------------------------------------------------------------

Lerp is a VERY useful function.

It takes 3 values. A, B, and C.

A and B are are the two moving points, and C is the percentage between them and is usually a number between 0 and 1 ( 0 = 0%, 1 = 100%)

So if we set lerp to A,B, 0,5; we get the point right in between A and B.

Simple eh?

Now In the Capx there is a Variable for all 3 Lerp values, but let's focus on whats making it slide, the Variable for C.

Every Tick we are adding: 1 dt* to C, this means that over 1 second, C goes from 0 to 1 (or 0% to 100%).

So it goes from slide A to slide B in one second.. SMOOTH!

More info inside the Capx :)

------------------------------------------------------------------------------------------------------------

The CAPX is very well commented, so that should be enough for you to learn of :) Else I will add more when I am done with my current project.

Here is the CAPX:

CAPX

.

Bye for now, I gotta Finnish my Competition entry!

  • 0 Comments

Want to leave a comment? Login or Register an account!