Rekapi ext/canvas/rekapi.canvas.actor.js

CanvasActor

method
Kapi.CanvasActor()
  • @param: {Object=}opt_config
  • @constructor:

Description

Constructor for rendering Actors to a <canvas>. Extends Kapi.Actor. Valid options for opt_config are the same as those for Kapi.Actor, with the following additions:

  • draw (function(CanvasRenderingContext2D, Object)): A function that renders something to a canvas.

Note: context is inherited from the Kapi instance if it is not provided here.

Source

Kapi.CanvasActor = function (opt_config) {
    Kapi.Actor.call(this, opt_config);

    opt_config = opt_config || {};
    this.draw = opt_config.draw || noop;

    return this;
  };
  var CanvasActor = Kapi.CanvasActor;

  function CanvasActorMethods () {}
  CanvasActorMethods.prototype = Kapi.Actor.prototype;
  CanvasActor.prototype = new CanvasActorMethods();

moveToLayer

method
CanvasActor.prototype.moveToLayer()
  • @param: {number}layer
  • @return: {Kapi.Actor,undefined}

Description

Move this Kapi.CanvasActor to a different layer in the Kapi instance that it belongs to. This returns undefined if the operation was unsuccessful. This is just a wrapper for moveActorToLayer.

Source

CanvasActor.prototype.moveToLayer = function (layer) {
    return this.kapi.canvas.moveActorToLayer(this, layer);
  };
});