-
Notifications
You must be signed in to change notification settings - Fork 4
3. Basic animation
In this chapter, I am going to teach you, how to create very fast, powerful animations. With powerful I mean basics.
There are multiple ways how to animate object with NoLimitsFramework.
I would suggest to use the com.NoLimitsFramework.animation.Animatation class (hint: import com.NoLimitsFramework.animation.*). The constructor of the Animatation class accepts a query string. At this moment, only Scenery query is accepted. Queries are easy to use. If you want to crawl a scenery object which is placed in your NoLimits Editor and for example labeled Cube then your query should look like: Scenery: Cube. If you want to crawl an object inside your cube (for example if you have a 3ds file with multiple nodes) you can use such a query: Scenery: Cube, Cube1.
So lets instantiate an animation object.
Animation CubeAnimation = new Animation("Scenery: Cube");
Now, we are able to define a transition. For this purpose, the Animation class provides an important method called addAnimation(PropertyToAnimate, NewValue, StartTime, EndTime, Easing).
Let me explain the arguments for addAnimation.
-
PropertyToAnimate: What do we want to animate? The position, scale, rotation, etc. I am going to make an API for NoLimitsFramework where you can catch the possible options.
-
NewValue: The new value of the property
-
StartTime: If you want only one animation, just use 0.0f for beginning on the 0nd second.
-
EndTime: I guess you might know what this argument does
-
Easing: This is an interesting topic. I am going to write a wiki article, especially for easing. At this time you can look at the easings on this website: http://easings.net/en. Almost all of them are implemented. I am quoting the explanation on easings.net what easings actually are:
Easing functions specify the rate of change of a parameter over time. Objects in real life don’t just start and stop instantly, and almost never move at a constant speed. When we open a drawer, we first move it quickly, and slow it down as it comes out. Drop something on the floor, and it will first accelerate downwards, and then bounce back up after hitting the floor.