# other

# Animator

TIP

Frame animation manager.

CODE:

var list = ["front", "left", "after", "right"];
var sprite = ZKSprite(image: "assets/bigboy.png", type: "spritesheet", width: 32, height: 32)
  ..animator.make(list[0], ['0-4'])
  ..animator.make(list[1], ['5-9'])
  ..animator.make(list[2], ['10-14'])
  ..animator.make(list[3], ['15-19'])
  ..onTapDown = (event) {
    sprite.animator.play(list[(index++) % 4], 8, true);
    // sprite.animator.stop(list[(index++) % 4]);
  };

# Properties

Name Type Defaults Description
framesLength int Limit available frames length
isEnabled bool false Whether the current animation manager is available (including available frames)
status String stop Current animation manager status
onComplete Function null Callback function at the end of animation frame execution

# Methods

  • # void play(String name, [int rate, bool loop = false])

    • Play registered animations, including frame rate and loops, etc.
  • # void stop([String name])

    • Stop current (specified) animation.
  • # void make(String name, [List frames, int rate = Constant.RATE, bool loop = false])

    • Register animation, set sequence frame list, frame rate, loop, etc.
  • # void add({String name, List frames, int rate = Constant.RATE, bool loop = false})

    • Another form of registration animation.
  • # void remove(String name, [bool destroy = false])

    • Remove registered animation frames and set whether to destroy frames.
  • # void clear()

    • Clear all frames.

# ZKBus

TIP

A very simple event bus

ZKBus.emit("SHOW");
...

ZKBus.on("SHOW", (){
  ZKTween(this)...
});

ZKBus.off("SHOW");

# Static Methods

  • # emit(Sting eventName, [dynamic args])

    • Send an event with parameters
  • # on(Sting eventName , Function callback)

    • Register to listen for an event.
  • # off(Sting eventName , [Function callback]])

    • Remove an event listener.

# ZKContext

TIP

Operational context, including some public functions and variables.

# Properties

Name Type Defaults Description
size Size null Current zerker app size.
offset Offset null Current zerker app offset.
ratio double 1 Set image resolution
expansion dynamic null An extension field
screenWidth double Screen size
screenHeight double Screen size
appWidth double Current zerker app size
appHeight double Current zerker app size