top

CAPH.WUI.ANI.SYNCANIMATION

SyncAnimation represents a type of animation that contains one or more basic types of animation(a batch of animations), the different types of basic animation would perform on the same widget which is preset. It is often used in the scenario that multiple animations are needed on a widget.


Constructor

SyncAnimation

Description
Create a SyncAnimation.
Parameters
obj ObjectA widget created by user.
argsArr(Optional) Array Each element of the array, is an object. The object includes some basic properties.
type Object The options are composed of some basic properties of syncAnimation.
Emulator SupportY
SDK ConstraintNone
Example
var SyncAnimation = caph.wui.ani.SyncAnimation;
var sync = new SyncAnimation();

Methods

add

Description
Binds the options needed for sync animation with widget. Before binding the options, it will call the parent class "_checkAdd" method to check the validity of the options.
Parameters
■obj
  - Object
  - A widget created by user.      
■argsArr (Optional)
  - Array
  - Each element of the array, is an object. The object includes some basic properties.   
■type
  - Object
  - The options are composed of some basic properties of syncAnimation.
Return■Object
  - The reference of class SyncAnimation, user could continue call this method using the reference.
Emulator SupportY
SDK Constraintnone
Example
var SyncAnimation = caph.wui.ani.SyncAnimation;
var AniLoader = caph.wui.ani.AniLoader;  
var Box  = caph.wui.widget.Box;   
var UIContext = caph.wui.widget.UIContext;

var sync = new SyncAnimation();
var loader = new AniLoader();
var uiContext   = new UIContext();
var widget = new Box();
widget.render(uiContext);

sync.add(widget, 
            [{ type: 'transfer', z:  - 590 }, { type: 'scale', x: 140, y: 6 }],
            { duration: 2000 });

loader.add(sync);
loader.start(uiContext);

getList

Description
Returns animation list.
Parameters
■Void
Return■Array
  - Object array, each object binds caph.wui widgets and animation options together.
Emulator SupportY
SDK Constraintnone
Example
var SyncAnimation = caph.wui.ani.SyncAnimation;
var AniLoader = caph.wui.ani.AniLoader;  
var Box  = caph.wui.widget.Box;   
var UIContext = caph.wui.widget.UIContext;

var sync = new SyncAnimation();
var loader = new AniLoader();
var uiContext   = new UIContext();
var widget = new Box();
widget.render(uiContext);

sync.add(widget, 
            [{ type: 'transfer', z:  - 590 }, { type: 'scale', x: 140, y: 6 }],
            { duration: 2000 });

loader.add(sync);
loader.start(uiContext);
var aniList = sync.getList();

remove

Description
Removes all the arguments that needed for animation on the widget.
Parameters
■obj
  - Object
  - An instance of widget created by user.
Return■Void
Emulator SupportY
SDK Constraintnone
Example
var SyncAnimation = caph.wui.ani.SyncAnimation;
var Box  = caph.wui.widget.Box;
var sync = new SyncAnimation();
var box = new Box();
sync.add(box, [{'type': 'fade', 'opacity': 0.5}], {
  duration: 1000
});
sync.remove(box);

SyncAnimation

Description
(Constructor) Create a SyncAnimation.
Parameters
■obj
  - Object
  - A widget created by user.      
■argsArr (Optional)
  - Array
  - Each element of the array, is an object. The object includes some basic properties.   
■type
  - Object
  - The options are composed of some basic properties of syncAnimation.
Return■Object
  - The reference of class SyncAnimation, user could continue call this method using the reference.
Emulator SupportY
SDK Constraintnone
Example
var SyncAnimation = caph.wui.ani.SyncAnimation;
var sync = new SyncAnimation();

clone

Description
Creates and returns clone object from current object, the cloned object will have the same properties and same methods with the current object.
Parameters
■Void
Return■Object
  - The cloned object.
Emulator SupportY
SDK Constraintnone
Example
var SyncAnimation = window.caph.wui.ani.SyncAnimation;
var sync =new SyncAnimation();
var obj = sync.clone();

equals

Description
Compares the contents of two objects using strict equality, objects are considered equal if they both have the same set of properties and the values of those properties are equal.
Parameters
■Object
  - Object
  - The object which wants to compare with current object.
Return■Boolean
  - Indicates whether the two objects are equal
  - true : if they are equal, return true. 
  - false : if they aren't equal, return false.
Emulator SupportY
SDK Constraintnone
Example
var SyncAnimation = window.caph.wui.ani.SyncAnimation;
var sync =new SyncAnimation();
var obj = sync.clone();
var isequal = obj.equals(sync);