UNPKG

actuate

Version:

Actuate is a flexible, fast "tween" library for animations

206 lines (188 loc) 4.75 kB
// Class: motion.actuators.GenericActuator var $global = typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this $global.Object.defineProperty(exports, "__esModule", {value: true}); var __map_reserved = {}; // Imports var $hxClasses = require("./../../hxClasses_stub").default; var $import = require("./../../import_stub").default; function motion_actuators_IGenericActuator() {return require("./../../motion/actuators/IGenericActuator");} function Reflect() {return require("./../../Reflect");} function motion_Actuate() {return require("./../../motion/Actuate");} // Constructor var GenericActuator = function(target,duration,properties) { this._autoVisible = true; this._delay = 0; this._reflect = false; this._repeat = 0; this._reverse = false; this._smartRotation = false; this._snapping = false; this.special = false; this.target = target; this.properties = properties; this.duration = duration; this._ease = (motion_Actuate().default).defaultEase; } // Meta GenericActuator.__name__ = ["motion","actuators","GenericActuator"]; GenericActuator.__isInterface__ = false; GenericActuator.__interfaces__ = [(motion_actuators_IGenericActuator().default)]; GenericActuator.prototype = { apply: function() { var _g = 0; var _g1 = (Reflect().default).fields(this.properties); while(_g < _g1.length) { var i = _g1[_g]; ++_g; if((Reflect().default).hasField(this.target,i)) { (Reflect().default).setField(this.target,i,(Reflect().default).field(this.properties,i)); } else { (Reflect().default).setProperty(this.target,i,(Reflect().default).field(this.properties,i)); } } }, autoVisible: function(value) { if(value == null) { value = true; } this._autoVisible = value; return this; }, callMethod: function(method,params) { if(params == null) { params = []; } return (Reflect().default).callMethod(method,method,params); }, change: function() { if(this._onUpdate != null) { this.callMethod(this._onUpdate,this._onUpdateParams); } }, complete: function(sendEvent) { if(sendEvent == null) { sendEvent = true; } if(sendEvent) { this.change(); if(this._onComplete != null) { this.callMethod(this._onComplete,this._onCompleteParams); } } (motion_Actuate().default).unload(this); }, delay: function(duration) { this._delay = duration; return this; }, ease: function(easing) { this._ease = easing; return this; }, move: function() { }, onComplete: function(handler,parameters) { this._onComplete = handler; if(parameters == null) { this._onCompleteParams = []; } else { this._onCompleteParams = parameters; } if(this.duration == 0) { this.complete(); } return this; }, onRepeat: function(handler,parameters) { this._onRepeat = handler; if(parameters == null) { this._onRepeatParams = []; } else { this._onRepeatParams = parameters; } return this; }, onUpdate: function(handler,parameters) { this._onUpdate = handler; if(parameters == null) { this._onUpdateParams = []; } else { this._onUpdateParams = parameters; } return this; }, onPause: function(handler,parameters) { this._onPause = handler; if(parameters == null) { this._onPauseParams = []; } else { this._onPauseParams = parameters; } return this; }, onResume: function(handler,parameters) { this._onResume = handler; if(parameters == null) { this._onResumeParams = []; } else { this._onResumeParams = parameters; } return this; }, pause: function() { if(this._onPause != null) { this.callMethod(this._onPause,this._onPauseParams); } }, reflect: function(value) { if(value == null) { value = true; } this._reflect = value; this.special = true; return this; }, repeat: function(times) { if(times == null) { times = -1; } this._repeat = times; return this; }, resume: function() { if(this._onResume != null) { this.callMethod(this._onResume,this._onResumeParams); } }, reverse: function(value) { if(value == null) { value = true; } this._reverse = value; this.special = true; return this; }, smartRotation: function(value) { if(value == null) { value = true; } this._smartRotation = value; this.special = true; return this; }, snapping: function(value) { if(value == null) { value = true; } this._snapping = value; this.special = true; return this; }, stop: function(properties,complete,sendEvent) { } }; GenericActuator.prototype.__class__ = GenericActuator.prototype.constructor = $hxClasses["motion.actuators.GenericActuator"] = GenericActuator; // Init // Statics // Export exports.default = GenericActuator;