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 combination with Two Step Activation, but not necessary.

Adding animation component

To animate an icon or a sprite, you have to attach MadAnimation component into the desired game object. The script can be found in your project path: Mad Level Manager / Scripts / Mad2D / MadAnimation.

If you want to animate all your icons on the layout, then you probably want to add this script into a template or prefab object, and then rebuild your layout when the setup is complete.

Understanding events

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 sprite is pressed it gains the focus (On Focus). The focus preserves until user clicks (or touches) other sprite or some other place away from focused sprite. When this happens, The Focus Lost event is invoked. Nothing changes when currently focused sprite is clicked the second time.

Event properties

Notice that all events are disabled by default. If you want the event to be alive, then you must check the Enabled field.

On the top you can set the Ease Type. These types are exactly the same types that are used in for iTween and they acts same (in fact this is iTween code!).

Then you can set the Move, Rotate and Scale values. All these values are relative to 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 a 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, then you should check Tint Enabled. The tint can be set to one of two options:

  • Color – tint will be animated from the current to given color
  • Use Base – tint will be animated from the current to a base color (color of the sprite set initially).
By initially set color I mean the tint that the sprite has on the first frame of current scene.