Mad Level Manager allows you to configure simple icon and sprite animations on certain events (like mouse hover, clicks or touches). These can be used in a combination with Two Step Activation, but not necessary.
Adding animation component
To animate an icon or a sprite, you have to attach MadAnimation component to the desired game object. The script can be found in your project path: Mad Level Manager / Scripts / Mad2D / MadAnimation.
There are 4 animation events:
- On Mouse Enter – when the mouse is over a sprite
- On Mouse Exit – when the mouse moves away from the sprite
- On Focus – When the sprite gains a focus
- On Focus Lost – When the sprite loses its focus
There’s a little explanation needed about what the focus is. When a sprite is pressed it gains the focus (On Focus). The focus preserves until a user clicks (or touches) other sprite or some other place away from the focused sprite. When this happens, The Focus Lost event is invoked. Nothing changes when the currently focused sprite is clicked the second time.
Notice that all events are disabled by default. If you want the event to be alive, you must check the Enabled field.
On the top you can set the Ease Type. These types are exactly the same types as those used for iTween and they act the same (in fact this is iTween code!).
Then you can set the Move, Rotate and Scale values. All of these values are relative to the origin (at the scene start) value. That means that for example if our sprite was positioned at x=100, y=100 and move is set to x=20, y=20, then it will move to x=120, y=120.
Time is an amount of time in seconds that the animation should take.
The last one is a Tint. It’s disabled by default so if you want to animate sprite tint, you should check Tint Enabled. The tint can be set to one of two options:
- Color – tint will be animated from the current to a given color
- Use Base – tint will be animated from the current to a base color (color of the sprite set initially).