Animating a Skin

An animated layer does not move. However, an animating skin does move. To actually move a graphical element you must write a MAKI script. In this section, we will show you how to do a sequence of animation that you see in this skin.



  MAKI Script - anim.m
Couple things you need to notice in your XML:

i) Both animated layer and animating skin are "AnimatedLayer" type.
ii) Both use the same graphical element.
iii) The difference lies that animating skin uses a MAKI script to move the arrow.



Lets break down the script:

a. Introduction Comments:

The first part of the script should be a brief introduction to the script. It should talk about the purpose and the functionality of the script.



b. #include Section:

The second part is the #include section. Use "#include" to include any file you need. If you need to call or use another function that is defined in another file, make sure you include that file in your script.



c. Variable Declaration Section

Any variable that you'll use in your script, declare them in this section.



d. System.onScriptUnloading() Section

When the script is unloaded, this part of the script will run. Typically, you do your clean up in this section. Our triangle script is simple and therefore doesn't need anything in this section.



e. System.onScriptLoaded() Section

When the script is first loaded, this part of the script will run. Typically, if anything you want to make happen when the script first start, you do that here. In our example, we initialized some objects and set the initial state for those objects. Just like the previous section, it is perfectly fine to leave this section empty. If you do that, nothing will happen when the script is loaded.

In this script, we set the initial state for several variables and call "move_arrow()" function when the script is loaded.



f. You own functions

To move the arrow, we use two functions. The first function, "move_arrow()", is called by "system.onScriptLoaded()" when the script is loaded. The function of "move_arrow()" is to move the arrow down from its initial location. To do this, it sets the x and y coordinate and the speed for that movement. When the arrow reaches the target location, an event is fired telling the system that the arrow has reached the target location.

Winamp3 is an event driven system. The second function is designed to handle the event when the arrow reaches its destination. Depending on its state, it will direct the arrow to move to a new location. This function is called over and over again every time the arrow reaches its destination. This simple function directs the movement of the arrow that you see in the skin.



Winamp
X
Impressum

Nullsoft, Inc.
22000 AOL Way, Dulles VA 20166
USA
vertreten durch Julie Jacobs und Donald R. Neff

Eingetragen im Company Register von Arizona, USA unter der Nr. 0829063-0

Umsatzsteuer ID: DE251307807

Kontakt: aolmedien@aol.com

Telefon: +1 703 265-0094

Telefax: +1 703 466-9170

AOL Music

Download Winamp, The #1 Free Media Player. Play your MP3, AAC, MPEG, AVI files, and more. Get free MP3 songs, videos, skins and plug-ins. Synch your iPod or Creative Zen, and get mobile music with Winamp Remote.

Copyright © 1999 - 2008 Nullsoft. All Rights Reserved.