The first package: only two files are started.
The second package: List a large number of files, that is, basic Animations (Actions:
Animation: Animation usage, which is basically the same as the format defined by frameanimation provided by the android SDK. All animated images come from different images.
Atlas Animation: Demonstrate image set animation. The animation frame comes from an image and uses the native Android SDK's
Bitmap.createBitmap(Bitmap source, int x,int y,int width, int height, Matrix m, boolean filter);
Methods can also be implemented
Betiller: How to Use the beserer action to make the node move on the beserer curve. The hypotrochoid (inner spin wheel line) Behind it is the same as that of the Laplace curve (draw a circle, an elliptic, there are also custom curves ).
Blink: flashes nodes.
Callfunction: The method used by the targetselector object in object_c is imitated here.
Clip in & out: Like the effect of projector screen lifting, the picture is opened and withdrawn. Interesting.
Delayed show & hide: You can see the name.
Fade in & out: Fade out, the following fade
Fade: It is basically the same as above, but you must specify the start value.
Follow: Tracking, as well as the parallel moving background image (pxx. A node moves and the background moves accordingly.
Jump to & jumpby: One bullet. Number of times and start position.
Move to & move by (angle, path ...): Move at the specified position.
Oribit camera flipx: Use the camera class to complete the corresponding view transformation.
Pause & resume action: When the action is combined, either of them is paused and a response is returned.
Progress by & progress: Clockwise, counterclockwise, as you set. It is generally used for timing buffering.
Rotate by & rotate: Rotation, which is often used in animations. The Android SDK also provides corresponding methods.
Skew by & skew: Image skew
Tint by & tint: Changes the image color value.
How can we solve this problem one by one? Furthermore, these principles are the same.
Below isJump
Public class jumptotest extends wienginetestactivity {// @ overrideprotected layer createlayer () {return New mylayer ();} class mylayer extends layer {// All should inherit one layer, each animation effect, all belong to one layer, and multiple effects are also layered. It is not like box2d. Public mylayer () {wysize S = Director. getinstance (). getwindowsize (); // get the size sprite = sprite of the screen through ctor. make (R. drawable. grossini); // create and add a Sprite node, addchild (sprite); // The addchild method must be added to this layer. Sprite. setposition (60, S. height/2); // place the screen // create an intervalaction for jumpto = (intervalaction) jumpto. make (3, Sprite. getpositionx (), Sprite. getpositiony (), S. width-60, S. height/2,200, 3 ). autorelease (); intervalaction r = (intervalaction). reverse (). autorelease (); // reverse intervalaction seq = (intervalaction) sequence. make (A, R ). autorelease (); // a sequence of Action repeat = (Action) repeatforever. make (SEQ ). autorelease (); // execute the sprite repeatedly. runaction (Repeat); // started running }}}
Let me take a closer look at what they are.
As mentioned above, layer also belongs to node. It inherits node. The following is its code:
Public class layer extends node {public static layer make () {// you can see the effect of the make () function of the classes inherited from the layer, it is a new layerreturn new layer ();} protected layer () {}/*** obtain a layer Java object from the underlying pointer ** @ Param pointer underlying pointer * @ return {@ link layer} * // obtain the underlying pointer. node p_node = xxx. from (pointer); public static layer from (INT pointer) {return pointer = 0? Null: new layer (pointer);} protected layer (INT pointer) {super (pointer);} private native void nativeinit (); // The JNI layer is called here. Protected void donativeinit () {nativeinit () ;}}// check the node class public class node extends basewyobject implements ikeyhandler, listener, listener, ongesturelistener, ondoubletaplistener, these implements start with the I provided in the android SDK. // Intervalaction class public abstract class intervalaction extends finitetimeaction {// limited time action, the finitetimeaction class will certainly provide time-related functions, getduration (), getelapsed (), setduration () protected intervalaction () {} protected intervalaction (INT pointer) {super (pointer);} protected intervalaction (float duration) {}@ override // copy of the object, if you want to run multiple animations on a node, just copy one copy. Public abstract intervalaction copy (); @ overridepublic abstract in Tervalaction reverse () ;}// jumpto still inherits intervalaction. Public class jumpto extends intervalaction // call jniprivate native void nativeinit (float duration, float startx, float starty, float endx, float Endy, float height, int jumps );
Catch up and catch it. All the animations in the action package are written in Lua. Lua language does not understand
See it.