diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 00000000..5b0c8961 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,30 @@ + +## [1.0.1](https://github.com/hiloteam/hilo/compare/v1.0.0...v1.0.1) (2016-05-18) + + +### Bug Fixes + +* Bitmap.setImage need set width&height ([7806046](https://github.com/hiloteam/hilo/commit/7806046)) +* eventMixin.on once bug ([fcaebfd](https://github.com/hiloteam/hilo/commit/fcaebfd)) +* Hilo.getElementRect bug ([d1dda4a](https://github.com/hiloteam/hilo/commit/d1dda4a)) +* Hilo.getElementRect bug ([ead92ae](https://github.com/hiloteam/hilo/commit/ead92ae)) +* set DOMElement pointer-event style to visible when it's pointerEnabled is true ([fa28684](https://github.com/hiloteam/hilo/commit/fa28684)) +* Text.js len & wlen are used before there were defined ([7268ea4](https://github.com/hiloteam/hilo/commit/7268ea4)) + + +### Features + +* change WebGLRenderer.isSupport() to WebGLRenderer.isSupported ([f9f9bc4](https://github.com/hiloteam/hilo/commit/f9f9bc4)) + + + + +# [1.0.0](https://github.com/hiloteam/hilo/compare/4efc6e6...v1.0.0) (2016-03-01) + + +### Bug Fixes + +* WebGLRenderer worldMatrix bug ([4efc6e6](https://github.com/hiloteam/hilo/commit/4efc6e6)) + + + diff --git a/Changelog.md b/Changelog.md deleted file mode 100644 index 0fb365db..00000000 --- a/Changelog.md +++ /dev/null @@ -1,2 +0,0 @@ -Changelog -========= \ No newline at end of file diff --git a/build/amd/hilo-amd.js b/build/amd/hilo-amd.js index 208aa8a4..07b7aa85 100644 --- a/build/amd/hilo-amd.js +++ b/build/amd/hilo-amd.js @@ -1,18 +1,16 @@ /** - * Hilo 1.0.0 for amd + * Hilo 1.0.1 for amd * Copyright 2016 alibaba.com * Licensed under the MIT License */ define('hilo/core/Hilo', function(){ -/** - * Hilo - * Copyright 2015 alibaba.com - * Licensed under the MIT License - */ + + /** - * @namespace Hilo的基础核心方法集合。 + * @language=en + * @namespace Hilo The underlying core set of methods. * @static * @module hilo/core/Hilo */ @@ -23,9 +21,10 @@ var win = window, doc = document, docElem = doc.documentElement, return { /** - * 获取一个全局唯一的id。如Stage1,Bitmap2等。 - * @param {String} prefix 生成id的前缀。 - * @returns {String} 全局唯一id。 + * @language=en + * Gets a globally unique id. Such as Stage1, Bitmap2 etc. + * @param {String} prefix Generated id's prefix. + * @returns {String} Globally unique id. */ getUid: function(prefix){ var id = ++uid; @@ -38,9 +37,10 @@ return { }, /** - * 为指定的可视对象生成一个包含路径的字符串表示形式。如Stage1.Container2.Bitmap3。 - * @param {View} view 指定的可视对象。 - * @returns {String} 可视对象的字符串表示形式。 + * @language=en + * Generates a string representation that contains a path to the specified visual object. Such as Stage1.Container2.Bitmap3. + * @param {View} view Specified visual object. + * @returns {String} String representation of the visual object. */ viewToString: function(view){ var result, obj = view; @@ -52,11 +52,12 @@ return { }, /** - * 简单的浅复制对象。 - * @param {Object} target 要复制的目标对象。 - * @param {Object} source 要复制的源对象。 - * @param {Boolean} strict 指示是否复制未定义的属性,默认为false,即不复制未定义的属性。 - * @returns {Object} 复制后的对象。 + * @language=en + * Simple shallow copy objects. + * @param {Object} target Target object to copy to. + * @param {Object} source Source object to copy. + * @param {Boolean} strict Indicates whether replication is undefined property, default is false, i.e., undefined attributes are not copied. + * @returns {Object} Object after copying. */ copy: function(target, source, strict){ for(var key in source){ @@ -68,15 +69,16 @@ return { }, /** - * 浏览器特性集合。包括: + * @language=en + * Browser feature set includes: *
* var Bird = Hilo.Class.create({ * Extends: Animal, @@ -392,23 +401,24 @@ define('hilo/core/Class', function(){ * swallow.fly(); * Bird.isBird(swallow); *- * @namespace Class是提供类的创建的辅助工具。 + * @namespace Class Class is created to aid the developer. * @static * @module hilo/core/Class */ var Class = (function(){ /** - * 根据参数指定的属性和方法创建类。 - * @param {Object} properties 要创建的类的相关属性和方法。主要有: + * @language=en + * Create a class based on the parameters, properties and methods specified. + * @param {Object} properties Properties and methods to create the class. *
* var stage = new Hilo.Stage({ * renderType:'canvas', @@ -2815,16 +2863,16 @@ define('hilo/view/Stage', ['hilo/core/Hilo', 'hilo/core/Class', 'hilo/view/Conta * height: 480 * }); *- * @class 舞台是可视对象树的根,可视对象只有添加到舞台或其子对象后才会被渲染出来。创建一个hilo应用一般都是从创建一个stage开始的。 + * @class Stage is the root of all visual object tree, any visual object will be render only after being added to Stage or any children elements of Stage. Normally, every hilo application start with an stage instance. * @augments Container - * @param {Object} properties 创建对象的属性参数。可包含此类所有可写属性。主要有: + * @param {Object} properties Properties parameters for the object. Includes all writable properties of this class. Some important like: *
* var bmp = new Hilo.Bitmap({image:imgElem, rect:[0, 0, 100, 100]}); * stage.addChild(bmp); *- * @class Bitmap类表示位图图像类。 + * @class Bitmap * @augments View - * @param {Object} properties 创建对象的属性参数。可包含此类所有可写属性。此外还包括: + * @param {Object} properties the options of create Instance.It can contains all writable property and Moreover: *
* var domView = new Hilo.DOMElement({ * element: Hilo.createElement('div', { @@ -3416,11 +3484,11 @@ define('hilo/view/DOMElement', ['hilo/core/Hilo', 'hilo/core/Class', 'hilo/view/ * }).addTo(stage); ** @name DOMElement - * @class DOMElement是dom元素的包装。 + * @class DOMElement is a wrapper of dom element. * @augments View - * @param {Object} properties 创建对象的属性参数。可包含此类所有可写属性。特殊属性有: + * @param {Object} properties create Objects properties. Contains all writable properties in this class. Special properties include: *
var path = 'M250 150 L150 350 L350 350 Z';
*var shape = new Hilo.Graphics({width:500, height:500});
*shape.drawSVGPath(path).beginFill('#0ff').endFill();
- * @param {String} pathData 要绘制的SVG路径数据。 - * @returns {Graphics} Graphics对象本身。 + * @param {String} pathData The SVG path data to draw. + * @returns {Graphics} The Graphics Object. */ drawSVGPath: function(pathData){ var me = this, addAction = me._addAction, @@ -3834,7 +3923,8 @@ return Class.create(/** @lends Graphics.prototype */{ }, /** - * 执行全部绘制动作。内部私有方法。 + * @language=en + * Apply all draw actions. private function. * @private */ _draw: function(context){ @@ -3852,7 +3942,8 @@ return Class.create(/** @lends Graphics.prototype */{ }, /** - * 重写渲染实现。 + * @language=en + * Overwrite render function. * @private */ render: function(renderer, delta){ @@ -3866,8 +3957,9 @@ return Class.create(/** @lends Graphics.prototype */{ }, /** - * 清除所有绘制动作并复原所有初始状态。 - * @returns {Graphics} Graphics对象本身。 + * @language=en + * Clear all draw actions and reset to the initial state. + * @returns {Graphics} The Graphics Object. */ clear: function(){ var me = this; @@ -3889,7 +3981,8 @@ return Class.create(/** @lends Graphics.prototype */{ }, /** - * 添加一个绘制动作。内部私有方法。 + * @language=en + * Add a draw action, this is a private function. * @private */ _addAction: function(action){ @@ -3902,43 +3995,41 @@ return Class.create(/** @lends Graphics.prototype */{ })(); + return Graphics; }); /** - * Hilo 1.0.0 for amd + * Hilo 1.0.1 for amd * Copyright 2016 alibaba.com * Licensed under the MIT License */ define('hilo/view/Text', ['hilo/core/Class', 'hilo/core/Hilo', 'hilo/view/View', 'hilo/view/CacheMixin'], function(Class, Hilo, View, CacheMixin){ -/** - * Hilo - * Copyright 2015 alibaba.com - * Licensed under the MIT License - */ + /** + * @language=en * ** var btn = new Hilo.Button({ * image: buttonImage, @@ -4352,24 +4448,24 @@ define('hilo/view/Button', ['hilo/core/Hilo', 'hilo/core/Class', 'hilo/view/View * disabledState: {rect:[192, 0, 64, 64]} * }); *- * @class Button类表示简单按钮类。它有弹起、经过、按下和不可用等四种状态。 + * @class Button class is a simple button class, contains four kinds of state: 'up', 'over', 'down', 'disabled' * @augments View - * @param {Object} properties 创建对象的属性参数。可包含此类所有可写属性。此外还包括: + * @param {Object} properties create object properties. Contains all writable properties. Also contains: *
* var bmp = new Bitmap({image:img}); * Hilo.copy(bmp, Hilo.drag); * bmp.startDrag([0, 0, 550, 400]); *- * @class drag是一个包含拖拽功能的mixin。可以通过 Class.mix(view, drag)或Hilo.copy(view, drag)来为view增加拖拽功能。 + * @class drag A mixin that contains drag method.You can mix drag method to the visual target by use Class.mix(target, drag) or Hilo.copy(target, drag). * @mixin * @static * @module hilo/util/drag @@ -4960,8 +5062,9 @@ define('hilo/util/drag', ['hilo/core/Class', 'hilo/core/Hilo'], function(Class, */ var drag = { /** - * 开始拖拽 - * @param {Array} bounds 拖拽范围,基于父容器坐标系,[x, y, width, height], 默认无限制 + * @language=en + * start drag. + * @param {Array} bounds The bounds area that the view can move, relative to the coordinates of the view's parent, [x, y, width, height], default is no limit. */ startDrag:function(bounds){ var that = this; @@ -5032,7 +5135,8 @@ var drag = { that.stopDrag = stopDrag; }, /** - * 停止拖拽 + * @language=en + * stop drag. */ stopDrag:function(){ @@ -5043,24 +5147,21 @@ return drag; }); /** - * Hilo 1.0.0 for amd + * Hilo 1.0.1 for amd * Copyright 2016 alibaba.com * Licensed under the MIT License */ define('hilo/tween/Tween', ['hilo/core/Class'], function(Class){ -/** - * Hilo - * Copyright 2015 alibaba.com - * Licensed under the MIT License - */ + /** + * @language=en * *
- * ticker.addTick(Hilo.Tween);//需要把Tween加到ticker里才能使用 + * ticker.addTick(Hilo.Tween);//Tween works after being added to ticker * * var view = new View({x:5, y:10}); * Hilo.Tween.to(view, { @@ -5076,26 +5177,26 @@ define('hilo/tween/Tween', ['hilo/core/Class'], function(Class){ * } * }); *- * @class Tween类提供缓动功能。 - * @param {Object} target 缓动对象。 - * @param {Object} fromProps 对象缓动的起始属性集合。 - * @param {Object} toProps 对象缓动的目标属性集合。 - * @param {Object} params 缓动参数。可包含Tween类所有可写属性。 + * @class Tween class makes tweening (easing, slow motion). + * @param {Object} target Tween target object. + * @param {Object} fromProps Beginning properties of target tweening object. + * @param {Object} toProps Ending properties of target tweening object. + * @param {Object} params Tweening parameters, include all writable Tween class properties. * @module hilo/tween/Tween * @requires hilo/core/Class - * @property {Object} target 缓动目标。只读属性。 - * @property {Int} duration 缓动总时长。单位毫秒。 - * @property {Int} delay 缓动延迟时间。单位毫秒。 - * @property {Boolean} paused 缓动是否暂停。默认为false。 - * @property {Boolean} loop 缓动是否循环。默认为false。 - * @property {Boolean} reverse 缓动是否反转播放。默认为false。 - * @property {Int} repeat 缓动重复的次数。默认为0。 - * @property {Int} repeatDelay 缓动重复的延迟时长。单位为毫秒。 - * @property {Function} ease 缓动变化函数。默认为null。 - * @property {Int} time 缓动已进行的时长。单位毫秒。只读属性。 - * @property {Function} onStart 缓动开始回调函数。它接受1个参数:tween。默认值为null。 - * @property {Function} onUpdate 缓动更新回调函数。它接受2个参数:ratio和tween。默认值为null。 - * @property {Function} onComplete 缓动结束回调函数。它接受1个参数:tween。默认值为null。 + * @property {Object} target Tween target object, readonly! + * @property {Int} duration Tweening duration, measure in ms. + * @property {Int} delay Tweenning delay time, measure in ms. + * @property {Boolean} paused Is tweening paused, default value is false. + * @property {Boolean} loop Does tweening loop, default value is false. + * @property {Boolean} reverse Does tweening reverse, default value is false. + * @property {Int} repeat Repeat times of tweening, default value is 0. + * @property {Int} repeatDelay Delay time of repeating tweening, measure in ms. + * @property {Function} ease Tweening transform function, default value is null. + * @property {Int} time Time that tweening taken, measure in ms, readonly! + * @property {Function} onStart Function invoked on the beginning of tweening. Require 1 parameter: tween. default value is null. + * @property {Function} onUpdate Function invoked on tweening update. Require 2 parameters: ratio, tween. default value is null. + * @property {Function} onComplete Function invoked on the end of tweening. Require 1 parameter: tween. default value is null. */ var Tween = (function(){ @@ -5148,10 +5249,11 @@ return Class.create(/** @lends Tween.prototype */{ onComplete: null, /** - * 设置缓动对象的初始和目标属性。 - * @param {Object} fromProps 缓动对象的初始属性。 - * @param {Object} toProps 缓动对象的目标属性。 - * @returns {Tween} Tween变换本身。可用于链式调用。 + * @language=en + * Set beginning properties and ending properties of tweening object. + * @param {Object} fromProps Beginning properties of target tweening object. + * @param {Object} toProps Ending properties of target tweening object. + * @returns {Tween} Current Tween, for chain calls. */ setProps: function(fromProps, toProps){ var me = this, target = me.target, @@ -5169,8 +5271,9 @@ return Class.create(/** @lends Tween.prototype */{ }, /** - * 启动缓动动画的播放。 - * @returns {Tween} Tween变换本身。可用于链式调用。 + * @language=en + * Starting the tweening. + * @returns {Tween} Current Tween, for chain calls. */ start: function(){ var me = this; @@ -5183,8 +5286,9 @@ return Class.create(/** @lends Tween.prototype */{ }, /** - * 停止缓动动画的播放。 - * @returns {Tween} Tween变换本身。可用于链式调用。 + * @language=en + * Stop the tweening. + * @returns {Tween} Current Tween, for chain calls. */ stop: function(){ Tween.remove(this); @@ -5192,8 +5296,9 @@ return Class.create(/** @lends Tween.prototype */{ }, /** - * 暂停缓动动画的播放。 - * @returns {Tween} Tween变换本身。可用于链式调用。 + * @language=en + * Pause the tweening. + * @returns {Tween} Current Tween, for chain calls. */ pause: function(){ var me = this; @@ -5203,8 +5308,9 @@ return Class.create(/** @lends Tween.prototype */{ }, /** - * 恢复缓动动画的播放。 - * @returns {Tween} Tween变换本身。可用于链式调用。 + * @language=en + * Continue to play the tweening. + * @returns {Tween} Current Tween, for chain calls. */ resume: function(){ var me = this; @@ -5215,10 +5321,11 @@ return Class.create(/** @lends Tween.prototype */{ }, /** - * 跳转Tween到指定的时间。 - * @param {Number} time 指定要跳转的时间。取值范围为:0 - duraion。 - * @param {Boolean} pause 是否暂停。 - * @returns {Tween} Tween变换本身。可用于链式调用。 + * @language=en + * Tween jumps to some point. + * @param {Number} time The time to jump to, range from 0 to duration. + * @param {Boolean} pause Is paused. + * @returns {Tween} Current Tween, for chain calls. */ seek: function(time, pause){ var me = this, current = now(); @@ -5232,9 +5339,10 @@ return Class.create(/** @lends Tween.prototype */{ }, /** - * 连接下一个Tween变换。其开始时间根据delay值不同而不同。当delay值为字符串且以'+'或'-'开始时,Tween的开始时间从当前变换结束点计算,否则以当前变换起始点计算。 - * @param {Tween} tween 要连接的Tween变换。 - * @returns {Tween} Tween变换本身。可用于链式调用。 + * @language=en + * Link next Tween. The beginning time of next Tween depends on the delay value. If delay is a string that begins with '+' or '-', next Tween will begin at (delay) ms after or before the current tween is ended. If delay is out of previous situation, next Tween will begin at (delay) ms after the beginning point of current Tween. + * @param {Tween} tween Tween to link. + * @returns {Tween} Current Tween, for chain calls. */ link: function(tween){ var me = this, delay = tween.delay, startTime = me._startTime; @@ -5252,7 +5360,8 @@ return Class.create(/** @lends Tween.prototype */{ }, /** - * Tween类的内部渲染方法。 + * @language=en + * Private render method inside Tween class. * @private */ _render: function(ratio){ @@ -5261,7 +5370,8 @@ return Class.create(/** @lends Tween.prototype */{ }, /** - * Tween类的内部更新方法。 + * @language=en + * Private update method inside Tween class. * @private */ _update: function(time, forceUpdate){ @@ -5338,12 +5448,14 @@ return Class.create(/** @lends Tween.prototype */{ Statics: /** @lends Tween */ { /** + * @language=en * @private */ _tweens: [], /** - * 更新所有Tween实例。 + * @language=en + * Update all Tween instances. * @returns {Object} Tween。 */ tick: function(){ @@ -5360,8 +5472,9 @@ return Class.create(/** @lends Tween.prototype */{ }, /** - * 添加Tween实例。 - * @param {Tween} tween 要添加的Tween对象。 + * @language=en + * Add a Tween instance. + * @param {Tween} tween Tween object to add. * @returns {Object} Tween。 */ add: function(tween){ @@ -5371,8 +5484,9 @@ return Class.create(/** @lends Tween.prototype */{ }, /** - * 删除Tween实例。 - * @param {Tween|Object|Array} tweenOrTarget 要删除的Tween对象或target对象或要删除的一组对象。 + * @language=en + * Remove one Tween target. + * @param {Tween|Object|Array} tweenOrTarget Tween object, target object or an array of object to remove * @returns {Object} Tween。 */ remove: function(tweenOrTarget){ @@ -5400,7 +5514,8 @@ return Class.create(/** @lends Tween.prototype */{ }, /** - * 删除所有Tween实例。 + * @language=en + * Remove all Tween instances. * @returns {Object} Tween。 */ removeAll: function(){ @@ -5409,12 +5524,13 @@ return Class.create(/** @lends Tween.prototype */{ }, /** - * 创建一个缓动动画,让目标对象从开始属性变换到目标属性。 - * @param {Object|Array} target 缓动目标对象或缓动目标数组。 - * @param fromProps 缓动目标对象的开始属性。 - * @param toProps 缓动目标对象的目标属性。 - * @param params 缓动动画的参数。 - * @returns {Tween|Array} 一个Tween实例对象或Tween实例数组。 + * @language=en + * Create a tween, make target object easing from beginning properties to ending properties. + * @param {Object|Array} target Tweening target or tweening target array. + * @param fromProps Beginning properties of target tweening object. + * @param toProps Ending properties of target tweening object. + * @param params Tweening parameters. + * @returns {Tween|Array} An tween instance or an array of tween instance. */ fromTo: function(target, fromProps, toProps, params){ var isArray = target instanceof Array; @@ -5432,22 +5548,24 @@ return Class.create(/** @lends Tween.prototype */{ }, /** - * 创建一个缓动动画,让目标对象从当前属性变换到目标属性。 - * @param {Object|Array} target 缓动目标对象或缓动目标数组。 - * @param toProps 缓动目标对象的目标属性。 - * @param params 缓动动画的参数。 - * @returns {Tween|Array} 一个Tween实例对象或Tween实例数组。 + * @language=en + * Create a tween, make target object easing from current properties to ending properties. + * @param {Object|Array} target Tweening target or tweening target array. + * @param toProps Ending properties of target tweening object. + * @param params Tweening parameters. + * @returns {Tween|Array} An tween instance or an array of tween instance. */ to: function(target, toProps, params){ return Tween.fromTo(target, null, toProps, params); }, /** - * 创建一个缓动动画,让目标对象从指定的起始属性变换到当前属性。 - * @param {Object|Array} target 缓动目标对象或缓动目标数组。 - * @param fromProps 缓动目标对象的目标属性。 - * @param params 缓动动画的参数。 - * @returns {Tween|Array} 一个Tween实例对象或Tween实例数组。 + * @language=en + * Create a tween, make target object easing from beginning properties to current properties. + * @param {Object|Array} target Tweening target or tweening target array. + * @param fromProps Beginning properties of target tweening object. + * @param params Tweening parameters. + * @returns {Tween|Array} An tween instance or an array of tween instance. */ from: function(target, fromProps, params){ return Tween.fromTo(target, fromProps, null, params); @@ -5458,24 +5576,22 @@ return Class.create(/** @lends Tween.prototype */{ })(); + return Tween; }); /** - * Hilo 1.0.0 for amd + * Hilo 1.0.1 for amd * Copyright 2016 alibaba.com * Licensed under the MIT License */ define('hilo/tween/Ease', function(){ -/** - * Hilo - * Copyright 2015 alibaba.com - * Licensed under the MIT License - */ + /** - * @class Ease类包含为Tween类提供各种缓动功能的函数。 + * @language=en + * @class Ease class provides multiple easing functions for Tween. * @module hilo/tween/Ease * @static */ @@ -5491,14 +5607,16 @@ function createEase(obj, easeInFn, easeOutFn, easeInOutFn, easeNoneFn){ } /** - * 线性匀速缓动函数。包含EaseNone函数。 + * @language=en + * Linear easing function.Include EaseNone. */ var Linear = createEase(null, null, null, null, function(k){ return k; }); /** - * 二次缓动函数。包含EaseIn、EaseOut、EaseInOut三个函数。 + * @language=en + * Quad easing function.Include EaseIn, EaseOut, EaseInOut. */ var Quad = createEase(null, function(k){ @@ -5515,7 +5633,8 @@ var Quad = createEase(null, ); /** - * 三次缓动函数。包含EaseIn、EaseOut、EaseInOut三个函数。 + * @language=en + * Cubic easing function.Include EaseIn, EaseOut, EaseInOut. */ var Cubic = createEase(null, function(k){ @@ -5532,7 +5651,8 @@ var Cubic = createEase(null, ); /** - * 四次缓动函数。包含EaseIn、EaseOut、EaseInOut三个函数。 + * @language=en + * Quart easing function.Include EaseIn, EaseOut, EaseInOut. */ var Quart = createEase(null, function(k){ @@ -5549,7 +5669,8 @@ var Quart = createEase(null, ); /** - * 五次缓动函数。包含EaseIn、EaseOut、EaseInOut三个函数。 + * @language=en + * Quint easing function.Include EaseIn, EaseOut, EaseInOut. */ var Quint = createEase(null, function(k){ @@ -5571,7 +5692,8 @@ var math = Math, pow = math.pow, sqrt = math.sqrt; /** - * 正弦缓动函数。包含EaseIn、EaseOut、EaseInOut三个函数。 + * @language=en + * Sine easing function.Include EaseIn, EaseOut, EaseInOut. */ var Sine = createEase(null, function(k){ @@ -5588,7 +5710,8 @@ var Sine = createEase(null, ); /** - * 指数缓动函数。包含EaseIn、EaseOut、EaseInOut三个函数。 + * @language=en + * Expo easing function.Include EaseIn, EaseOut, EaseInOut. */ var Expo = createEase(null, function(k){ @@ -5607,7 +5730,8 @@ var Expo = createEase(null, ); /** - * 圆形缓动函数。包含EaseIn、EaseOut、EaseInOut三个函数。 + * @language=en + * Circ easing function.Include EaseIn, EaseOut, EaseInOut. */ var Circ = createEase(null, function(k){ @@ -5625,7 +5749,8 @@ var Circ = createEase(null, ); /** - * 弹性缓动函数。包含EaseIn、EaseOut、EaseInOut三个函数。 + * @language=en + * Elastic easing function.Include EaseIn, EaseOut, EaseInOut. */ var Elastic = createEase( { @@ -5655,7 +5780,8 @@ var Elastic = createEase( ); /** - * 向后缓动函数。包含EaseIn、EaseOut、EaseInOut三个函数。 + * @language=en + * Back easing function.Include EaseIn, EaseOut, EaseInOut. */ var Back = createEase( { @@ -5682,7 +5808,8 @@ var Back = createEase( ); /** - * 弹跳缓动函数。包含EaseIn、EaseOut、EaseInOut三个函数。 + * @language=en + * Bounce easing function.Include EaseIn, EaseOut, EaseInOut. */ var Bounce = createEase(null, function(k){ @@ -5726,21 +5853,18 @@ return Ease; }); /** - * Hilo 1.0.0 for amd + * Hilo 1.0.1 for amd * Copyright 2016 alibaba.com * Licensed under the MIT License */ define('hilo/loader/ImageLoader', ['hilo/core/Class'], function(Class){ -/** - * Hilo - * Copyright 2015 alibaba.com - * Licensed under the MIT License - */ + /** + * @language=en * @private - * @class 图片资源加载器。 + * @class image resources loader. * @module hilo/loader/ImageLoader * @requires hilo/core/Class */ @@ -5780,21 +5904,18 @@ return ImageLoader; }); /** - * Hilo 1.0.0 for amd + * Hilo 1.0.1 for amd * Copyright 2016 alibaba.com * Licensed under the MIT License */ define('hilo/loader/ScriptLoader', ['hilo/core/Class'], function(Class){ -/** - * Hilo - * Copyright 2015 alibaba.com - * Licensed under the MIT License - */ + /** + * @language=en * @private - * @class javascript或JSONP加载器。 + * @class javascript or JSONP loader * @module hilo/loader/ScriptLoader * @requires hilo/core/Class */ @@ -5849,29 +5970,26 @@ return ScriptLoader; }); /** - * Hilo 1.0.0 for amd + * Hilo 1.0.1 for amd * Copyright 2016 alibaba.com * Licensed under the MIT License */ define('hilo/loader/LoadQueue', ['hilo/core/Class', 'hilo/event/EventMixin', 'hilo/loader/ImageLoader', 'hilo/loader/ScriptLoader'], function(Class, EventMixin, ImageLoader, ScriptLoader){ -/** - * Hilo - * Copyright 2015 alibaba.com - * Licensed under the MIT License - */ + //TODO: 超时timeout,失败重连次数maxTries,更多的下载器Loader,队列暂停恢复等。 /** - * @class LoadQueue是一个队列下载工具。 - * @param {Object} source 要下载的资源。可以是单个资源对象或多个资源的数组。 + * @language=en + * @class LoadQueue is a queue-like loader. + * @param {Object} source ,resource that need to be loaded,could be a single object or array resource. * @module hilo/loader/LoadQueue * @requires hilo/core/Class * @requires hilo/event/EventMixin * @requires hilo/loader/ImageLoader * @requires hilo/loader/ScriptLoader - * @property {Int} maxConnections 同时下载的最大连接数。默认为2。 + * @property {Int} maxConnections ,the limited concurrent connections. default value 2. */ var LoadQueue = Class.create(/** @lends LoadQueue.prototype */{ Mixes: EventMixin, @@ -5888,15 +6006,16 @@ var LoadQueue = Class.create(/** @lends LoadQueue.prototype */{ _currentIndex: -1, /** - * 增加要下载的资源。可以是单个资源对象或多个资源的数组。 - * @param {Object|Array} source 资源对象或资源对象数组。每个资源对象包含以下属性: + * @language=en + * Add desired resource,could be a single object or array resource. + * @param {Object|Array} source ,a single object or array resource. Each resource contains properties like below: *
* var audio = WebSound.getAudio({ * src: 'test.mp3', @@ -6586,7 +6733,7 @@ define('hilo/media/WebSound', ['hilo/core/Hilo', 'hilo/media/HTMLAudio', 'hilo/m * console.log('end'); * }).play(); *- * @class 声音播放管理器。 + * @class Audio playing manager. * @static * @module hilo/media/WebSound * @requires hilo/core/Hilo @@ -6597,7 +6744,8 @@ var WebSound = { _audios: {}, /** - * 激活音频功能。注意:需用户事件触发此方法才有效。目前仅对WebAudio有效。 + * @language=en + * Activate audio function. Note: Require user action events to activate. Currently support WebAudio. */ enableAudio: function(){ if(WebAudio.isSupported){ @@ -6606,9 +6754,10 @@ var WebSound = { }, /** - * 获取音频对象。优先使用WebAudio。 - * @param {String|Object} source 若source为String,则为音频src地址;若为Object,则需包含src属性。 - * @returns {WebAudio|HTMLAudio} 音频播放对象实例。 + * @language=en + * Get audio element. Use WebAudio if supported. + * @param {String|Object} source If String, it's the source of the audio; If Object, it should contains a src property. + * @returns {WebAudio|HTMLAudio} Audio playing instance. */ getAudio: function(source){ source = this._normalizeSource(source); @@ -6626,8 +6775,9 @@ var WebSound = { }, /** - * 删除音频对象。 - * @param {String|Object} source 若source为String,则为音频src地址;若为Object,则需包含src属性。 + * @language=en + * Remove audio element. + * @param {String|Object} source If String, it's the source of the audio; If Object, it should contains a src property. */ removeAudio: function(source){ var src = typeof source === 'string' ? source : source.src; @@ -6641,6 +6791,7 @@ var WebSound = { }, /** + * @language=en * @private */ _normalizeSource: function(source){ @@ -6656,30 +6807,27 @@ return WebSound; }); /** - * Hilo 1.0.0 for amd + * Hilo 1.0.1 for amd * Copyright 2016 alibaba.com * Licensed under the MIT License */ define('hilo/game/Camera', ['hilo/core/Hilo', 'hilo/core/Class'], function(Hilo, Class){ -/** - * Hilo - * Copyright 2015 alibaba.com - * Licensed under the MIT License - */ + /** - * @class Camera类表示摄像机。 - * @param {Object} properties 创建对象的属性参数。可包含此类所有可写属性。 + * @language=en + * @class Camera. + * @param {Object} properties The properties to create a view object, contains all writeable props of this class * @module hilo/game/Camera * @requires hilo/core/Hilo * @requires hilo/core/Class - * @property {Number} width 镜头宽 - * @property {Number} height 镜头高 - * @property {Object} scroll 滚动值 {x:0, y:0} - * @property {View} target 摄像机跟随的目标 - * @property {Array} bounds 摄像机移动边界的矩形区域 [x, y, width, height] - * @property {Array} deadzone 摄像机不移动的矩形区域 [ x, y, width, height] + * @property {Number} width The width of the camera. + * @property {Number} height The height of the camera. + * @property {Object} scroll The scrolling value of the camera {x:0, y:0}. + * @property {View} target The target that the camera follow. + * @property {Array} bounds The rect area where camera is allowed to move [x, y, width, height]. + * @property {Array} deadzone The rect area where camera isn't allowed to move[ x, y, width, height]. */ var Camera = Class.create(/** @lends Camera.prototype */{ constructor:function(properties){ @@ -6698,7 +6846,8 @@ var Camera = Class.create(/** @lends Camera.prototype */{ Hilo.copy(this, properties); }, /** - * 更新 + * @language=en + * update. * @param {Number} deltaTime */ tick:function(deltaTime){ @@ -6732,9 +6881,10 @@ var Camera = Class.create(/** @lends Camera.prototype */{ } }, /** - * 跟随目标 - * @param {Object} target 跟随的目标,必须是有x,y属性的对象 - * @param {Array} deadzone 摄像机不移动的矩形区域 [ x, y, width, height] + * @language=en + * Follow the target. + * @param {Object} target The target that the camera follow. It must has x and y properties. + * @param {Array} deadzone The rect area where camera isn't allowed to move[ x, y, width, height]. */ follow:function(target, deadzone){ this.target = target; @@ -6750,54 +6900,51 @@ return Camera; }); /** - * Hilo 1.0.0 for amd + * Hilo 1.0.1 for amd * Copyright 2016 alibaba.com * Licensed under the MIT License */ define('hilo/game/Camera3d', ['hilo/core/Hilo', 'hilo/core/Class'], function(Hilo, Class){ -/** - * Hilo - * Copyright 2015 alibaba.com - * Licensed under the MIT License - */ + /** - * @class Camera3d 伪3D虚拟摄像机。 + * @language=en + * @class Camera3d is a pseudo-3d camera. * @module hilo/game/Camera3d * @requires hilo/core/Hilo * @requires hilo/core/Class - * @property {Number} fv 镜头视点距离(屏幕视点相对眼睛距离,绝对了坐标缩放比例) - * @property {Number} fx 镜头视点X(屏幕视点相对屏幕左上角X距离) - * @property {Number} fy 镜头视点Y(屏幕视点相对屏幕左上角Y距离) - * @property {Object} stage 3D对象所在容器,可以是stage或container,结合ticker时是必须参数,用来Z深度排序 - * @property {Number} x 镜头三维坐标x - * @property {Number} y 镜头三维坐标y - * @property {Number} z 镜头三维坐标z - * @property {Number} rotationX X轴旋转角度 - * @property {Number} rotationY Y轴旋转角度 - * @property {Number} rotationZ Z轴旋转角度 + * @property {Number} fv The distance of the fov(The distance between eyes and the Z plane,it determines the scale ratio of the 3d object). + * @property {Number} fx The x position of the screen viewpoint(The distance between the screen viewpoint and the screen left top corner on the x axis). + * @property {Number} fy The y position of the screen viewpoint(The distance between the screen viewpoint and the screen left top corner on the y axis). + * @property {Object} stage The 3d object's container, it can be stage or container.It is required if you need to sort the 3d object by z axis. + * @property {Number} x The x position. + * @property {Number} y The y position. + * @property {Number} z The z position. + * @property {Number} rotationX The x rotation. + * @property {Number} rotationY The y rotation. + * @property {Number} rotationZ The z rotation. */ var Camera3d = (function(){ var degtorad = Math.PI / 180; - //向量旋转 - function rotateX(x, y, z, ca, sa) {//绕X轴旋转 + //Rotate the axis. + function rotateX(x, y, z, ca, sa) {//rotate x return { x: x, y: y * ca - z * sa, z: y * sa + z * ca }; } - function rotateY(x, y, z, ca, sa) {//绕Y轴旋转 + function rotateY(x, y, z, ca, sa) {//rotate y return { x: x * ca - z * sa, y: y, z: x * sa + z * ca }; } - function rotateZ(x, y, z, ca, sa) {//绕Z轴旋转 + function rotateZ(x, y, z, ca, sa) {//rotate z return { x: x * ca - y * sa, y: x * sa + y * ca, @@ -6819,10 +6966,11 @@ var Camera3d = (function(){ }, /** - * 仿射矩阵位移变换,不同于直接修改Camera3d.x/y/z. 是在Camera3d依次做坐标位移 - 旋转变换 后,再加上一个位移变换。主要功能可以做Zoomin/out 功能 - * @param {Number} x坐标 - * @param {Number} y坐标 - * @param {Number} z坐标 + * @language=en + * Translate the camera,used for Zoomin/out feature. + * @param {Number} x The x position. + * @param {Number} y The y position. + * @param {Number} z The z position. */ translate : function(x,y,z){ this.tx = x; @@ -6831,33 +6979,38 @@ var Camera3d = (function(){ }, /** - * 旋转X轴方向角度,相当于欧拉角系统的 beta - * @param {Number} X旋转角度 + * @language=en + * Rotate by the x axis. + * @param {Number} angle The rotate degree. */ rotateX : function(angle){ this.rotationX = angle; }, /** - * 旋转Y轴方向角度,相当于欧拉角系统的 gamma - * @param {Number} Y旋转角度 + * @language=en + * Rotate by the y axis. + * @param {Number} angle The rotate degree. */ rotateY : function(angle){ this.rotationY = angle; }, /** - * 旋转Z轴方向角度,相当于欧拉角系统的 alpha - * @param {Number} Z旋转角度 + * @language=en + * Rotate by the z axis. + * @param {Number} angle The rotate degree. */ rotateZ : function(angle){ this.rotationZ = angle; }, /** - * 将三维坐标转换投影为二维坐标,同时返回Z轴深度,和投影显示的缩放比例 - * @param {object} 三维坐标对象 - * @param {object} Hilo.View对象,用于自动转换坐标 + * @language=en + * Project the 3d point to 2d point. + * @param {object} vector3D The 3d position, it must have x, y and z properties. + * @param {View} view The view related to the 3d position.It'll be auto translated by the 3d position. + * @returns {Object} The 2d object include z and scale properties, e.g.:{x:x, y:y, z:z, scale} */ project : function(vector3D, view){ @@ -6872,10 +7025,10 @@ var Camera3d = (function(){ // 旋转变换前的 仿射矩阵位移, dx = vector3D.x - this.x, dy = vector3D.y - this.y, - dz = vector3D.z - this.z, + dz = vector3D.z - this.z; // 旋转矩阵变换 - vector = rotateZ(dx, dy, dz, cosZ, sinZ); + var vector = rotateZ(dx, dy, dz, cosZ, sinZ); vector = rotateY(vector.x, vector.y, vector.z, cosY, sinY); vector = rotateX(vector.x, vector.y, vector.z, cosX, sinX); @@ -6888,24 +7041,27 @@ var Camera3d = (function(){ _x = vector.x * perspective, _y = -vector.y * perspective; - if(view) { - view.x = _x + this.fx; - view.y = _y + this.fy; - view.z = -vector.z; - view.scaleX = perspective; - view.scaleY = perspective; - } else { - return { - x : _x + this.fx, - y : _y + this.fy, - z : -vector.z, - scale : perspective - }; + var result = { + x : _x + this.fx, + y : _y + this.fy, + z : -vector.z, + scale : perspective + }; + + if(view){ + view.x = result.x; + view.y = result.y; + view.z = result.z; + view.scaleX = result.scale; + view.scaleY = result.scale; } + + return result; }, /** - * Z深度排序 + * @language=en + * Sort by z axis. */ sortZ : function(){ this.stage.children.sort(function(view_a, view_b){ @@ -6914,7 +7070,8 @@ var Camera3d = (function(){ }, /** - * Ticker 轮询使用 + * @language=en + * Used for the ticker. */ tick : function(){ this.sortZ(); @@ -6930,22 +7087,19 @@ return Camera3d; }); /** - * Hilo 1.0.0 for amd + * Hilo 1.0.1 for amd * Copyright 2016 alibaba.com * Licensed under the MIT License */ define('hilo/game/ParticleSystem', ['hilo/core/Hilo', 'hilo/core/Class', 'hilo/view/View', 'hilo/view/Container', 'hilo/view/Bitmap', 'hilo/view/Drawable'], function(Hilo, Class, View, Container, Bitmap, Drawable){ -/** - * Hilo - * Copyright 2015 alibaba.com - * Licensed under the MIT License - */ + /** + * @language=en * *
* var Bird = Hilo.Class.create({ * Extends: Animal, @@ -34,23 +31,24 @@ define('hilo/core/Class', function(){ * swallow.fly(); * Bird.isBird(swallow); *- * @namespace Class是提供类的创建的辅助工具。 + * @namespace Class Class is created to aid the developer. * @static * @module hilo/core/Class */ var Class = (function(){ /** - * 根据参数指定的属性和方法创建类。 - * @param {Object} properties 要创建的类的相关属性和方法。主要有: + * @language=en + * Create a class based on the parameters, properties and methods specified. + * @param {Object} properties Properties and methods to create the class. *
* var audio = WebSound.getAudio({ * src: 'test.mp3', @@ -26,7 +23,7 @@ define('hilo/media/WebSound', ['hilo/core/Hilo', 'hilo/media/HTMLAudio', 'hilo/m * console.log('end'); * }).play(); *- * @class 声音播放管理器。 + * @class Audio playing manager. * @static * @module hilo/media/WebSound * @requires hilo/core/Hilo @@ -37,7 +34,8 @@ var WebSound = { _audios: {}, /** - * 激活音频功能。注意:需用户事件触发此方法才有效。目前仅对WebAudio有效。 + * @language=en + * Activate audio function. Note: Require user action events to activate. Currently support WebAudio. */ enableAudio: function(){ if(WebAudio.isSupported){ @@ -46,9 +44,10 @@ var WebSound = { }, /** - * 获取音频对象。优先使用WebAudio。 - * @param {String|Object} source 若source为String,则为音频src地址;若为Object,则需包含src属性。 - * @returns {WebAudio|HTMLAudio} 音频播放对象实例。 + * @language=en + * Get audio element. Use WebAudio if supported. + * @param {String|Object} source If String, it's the source of the audio; If Object, it should contains a src property. + * @returns {WebAudio|HTMLAudio} Audio playing instance. */ getAudio: function(source){ source = this._normalizeSource(source); @@ -66,8 +65,9 @@ var WebSound = { }, /** - * 删除音频对象。 - * @param {String|Object} source 若source为String,则为音频src地址;若为Object,则需包含src属性。 + * @language=en + * Remove audio element. + * @param {String|Object} source If String, it's the source of the audio; If Object, it should contains a src property. */ removeAudio: function(source){ var src = typeof source === 'string' ? source : source.src; @@ -81,6 +81,7 @@ var WebSound = { }, /** + * @language=en * @private */ _normalizeSource: function(source){ diff --git a/build/amd/hilo/media/WebSound.min.js b/build/amd/hilo/media/WebSound.min.js index 3c571106..58270335 100644 --- a/build/amd/hilo/media/WebSound.min.js +++ b/build/amd/hilo/media/WebSound.min.js @@ -1,5 +1,5 @@ /** - * Hilo 1.0.0 for amd + * Hilo 1.0.1 for amd * Copyright 2016 alibaba.com * Licensed under the MIT License */ diff --git a/build/amd/hilo/renderer/CanvasRenderer.js b/build/amd/hilo/renderer/CanvasRenderer.js index ad49e5f6..6fc344b0 100644 --- a/build/amd/hilo/renderer/CanvasRenderer.js +++ b/build/amd/hilo/renderer/CanvasRenderer.js @@ -1,25 +1,22 @@ /** - * Hilo 1.0.0 for amd + * Hilo 1.0.1 for amd * Copyright 2016 alibaba.com * Licensed under the MIT License */ define('hilo/renderer/CanvasRenderer', ['hilo/core/Class', 'hilo/core/Hilo', 'hilo/renderer/Renderer'], function(Class, Hilo, Renderer){ -/** - * Hilo - * Copyright 2015 alibaba.com - * Licensed under the MIT License - */ + /** - * @class canvas画布渲染器。所有可视对象将渲染在canvas画布上。舞台Stage会根据参数canvas选择不同的渲染器,开发者无需直接使用此类。 + * @language=en + * @class CanvasRenderer CanvasRenderer, all the visual object is drawing on the canvas element.The stage will create different renderer depend on the canvas and renderType properties, developer need not use this class directly. * @augments Renderer - * @param {Object} properties 创建对象的属性参数。可包含此类所有可写属性。 + * @param {Object} properties The properties to create a renderer, contains all writeable props of this class. * @module hilo/renderer/CanvasRenderer * @requires hilo/core/Class * @requires hilo/core/Hilo * @requires hilo/renderer/Renderer - * @property {CanvasRenderingContext2D} context canvas画布的上下文。只读属性。 + * @property {CanvasRenderingContext2D} context The context of the canvas element, readonly. */ var CanvasRenderer = Class.create(/** @lends CanvasRenderer.prototype */{ Extends: Renderer, @@ -64,7 +61,7 @@ var CanvasRenderer = Class.create(/** @lends CanvasRenderer.prototype */{ var drawable = target.drawable, image = drawable && drawable.image; if(image){ var rect = drawable.rect, sw = rect[2], sh = rect[3], offsetX = rect[4], offsetY = rect[5]; - //ie9+浏览器宽高为0时会报错 + //ie9+浏览器宽高为0时会报错 fixed ie9 bug. if(!sw || !sh){ return; } diff --git a/build/amd/hilo/renderer/CanvasRenderer.min.js b/build/amd/hilo/renderer/CanvasRenderer.min.js index dd8a6f8a..588ae3e4 100644 --- a/build/amd/hilo/renderer/CanvasRenderer.min.js +++ b/build/amd/hilo/renderer/CanvasRenderer.min.js @@ -1,6 +1,6 @@ /** - * Hilo 1.0.0 for amd + * Hilo 1.0.1 for amd * Copyright 2016 alibaba.com * Licensed under the MIT License */ -define("hilo/renderer/CanvasRenderer",["hilo/core/Class","hilo/core/Hilo","hilo/renderer/Renderer"],function(e,t,a){var r=e.create({Extends:a,constructor:function(e){r.superclass.constructor.call(this,e),this.context=this.canvas.getContext("2d")},renderType:"canvas",context:null,startDraw:function(e){return e.visible&&e.alpha>0?(e===this.stage&&this.context.clearRect(0,0,e.width,e.height),this.context.save(),!0):!1},draw:function(e){var t=this.context,a=e.width,r=e.height,i=e.background;i&&(t.fillStyle=i,t.fillRect(0,0,a,r));var n=e.drawable,s=n&&n.image;if(s){var c=n.rect,h=c[2],l=c[3],o=c[4],d=c[5];if(!h||!l)return;a||r||(a=e.width=h,r=e.height=l),(o||d)&&t.translate(o-.5*h,d-.5*l),t.drawImage(s,c[0],c[1],h,l,0,0,a,r)}},endDraw:function(e){this.context.restore()},transform:function(e){var a=e.drawable;if(a&&a.domElement)return void t.setElementStyleByView(e);var r=this.context,i=e.scaleX,n=e.scaleY;if(e===this.stage){var s=this.canvas.style,c=e._scaleX,h=e._scaleY;(!c&&1!=i||c&&c!=i)&&(e._scaleX=i,s.width=i*e.width+"px"),(!h&&1!=n||h&&h!=n)&&(e._scaleY=n,s.height=n*e.height+"px")}else{var l=e.x,o=e.y,d=e.pivotX,v=e.pivotY,f=e.rotation%360,u=e.mask;u&&(u._render(this),r.clip());var g=e.align;if(g)if("function"==typeof g)e.align();else{var w=e.parent;if(w){var b=e.width,p=e.height,x=w.width,m=w.height;switch(g){case"TL":l=0,o=0;break;case"T":l=x-b>>1,o=0;break;case"TR":l=x-b,o=0;break;case"L":l=0,o=m-p>>1;break;case"C":l=x-b>>1,o=m-p>>1;break;case"R":l=x-b,o=m-p>>1;break;case"BL":l=0,o=m-p;break;case"B":l=x-b>>1,o=m-p;break;case"BR":l=x-b,o=m-p}}}(0!=l||0!=o)&&r.translate(l,o),0!=f&&r.rotate(f*Math.PI/180),(1!=i||1!=n)&&r.scale(i,n),(0!=d||0!=v)&&r.translate(-d,-v)}e.alpha>0&&(r.globalAlpha*=e.alpha)},remove:function(e){var t=e.drawable,a=t&&t.domElement;if(a){var r=a.parentNode;r&&r.removeChild(a)}},clear:function(e,t,a,r){this.context.clearRect(e,t,a,r)},resize:function(e,t){this.canvas.width=e,this.canvas.height=t}});return r}); \ No newline at end of file +define("hilo/renderer/CanvasRenderer",["hilo/core/Class","hilo/core/Hilo","hilo/renderer/Renderer"],function(e,t,a){var r=e.create({Extends:a,constructor:function(e){r.superclass.constructor.call(this,e),this.context=this.canvas.getContext("2d")},renderType:"canvas",context:null,startDraw:function(e){return e.visible&&e.alpha>0?(e===this.stage&&this.context.clearRect(0,0,e.width,e.height),this.context.save(),!0):!1},draw:function(e){var t=this.context,a=e.width,r=e.height,i=e.background;i&&(t.fillStyle=i,t.fillRect(0,0,a,r));var n=e.drawable,s=n&&n.image;if(s){var c=n.rect,h=c[2],l=c[3],o=c[4],d=c[5];if(!h||!l)return;a||r||(a=e.width=h,r=e.height=l),(o||d)&&t.translate(o-.5*h,d-.5*l),t.drawImage(s,c[0],c[1],h,l,0,0,a,r)}},endDraw:function(e){this.context.restore()},transform:function(e){var a=e.drawable;if(a&&a.domElement)return void t.setElementStyleByView(e);var r=this.context,i=e.scaleX,n=e.scaleY;if(e===this.stage){var s=this.canvas.style,c=e._scaleX,h=e._scaleY;(!c&&1!=i||c&&c!=i)&&(e._scaleX=i,s.width=i*e.width+"px"),(!h&&1!=n||h&&h!=n)&&(e._scaleY=n,s.height=n*e.height+"px")}else{var l=e.x,o=e.y,d=e.pivotX,v=e.pivotY,f=e.rotation%360,u=e.mask;u&&(u._render(this),r.clip());var g=e.align;if(g)if("function"==typeof g)e.align();else{var w=e.parent;if(w){var b=e.width,p=e.height,x=w.width,m=w.height;switch(g){case"TL":l=0,o=0;break;case"T":l=x-b>>1,o=0;break;case"TR":l=x-b,o=0;break;case"L":l=0,o=m-p>>1;break;case"C":l=x-b>>1,o=m-p>>1;break;case"R":l=x-b,o=m-p>>1;break;case"BL":l=0,o=m-p;break;case"B":l=x-b>>1,o=m-p;break;case"BR":l=x-b,o=m-p}}}0==l&&0==o||r.translate(l,o),0!=f&&r.rotate(f*Math.PI/180),1==i&&1==n||r.scale(i,n),0==d&&0==v||r.translate(-d,-v)}e.alpha>0&&(r.globalAlpha*=e.alpha)},remove:function(e){var t=e.drawable,a=t&&t.domElement;if(a){var r=a.parentNode;r&&r.removeChild(a)}},clear:function(e,t,a,r){this.context.clearRect(e,t,a,r)},resize:function(e,t){this.canvas.width=e,this.canvas.height=t}});return r}); \ No newline at end of file diff --git a/build/amd/hilo/renderer/DOMRenderer.js b/build/amd/hilo/renderer/DOMRenderer.js index 6a9a52a1..ce8c214a 100644 --- a/build/amd/hilo/renderer/DOMRenderer.js +++ b/build/amd/hilo/renderer/DOMRenderer.js @@ -1,20 +1,17 @@ /** - * Hilo 1.0.0 for amd + * Hilo 1.0.1 for amd * Copyright 2016 alibaba.com * Licensed under the MIT License */ define('hilo/renderer/DOMRenderer', ['hilo/core/Class', 'hilo/core/Hilo', 'hilo/renderer/Renderer', 'hilo/view/Drawable'], function(Class, Hilo, Renderer, Drawable){ -/** - * Hilo - * Copyright 2015 alibaba.com - * Licensed under the MIT License - */ + /** - * @class DOM+CSS3渲染器。将可视对象以DOM元素方式渲染出来。舞台Stage会根据参数canvas选择不同的渲染器,开发者无需直接使用此类。 + * @language=en + * @class DomRenderer The DomRenderer, all the visual object is drawing using dom element.The stage will create different renderer depend on the canvas and renderType properties, developer need not use this class directly. * @augments Renderer - * @param {Object} properties 创建对象的属性参数。可包含此类所有可写属性。 + * @param {Object} properties The properties to create a renderer, contains all writeable props of this class. * @module hilo/renderer/DOMRenderer * @requires hilo/core/Class * @requires hilo/core/Hilo @@ -133,10 +130,11 @@ return Class.create({ }); /** - * 创建一个可渲染的DOM,可指定tagName,如canvas或div。 - * @param {Object} view 一个可视对象或类似的对象。 - * @param {Object} imageObj 指定渲染的image及相关设置,如绘制区域rect。 - * @return {HTMLElement} 新创建的DOM对象。 + * @language=en + * Create a dom element, you can set the tagName property,such as canvas and div. + * @param {Object} view A visual object. + * @param {Object} imageObj The image object to render, include the image propertiy and other associated properties, such as rect. + * @return {HTMLElement} The created dom element. * @private */ function createDOMDrawable(view, imageObj){ diff --git a/build/amd/hilo/renderer/DOMRenderer.min.js b/build/amd/hilo/renderer/DOMRenderer.min.js index 0a6078e5..8bf37ea4 100644 --- a/build/amd/hilo/renderer/DOMRenderer.min.js +++ b/build/amd/hilo/renderer/DOMRenderer.min.js @@ -1,5 +1,5 @@ /** - * Hilo 1.0.0 for amd + * Hilo 1.0.1 for amd * Copyright 2016 alibaba.com * Licensed under the MIT License */ diff --git a/build/amd/hilo/renderer/Renderer.js b/build/amd/hilo/renderer/Renderer.js index 57b08dfb..29a82eb5 100644 --- a/build/amd/hilo/renderer/Renderer.js +++ b/build/amd/hilo/renderer/Renderer.js @@ -1,25 +1,22 @@ /** - * Hilo 1.0.0 for amd + * Hilo 1.0.1 for amd * Copyright 2016 alibaba.com * Licensed under the MIT License */ define('hilo/renderer/Renderer', ['hilo/core/Hilo', 'hilo/core/Class'], function(Hilo, Class){ -/** - * Hilo - * Copyright 2015 alibaba.com - * Licensed under the MIT License - */ + /** - * @class 渲染器抽象基类。 - * @param {Object} properties 创建对象的属性参数。可包含此类所有可写属性。 + * @language=en + * @class Renderer Renderer is the base class of renderer. + * @param {Object} properties The properties to create a renderer, contains all writeable props of this class. * @module hilo/renderer/Renderer * @requires hilo/core/Hilo * @requires hilo/core/Class - * @property {Object} canvas 渲染器对应的画布。它可能是一个普通的DOM元素,比如div,也可以是一个canvas画布元素。只读属性。 - * @property {Object} stage 渲染器对应的舞台。只读属性。 - * @property {String} renderType 渲染方式。只读属性。 + * @property {Object} canvas The canvas of renderer. It can be a dom element, such as a div element, or a canvas element. readonly. + * @property {Object} stage The stage of renderer, readonly. + * @property {String} renderType The render type of renderer, readonly. */ var Renderer = Class.create(/** @lends Renderer.prototype */{ constructor: function(properties){ @@ -32,52 +29,60 @@ var Renderer = Class.create(/** @lends Renderer.prototype */{ stage: null, /** - * 为开始绘制可视对象做准备。需要子类来实现。 - * @param {View} target 要绘制的可视对象。 + * @language=en + * Prepare for draw visual object. The subclass need to implement it. + * @param {View} target The visual target to draw. */ startDraw: function(target){ }, /** - * 绘制可视对象。需要子类来实现。 - * @param {View} target 要绘制的可视对象。 + * @language=en + * Draw the visual object. The subclass need to implement it. + * @param {View} target The visual target to draw. */ draw: function(target){ }, /** - * 结束绘制可视对象后的后续处理方法。需要子类来实现。 - * @param {View} target 要绘制的可视对象。 + * @language=en + * The handling method after draw the visual object. The subclass need to implement it. + * @param {View} target The visual target to draw. */ endDraw: function(target){ }, /** - * 对可视对象进行变换。需要子类来实现。 + * @language=en + * Transfrom the visual object. The subclass need to implement it. */ transform: function(){ }, /** - * 隐藏可视对象。需要子类来实现。 + * @language=en + * Hide the visual object. The subclass need to implement it. */ hide: function(){ }, /** - * 从画布中删除可视对象。注意:不是从stage中删除对象。需要子类来实现。 - * @param {View} target 要删除的可视对象。 + * @language=en + * Remove the visual object from canvas. Notice that it dosen't remove the object from stage. The subclass need to implement it. + * @param {View} target The visual target to remove. */ remove: function(target){ }, /** - * 清除画布指定区域。需要子类来实现。 - * @param {Number} x 指定区域的x轴坐标。 - * @param {Number} y 指定区域的y轴坐标。 - * @param {Number} width 指定区域的宽度。 - * @param {Number} height 指定区域的高度。 + * @language=en + * Clear the given region of canvas. The subclass need to implement it. + * @param {Number} x The position on the x axis of the given region. + * @param {Number} y The position on the y axis of the given region. + * @param {Number} width The width of the given region. + * @param {Number} height The height of the given region. */ clear: function(x, y, width, height){ }, /** - * 改变渲染器的画布大小。 - * @param {Number} width 指定渲染画布新的宽度。 - * @param {Number} height 指定渲染画布新的高度。 + * @language=en + * Resize the renderer's canvas. + * @param {Number} width The width of renderer's canvas. + * @param {Number} height The height of the renderer's canvas. */ resize: function(width, height){ } diff --git a/build/amd/hilo/renderer/Renderer.min.js b/build/amd/hilo/renderer/Renderer.min.js index 65a9a54d..f127d89c 100644 --- a/build/amd/hilo/renderer/Renderer.min.js +++ b/build/amd/hilo/renderer/Renderer.min.js @@ -1,5 +1,5 @@ /** - * Hilo 1.0.0 for amd + * Hilo 1.0.1 for amd * Copyright 2016 alibaba.com * Licensed under the MIT License */ diff --git a/build/amd/hilo/renderer/WebGLRenderer.js b/build/amd/hilo/renderer/WebGLRenderer.js index cee46314..4b174e25 100644 --- a/build/amd/hilo/renderer/WebGLRenderer.js +++ b/build/amd/hilo/renderer/WebGLRenderer.js @@ -1,15 +1,11 @@ /** - * Hilo 1.0.0 for amd + * Hilo 1.0.1 for amd * Copyright 2016 alibaba.com * Licensed under the MIT License */ define('hilo/renderer/WebGLRenderer', ['hilo/core/Class', 'hilo/renderer/Renderer', 'hilo/geom/Matrix'], function(Class, Renderer, Matrix){ -/** - * Hilo - * Copyright 2015 alibaba.com - * Licensed under the MIT License - */ + /** * Heavily inspired by PIXI's SpriteRenderer: @@ -18,33 +14,37 @@ define('hilo/renderer/WebGLRenderer', ['hilo/core/Class', 'hilo/renderer/Rendere var DEG2RAD = Math.PI / 180; /** - * @class webgl画布渲染器。所有可视对象将渲染在canvas画布上。 + * @language=en + * @class WebGLRenderer The WebGLRenderer, all the visual object is drawing on the canvas using WebGL.The stage will create different renderer depend on the canvas and renderType properties, developer need not use this class directly. * @augments Renderer - * @param {Object} properties 创建对象的属性参数。可包含此类所有可写属性。 + * @param {Object} properties The properties to create a renderer, contains all writeable props of this class. * @module hilo/renderer/WebGLRenderer * @requires hilo/core/Class * @requires hilo/renderer/Renderer * @requires hilo/geom/Matrix - * @property {WebGLRenderingContext} gl webgl上下文。只读属性。 + * @property {WebGLRenderingContext} gl The WebGL context of the renderer, readonly. */ var WebGLRenderer = Class.create(/** @lends WebGLRenderer.prototype */{ Extends: Renderer, Statics:/** @lends WebGLRenderer */{ /** - * 最大批渲染数量。 + * @language=en + * The max num of batch draw, default is 2000. * @type {Number} */ MAX_BATCH_NUM:2000, /** - * 顶点属性数。只读属性。 + * @language=en + * The num of vertex attributes, readonly. * @type {Number} */ ATTRIBUTE_NUM:5, /** - * 是否支持WebGL。只读属性。 + * @language=en + * is WebGL supported, readonly. * @type {Boolean} */ - isSupport:null + isSupported:null }, renderType:'webgl', gl:null, @@ -109,7 +109,6 @@ var WebGLRenderer = Class.create(/** @lends WebGLRenderer.prototype */{ } return false; }, - /** * @private * @see Renderer#draw @@ -400,6 +399,7 @@ var WebGLRenderer = Class.create(/** @lends WebGLRenderer.prototype */{ }); /** + * @language=en * shader * @param {WebGLRenderer} renderer [description] * @param {Object} source @@ -519,21 +519,15 @@ Shader.prototype = { } }; -WebGLRenderer.isSupport = function(){ - if(this._isSupport !== undefined){ - return this._isSupport; +WebGLRenderer.isSupported = (function(){ + var canvas = document.createElement('canvas'); + if(canvas.getContext && (canvas.getContext('webgl')||canvas.getContext('experimental-webgl'))){ + return true; } else{ - var canvas = document.createElement('canvas'); - if(canvas.getContext && (canvas.getContext('webgl')||canvas.getContext('experimental-webgl'))){ - this._isSupport = true; - } - else{ - this._isSupport = false; - } - return this._isSupport; + return false; } -}; +})(); return WebGLRenderer; diff --git a/build/amd/hilo/renderer/WebGLRenderer.min.js b/build/amd/hilo/renderer/WebGLRenderer.min.js index 4b923af9..91278bd8 100644 --- a/build/amd/hilo/renderer/WebGLRenderer.min.js +++ b/build/amd/hilo/renderer/WebGLRenderer.min.js @@ -1,6 +1,6 @@ /** - * Hilo 1.0.0 for amd + * Hilo 1.0.1 for amd * Copyright 2016 alibaba.com * Licensed under the MIT License */ -define("hilo/renderer/WebGLRenderer",["hilo/core/Class","hilo/renderer/Renderer","hilo/geom/Matrix"],function(t,e,r){var i=Math.PI/180,a=t.create({Extends:e,Statics:{MAX_BATCH_NUM:2e3,ATTRIBUTE_NUM:5,isSupport:null},renderType:"webgl",gl:null,constructor:function(t){window.__render=this,a.superclass.constructor.call(this,t);var e=this.gl=this.canvas.getContext("webgl")||this.canvas.getContext("experimental-webgl");this.maxBatchNum=a.MAX_BATCH_NUM,this.positionStride=4*a.ATTRIBUTE_NUM;var r=this.maxBatchNum*a.ATTRIBUTE_NUM*4,i=6*this.maxBatchNum;this.positions=new Float32Array(r),this.indexs=new Uint16Array(i);for(var n=0,s=0;i>n;n+=6,s+=4)this.indexs[n+0]=s+0,this.indexs[n+1]=s+1,this.indexs[n+2]=s+2,this.indexs[n+3]=s+1,this.indexs[n+4]=s+2,this.indexs[n+5]=s+3;this.batchIndex=0,this.sprites=[],e.blendFunc(e.ONE,e.ONE_MINUS_SRC_ALPHA),e.clearColor(0,0,0,0),e.disable(e.DEPTH_TEST),e.disable(e.CULL_FACE),e.enable(e.BLEND),this._initShaders(),this.defaultShader.active(),this.positionBuffer=e.createBuffer(),this.indexBuffer=e.createBuffer(),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,this.indexBuffer),e.bufferData(e.ELEMENT_ARRAY_BUFFER,this.indexs,e.STATIC_DRAW),e.bindBuffer(e.ARRAY_BUFFER,this.positionBuffer),e.bufferData(e.ARRAY_BUFFER,this.positions,e.DYNAMIC_DRAW),e.vertexAttribPointer(this.a_position,2,e.FLOAT,!1,this.positionStride,0),e.vertexAttribPointer(this.a_TexCoord,2,e.FLOAT,!1,this.positionStride,8),e.vertexAttribPointer(this.a_alpha,1,e.FLOAT,!1,this.positionStride,16)},context:null,startDraw:function(t){return t.visible&&t.alpha>0?(t===this.stage&&this.clear(),!0):!1},draw:function(t){var e=(this.context,t.width),r=t.height,i=(t.background,t.drawable),a=i&&i.image;if(a){this.gl;a.texture||this.activeShader.uploadTexture(a);var n=i.rect,s=n[2],o=n[3];n[4],n[5];e||r||(e=t.width=s,r=t.height=o),this.batchIndex>=this.maxBatchNum&&this._renderBatches();var h=this._createVertexs(a,n[0],n[1],s,o,0,0,e,r),l=this.batchIndex*this.positionStride,_=this.positions,d=t.__webglRenderAlpha;_[l+0]=h[0],_[l+1]=h[1],_[l+2]=h[2],_[l+3]=h[3],_[l+4]=d,_[l+5]=h[4],_[l+6]=h[5],_[l+7]=h[6],_[l+8]=h[7],_[l+9]=d,_[l+10]=h[8],_[l+11]=h[9],_[l+12]=h[10],_[l+13]=h[11],_[l+14]=d,_[l+15]=h[12],_[l+16]=h[13],_[l+17]=h[14],_[l+18]=h[15],_[l+19]=d;for(var c=t.__webglWorldMatrix,u=0;4>u;u++){var f=_[l+5*u],p=_[l+5*u+1];_[l+5*u]=c.a*f+c.c*p+c.tx,_[l+5*u+1]=c.b*f+c.d*p+c.ty}t.texture=a.texture,this.sprites[this.batchIndex++]=t}},endDraw:function(t){t===this.stage&&this._renderBatches()},transform:function(t){var e=t.drawable;if(e&&e.domElement)return void Hilo.setElementStyleByView(t);var i=(this.context,t.scaleX),a=t.scaleY;if(t===this.stage){var n=this.canvas.style,s=t._scaleX,o=t._scaleY;(!s&&1!=i||s&&s!=i)&&(t._scaleX=i,n.width=i*t.width+"px"),(!o&&1!=a||o&&o!=a)&&(t._scaleY=a,n.height=a*t.height+"px"),t.__webglWorldMatrix=t.__webglWorldMatrix||new r(1,0,0,1,0,0)}else t.__webglWorldMatrix=t.__webglWorldMatrix||new r(1,0,0,1,0,0),this._setConcatenatedMatrix(t,t.parent);t.alpha>0&&(t.parent&&t.parent.__webglRenderAlpha?t.__webglRenderAlpha=t.alpha*t.parent.__webglRenderAlpha:t.__webglRenderAlpha=t.alpha)},remove:function(t){var e=t.drawable,r=e&&e.domElement;if(r){var i=r.parentNode;i&&i.removeChild(r)}},clear:function(t,e,r,i){this.gl.clear(this.gl.COLOR_BUFFER_BIT)},resize:function(t,e){(this.width!==t||this.height!==e)&&(this.width=this.canvas.width=t,this.height=this.canvas.height=e,this.gl.viewport(0,0,t,e),this.canvasHalfWidth=.5*t,this.canvasHalfHeight=.5*e,this._uploadProjectionTransform(!0))},_renderBatches:function(){var t=this.gl;t.bufferSubData(t.ARRAY_BUFFER,0,this.positions.subarray(0,this.batchIndex*this.positionStride));for(var e=0,r=0,i=null,a=0;a
- * ticker.addTick(Hilo.Tween);//需要把Tween加到ticker里才能使用 + * ticker.addTick(Hilo.Tween);//Tween works after being added to ticker * * var view = new View({x:5, y:10}); * Hilo.Tween.to(view, { @@ -32,26 +29,26 @@ define('hilo/tween/Tween', ['hilo/core/Class'], function(Class){ * } * }); *- * @class Tween类提供缓动功能。 - * @param {Object} target 缓动对象。 - * @param {Object} fromProps 对象缓动的起始属性集合。 - * @param {Object} toProps 对象缓动的目标属性集合。 - * @param {Object} params 缓动参数。可包含Tween类所有可写属性。 + * @class Tween class makes tweening (easing, slow motion). + * @param {Object} target Tween target object. + * @param {Object} fromProps Beginning properties of target tweening object. + * @param {Object} toProps Ending properties of target tweening object. + * @param {Object} params Tweening parameters, include all writable Tween class properties. * @module hilo/tween/Tween * @requires hilo/core/Class - * @property {Object} target 缓动目标。只读属性。 - * @property {Int} duration 缓动总时长。单位毫秒。 - * @property {Int} delay 缓动延迟时间。单位毫秒。 - * @property {Boolean} paused 缓动是否暂停。默认为false。 - * @property {Boolean} loop 缓动是否循环。默认为false。 - * @property {Boolean} reverse 缓动是否反转播放。默认为false。 - * @property {Int} repeat 缓动重复的次数。默认为0。 - * @property {Int} repeatDelay 缓动重复的延迟时长。单位为毫秒。 - * @property {Function} ease 缓动变化函数。默认为null。 - * @property {Int} time 缓动已进行的时长。单位毫秒。只读属性。 - * @property {Function} onStart 缓动开始回调函数。它接受1个参数:tween。默认值为null。 - * @property {Function} onUpdate 缓动更新回调函数。它接受2个参数:ratio和tween。默认值为null。 - * @property {Function} onComplete 缓动结束回调函数。它接受1个参数:tween。默认值为null。 + * @property {Object} target Tween target object, readonly! + * @property {Int} duration Tweening duration, measure in ms. + * @property {Int} delay Tweenning delay time, measure in ms. + * @property {Boolean} paused Is tweening paused, default value is false. + * @property {Boolean} loop Does tweening loop, default value is false. + * @property {Boolean} reverse Does tweening reverse, default value is false. + * @property {Int} repeat Repeat times of tweening, default value is 0. + * @property {Int} repeatDelay Delay time of repeating tweening, measure in ms. + * @property {Function} ease Tweening transform function, default value is null. + * @property {Int} time Time that tweening taken, measure in ms, readonly! + * @property {Function} onStart Function invoked on the beginning of tweening. Require 1 parameter: tween. default value is null. + * @property {Function} onUpdate Function invoked on tweening update. Require 2 parameters: ratio, tween. default value is null. + * @property {Function} onComplete Function invoked on the end of tweening. Require 1 parameter: tween. default value is null. */ var Tween = (function(){ @@ -104,10 +101,11 @@ return Class.create(/** @lends Tween.prototype */{ onComplete: null, /** - * 设置缓动对象的初始和目标属性。 - * @param {Object} fromProps 缓动对象的初始属性。 - * @param {Object} toProps 缓动对象的目标属性。 - * @returns {Tween} Tween变换本身。可用于链式调用。 + * @language=en + * Set beginning properties and ending properties of tweening object. + * @param {Object} fromProps Beginning properties of target tweening object. + * @param {Object} toProps Ending properties of target tweening object. + * @returns {Tween} Current Tween, for chain calls. */ setProps: function(fromProps, toProps){ var me = this, target = me.target, @@ -125,8 +123,9 @@ return Class.create(/** @lends Tween.prototype */{ }, /** - * 启动缓动动画的播放。 - * @returns {Tween} Tween变换本身。可用于链式调用。 + * @language=en + * Starting the tweening. + * @returns {Tween} Current Tween, for chain calls. */ start: function(){ var me = this; @@ -139,8 +138,9 @@ return Class.create(/** @lends Tween.prototype */{ }, /** - * 停止缓动动画的播放。 - * @returns {Tween} Tween变换本身。可用于链式调用。 + * @language=en + * Stop the tweening. + * @returns {Tween} Current Tween, for chain calls. */ stop: function(){ Tween.remove(this); @@ -148,8 +148,9 @@ return Class.create(/** @lends Tween.prototype */{ }, /** - * 暂停缓动动画的播放。 - * @returns {Tween} Tween变换本身。可用于链式调用。 + * @language=en + * Pause the tweening. + * @returns {Tween} Current Tween, for chain calls. */ pause: function(){ var me = this; @@ -159,8 +160,9 @@ return Class.create(/** @lends Tween.prototype */{ }, /** - * 恢复缓动动画的播放。 - * @returns {Tween} Tween变换本身。可用于链式调用。 + * @language=en + * Continue to play the tweening. + * @returns {Tween} Current Tween, for chain calls. */ resume: function(){ var me = this; @@ -171,10 +173,11 @@ return Class.create(/** @lends Tween.prototype */{ }, /** - * 跳转Tween到指定的时间。 - * @param {Number} time 指定要跳转的时间。取值范围为:0 - duraion。 - * @param {Boolean} pause 是否暂停。 - * @returns {Tween} Tween变换本身。可用于链式调用。 + * @language=en + * Tween jumps to some point. + * @param {Number} time The time to jump to, range from 0 to duration. + * @param {Boolean} pause Is paused. + * @returns {Tween} Current Tween, for chain calls. */ seek: function(time, pause){ var me = this, current = now(); @@ -188,9 +191,10 @@ return Class.create(/** @lends Tween.prototype */{ }, /** - * 连接下一个Tween变换。其开始时间根据delay值不同而不同。当delay值为字符串且以'+'或'-'开始时,Tween的开始时间从当前变换结束点计算,否则以当前变换起始点计算。 - * @param {Tween} tween 要连接的Tween变换。 - * @returns {Tween} Tween变换本身。可用于链式调用。 + * @language=en + * Link next Tween. The beginning time of next Tween depends on the delay value. If delay is a string that begins with '+' or '-', next Tween will begin at (delay) ms after or before the current tween is ended. If delay is out of previous situation, next Tween will begin at (delay) ms after the beginning point of current Tween. + * @param {Tween} tween Tween to link. + * @returns {Tween} Current Tween, for chain calls. */ link: function(tween){ var me = this, delay = tween.delay, startTime = me._startTime; @@ -208,7 +212,8 @@ return Class.create(/** @lends Tween.prototype */{ }, /** - * Tween类的内部渲染方法。 + * @language=en + * Private render method inside Tween class. * @private */ _render: function(ratio){ @@ -217,7 +222,8 @@ return Class.create(/** @lends Tween.prototype */{ }, /** - * Tween类的内部更新方法。 + * @language=en + * Private update method inside Tween class. * @private */ _update: function(time, forceUpdate){ @@ -294,12 +300,14 @@ return Class.create(/** @lends Tween.prototype */{ Statics: /** @lends Tween */ { /** + * @language=en * @private */ _tweens: [], /** - * 更新所有Tween实例。 + * @language=en + * Update all Tween instances. * @returns {Object} Tween。 */ tick: function(){ @@ -316,8 +324,9 @@ return Class.create(/** @lends Tween.prototype */{ }, /** - * 添加Tween实例。 - * @param {Tween} tween 要添加的Tween对象。 + * @language=en + * Add a Tween instance. + * @param {Tween} tween Tween object to add. * @returns {Object} Tween。 */ add: function(tween){ @@ -327,8 +336,9 @@ return Class.create(/** @lends Tween.prototype */{ }, /** - * 删除Tween实例。 - * @param {Tween|Object|Array} tweenOrTarget 要删除的Tween对象或target对象或要删除的一组对象。 + * @language=en + * Remove one Tween target. + * @param {Tween|Object|Array} tweenOrTarget Tween object, target object or an array of object to remove * @returns {Object} Tween。 */ remove: function(tweenOrTarget){ @@ -356,7 +366,8 @@ return Class.create(/** @lends Tween.prototype */{ }, /** - * 删除所有Tween实例。 + * @language=en + * Remove all Tween instances. * @returns {Object} Tween。 */ removeAll: function(){ @@ -365,12 +376,13 @@ return Class.create(/** @lends Tween.prototype */{ }, /** - * 创建一个缓动动画,让目标对象从开始属性变换到目标属性。 - * @param {Object|Array} target 缓动目标对象或缓动目标数组。 - * @param fromProps 缓动目标对象的开始属性。 - * @param toProps 缓动目标对象的目标属性。 - * @param params 缓动动画的参数。 - * @returns {Tween|Array} 一个Tween实例对象或Tween实例数组。 + * @language=en + * Create a tween, make target object easing from beginning properties to ending properties. + * @param {Object|Array} target Tweening target or tweening target array. + * @param fromProps Beginning properties of target tweening object. + * @param toProps Ending properties of target tweening object. + * @param params Tweening parameters. + * @returns {Tween|Array} An tween instance or an array of tween instance. */ fromTo: function(target, fromProps, toProps, params){ var isArray = target instanceof Array; @@ -388,22 +400,24 @@ return Class.create(/** @lends Tween.prototype */{ }, /** - * 创建一个缓动动画,让目标对象从当前属性变换到目标属性。 - * @param {Object|Array} target 缓动目标对象或缓动目标数组。 - * @param toProps 缓动目标对象的目标属性。 - * @param params 缓动动画的参数。 - * @returns {Tween|Array} 一个Tween实例对象或Tween实例数组。 + * @language=en + * Create a tween, make target object easing from current properties to ending properties. + * @param {Object|Array} target Tweening target or tweening target array. + * @param toProps Ending properties of target tweening object. + * @param params Tweening parameters. + * @returns {Tween|Array} An tween instance or an array of tween instance. */ to: function(target, toProps, params){ return Tween.fromTo(target, null, toProps, params); }, /** - * 创建一个缓动动画,让目标对象从指定的起始属性变换到当前属性。 - * @param {Object|Array} target 缓动目标对象或缓动目标数组。 - * @param fromProps 缓动目标对象的目标属性。 - * @param params 缓动动画的参数。 - * @returns {Tween|Array} 一个Tween实例对象或Tween实例数组。 + * @language=en + * Create a tween, make target object easing from beginning properties to current properties. + * @param {Object|Array} target Tweening target or tweening target array. + * @param fromProps Beginning properties of target tweening object. + * @param params Tweening parameters. + * @returns {Tween|Array} An tween instance or an array of tween instance. */ from: function(target, fromProps, params){ return Tween.fromTo(target, fromProps, null, params); @@ -414,6 +428,7 @@ return Class.create(/** @lends Tween.prototype */{ })(); + return Tween; }); \ No newline at end of file diff --git a/build/amd/hilo/tween/Tween.min.js b/build/amd/hilo/tween/Tween.min.js index 200c763a..32b3d458 100644 --- a/build/amd/hilo/tween/Tween.min.js +++ b/build/amd/hilo/tween/Tween.min.js @@ -1,5 +1,5 @@ /** - * Hilo 1.0.0 for amd + * Hilo 1.0.1 for amd * Copyright 2016 alibaba.com * Licensed under the MIT License */ diff --git a/build/amd/hilo/util/TextureAtlas.js b/build/amd/hilo/util/TextureAtlas.js index b054a744..0f2c58f8 100644 --- a/build/amd/hilo/util/TextureAtlas.js +++ b/build/amd/hilo/util/TextureAtlas.js @@ -1,17 +1,14 @@ /** - * Hilo 1.0.0 for amd + * Hilo 1.0.1 for amd * Copyright 2016 alibaba.com * Licensed under the MIT License */ define('hilo/util/TextureAtlas', ['hilo/core/Class'], function(Class){ -/** - * Hilo - * Copyright 2015 alibaba.com - * Licensed under the MIT License - */ + /** + * @language=en * @class TextureAtlas纹理集是将许多小的纹理图片整合到一起的一张大图。这个类可根据一个纹理集数据读取纹理小图、精灵动画等。 * @param {Object} atlasData 纹理集数据。它可包含如下数据: *
* var bmp = new Bitmap({image:img}); * Hilo.copy(bmp, Hilo.drag); * bmp.startDrag([0, 0, 550, 400]); *- * @class drag是一个包含拖拽功能的mixin。可以通过 Class.mix(view, drag)或Hilo.copy(view, drag)来为view增加拖拽功能。 + * @class drag A mixin that contains drag method.You can mix drag method to the visual target by use Class.mix(target, drag) or Hilo.copy(target, drag). * @mixin * @static * @module hilo/util/drag @@ -29,8 +26,9 @@ define('hilo/util/drag', ['hilo/core/Class', 'hilo/core/Hilo'], function(Class, */ var drag = { /** - * 开始拖拽 - * @param {Array} bounds 拖拽范围,基于父容器坐标系,[x, y, width, height], 默认无限制 + * @language=en + * start drag. + * @param {Array} bounds The bounds area that the view can move, relative to the coordinates of the view's parent, [x, y, width, height], default is no limit. */ startDrag:function(bounds){ var that = this; @@ -101,7 +99,8 @@ var drag = { that.stopDrag = stopDrag; }, /** - * 停止拖拽 + * @language=en + * stop drag. */ stopDrag:function(){ diff --git a/build/amd/hilo/util/drag.min.js b/build/amd/hilo/util/drag.min.js index 480059e8..cf6d3f48 100644 --- a/build/amd/hilo/util/drag.min.js +++ b/build/amd/hilo/util/drag.min.js @@ -1,5 +1,5 @@ /** - * Hilo 1.0.0 for amd + * Hilo 1.0.1 for amd * Copyright 2016 alibaba.com * Licensed under the MIT License */ diff --git a/build/amd/hilo/util/polyfill.js b/build/amd/hilo/util/polyfill.js index c205434c..dfc4de1d 100644 --- a/build/amd/hilo/util/polyfill.js +++ b/build/amd/hilo/util/polyfill.js @@ -1,15 +1,11 @@ /** - * Hilo 1.0.0 for amd + * Hilo 1.0.1 for amd * Copyright 2016 alibaba.com * Licensed under the MIT License */ define(function(){ -/** - * Hilo - * Copyright 2015 alibaba.com - * Licensed under the MIT License - */ + var arrayProto = Array.prototype, slice = arrayProto.slice; diff --git a/build/amd/hilo/util/polyfill.min.js b/build/amd/hilo/util/polyfill.min.js index 5dbbc81a..c25642e2 100644 --- a/build/amd/hilo/util/polyfill.min.js +++ b/build/amd/hilo/util/polyfill.min.js @@ -1,6 +1,6 @@ /** - * Hilo 1.0.0 for amd + * Hilo 1.0.1 for amd * Copyright 2016 alibaba.com * Licensed under the MIT License */ -define(function(){var t=Array.prototype,n=t.slice;t.indexOf=t.indexOf||function(t,n){n=n||0;var r,e=this.length;if(0==e||n>=e)return-1;for(0>n&&(n=e+n),r=n;e>r;r++)if(this[r]===t)return r;return-1};var r=Function.prototype;r.bind=r.bind||function(t){function r(){var o=i.concat(n.call(arguments));return e.apply(this instanceof r?this:t,o)}var e=this,i=n.call(arguments,1),o=function(){};return o.prototype=e.prototype,r.prototype=new o,r}}); \ No newline at end of file +define(function(){var t=Array.prototype,n=t.slice;t.indexOf=t.indexOf||function(t,n){n=n||0;var r,i=this.length;if(0==i||n>=i)return-1;for(0>n&&(n=i+n),r=n;i>r;r++)if(this[r]===t)return r;return-1};var r=Function.prototype;r.bind=r.bind||function(t){function r(){var e=o.concat(n.call(arguments));return i.apply(this instanceof r?this:t,e)}var i=this,o=n.call(arguments,1),e=function(){};return e.prototype=i.prototype,r.prototype=new e,r}}); \ No newline at end of file diff --git a/build/amd/hilo/view/Bitmap.js b/build/amd/hilo/view/Bitmap.js index 44f8b60e..499308e2 100644 --- a/build/amd/hilo/view/Bitmap.js +++ b/build/amd/hilo/view/Bitmap.js @@ -1,30 +1,27 @@ /** - * Hilo 1.0.0 for amd + * Hilo 1.0.1 for amd * Copyright 2016 alibaba.com * Licensed under the MIT License */ define('hilo/view/Bitmap', ['hilo/core/Hilo', 'hilo/core/Class', 'hilo/view/View', 'hilo/view/Drawable'], function(Hilo, Class, View, Drawable){ -/** - * Hilo - * Copyright 2015 alibaba.com - * Licensed under the MIT License - */ + /** + * @language=en * *
* var bmp = new Hilo.Bitmap({image:imgElem, rect:[0, 0, 100, 100]}); * stage.addChild(bmp); *- * @class Bitmap类表示位图图像类。 + * @class Bitmap * @augments View - * @param {Object} properties 创建对象的属性参数。可包含此类所有可写属性。此外还包括: + * @param {Object} properties the options of create Instance.It can contains all writable property and Moreover: *
* var btn = new Hilo.Button({ * image: buttonImage, @@ -24,24 +21,24 @@ define('hilo/view/Button', ['hilo/core/Hilo', 'hilo/core/Class', 'hilo/view/View * disabledState: {rect:[192, 0, 64, 64]} * }); *- * @class Button类表示简单按钮类。它有弹起、经过、按下和不可用等四种状态。 + * @class Button class is a simple button class, contains four kinds of state: 'up', 'over', 'down', 'disabled' * @augments View - * @param {Object} properties 创建对象的属性参数。可包含此类所有可写属性。此外还包括: + * @param {Object} properties create object properties. Contains all writable properties. Also contains: *
* var domView = new Hilo.DOMElement({ * element: Hilo.createElement('div', { @@ -30,11 +27,11 @@ define('hilo/view/DOMElement', ['hilo/core/Hilo', 'hilo/core/Class', 'hilo/view/ * }).addTo(stage); ** @name DOMElement - * @class DOMElement是dom元素的包装。 + * @class DOMElement is a wrapper of dom element. * @augments View - * @param {Object} properties 创建对象的属性参数。可包含此类所有可写属性。特殊属性有: + * @param {Object} properties create Objects properties. Contains all writable properties in this class. Special properties include: *
var path = 'M250 150 L150 350 L350 350 Z';
*var shape = new Hilo.Graphics({width:500, height:500});
*shape.drawSVGPath(path).beginFill('#0ff').endFill();
- * @param {String} pathData 要绘制的SVG路径数据。 - * @returns {Graphics} Graphics对象本身。 + * @param {String} pathData The SVG path data to draw. + * @returns {Graphics} The Graphics Object. */ drawSVGPath: function(pathData){ var me = this, addAction = me._addAction, @@ -350,7 +365,8 @@ return Class.create(/** @lends Graphics.prototype */{ }, /** - * 执行全部绘制动作。内部私有方法。 + * @language=en + * Apply all draw actions. private function. * @private */ _draw: function(context){ @@ -368,7 +384,8 @@ return Class.create(/** @lends Graphics.prototype */{ }, /** - * 重写渲染实现。 + * @language=en + * Overwrite render function. * @private */ render: function(renderer, delta){ @@ -382,8 +399,9 @@ return Class.create(/** @lends Graphics.prototype */{ }, /** - * 清除所有绘制动作并复原所有初始状态。 - * @returns {Graphics} Graphics对象本身。 + * @language=en + * Clear all draw actions and reset to the initial state. + * @returns {Graphics} The Graphics Object. */ clear: function(){ var me = this; @@ -405,7 +423,8 @@ return Class.create(/** @lends Graphics.prototype */{ }, /** - * 添加一个绘制动作。内部私有方法。 + * @language=en + * Add a draw action, this is a private function. * @private */ _addAction: function(action){ @@ -418,6 +437,7 @@ return Class.create(/** @lends Graphics.prototype */{ })(); + return Graphics; }); \ No newline at end of file diff --git a/build/amd/hilo/view/Graphics.min.js b/build/amd/hilo/view/Graphics.min.js index ccf8afa3..d38ad7ad 100644 --- a/build/amd/hilo/view/Graphics.min.js +++ b/build/amd/hilo/view/Graphics.min.js @@ -1,5 +1,5 @@ /** - * Hilo 1.0.0 for amd + * Hilo 1.0.1 for amd * Copyright 2016 alibaba.com * Licensed under the MIT License */ diff --git a/build/amd/hilo/view/Sprite.js b/build/amd/hilo/view/Sprite.js index 355b8d1e..1420ca29 100644 --- a/build/amd/hilo/view/Sprite.js +++ b/build/amd/hilo/view/Sprite.js @@ -1,35 +1,32 @@ /** - * Hilo 1.0.0 for amd + * Hilo 1.0.1 for amd * Copyright 2016 alibaba.com * Licensed under the MIT License */ define('hilo/view/Sprite', ['hilo/core/Hilo', 'hilo/core/Class', 'hilo/view/View', 'hilo/view/Drawable'], function(Hilo, Class, View, Drawable){ -/** - * Hilo - * Copyright 2015 alibaba.com - * Licensed under the MIT License - */ + /** + * @language=en * ** var stage = new Hilo.Stage({ * renderType:'canvas', @@ -21,16 +18,16 @@ define('hilo/view/Stage', ['hilo/core/Hilo', 'hilo/core/Class', 'hilo/view/Conta * height: 480 * }); *- * @class 舞台是可视对象树的根,可视对象只有添加到舞台或其子对象后才会被渲染出来。创建一个hilo应用一般都是从创建一个stage开始的。 + * @class Stage is the root of all visual object tree, any visual object will be render only after being added to Stage or any children elements of Stage. Normally, every hilo application start with an stage instance. * @augments Container - * @param {Object} properties 创建对象的属性参数。可包含此类所有可写属性。主要有: + * @param {Object} properties Properties parameters for the object. Includes all writable properties of this class. Some important like: *
* var Bird = Hilo.Class.create({ * Extends: Animal, @@ -392,23 +401,24 @@ define(function(require, exports, module){ * swallow.fly(); * Bird.isBird(swallow); *- * @namespace Class是提供类的创建的辅助工具。 + * @namespace Class Class is created to aid the developer. * @static * @module hilo/core/Class */ var Class = (function(){ /** - * 根据参数指定的属性和方法创建类。 - * @param {Object} properties 要创建的类的相关属性和方法。主要有: + * @language=en + * Create a class based on the parameters, properties and methods specified. + * @param {Object} properties Properties and methods to create the class. *
* var stage = new Hilo.Stage({ * renderType:'canvas', @@ -2858,16 +2906,16 @@ var WebGLRenderer = require('hilo/renderer/WebGLRenderer'); * height: 480 * }); *- * @class 舞台是可视对象树的根,可视对象只有添加到舞台或其子对象后才会被渲染出来。创建一个hilo应用一般都是从创建一个stage开始的。 + * @class Stage is the root of all visual object tree, any visual object will be render only after being added to Stage or any children elements of Stage. Normally, every hilo application start with an stage instance. * @augments Container - * @param {Object} properties 创建对象的属性参数。可包含此类所有可写属性。主要有: + * @param {Object} properties Properties parameters for the object. Includes all writable properties of this class. Some important like: *
* var bmp = new Hilo.Bitmap({image:imgElem, rect:[0, 0, 100, 100]}); * stage.addChild(bmp); *- * @class Bitmap类表示位图图像类。 + * @class Bitmap * @augments View - * @param {Object} properties 创建对象的属性参数。可包含此类所有可写属性。此外还包括: + * @param {Object} properties the options of create Instance.It can contains all writable property and Moreover: *
* var domView = new Hilo.DOMElement({ * element: Hilo.createElement('div', { @@ -3474,11 +3542,11 @@ var Drawable = require('hilo/view/Drawable'); * }).addTo(stage); ** @name DOMElement - * @class DOMElement是dom元素的包装。 + * @class DOMElement is a wrapper of dom element. * @augments View - * @param {Object} properties 创建对象的属性参数。可包含此类所有可写属性。特殊属性有: + * @param {Object} properties create Objects properties. Contains all writable properties in this class. Special properties include: *
var path = 'M250 150 L150 350 L350 350 Z';
*var shape = new Hilo.Graphics({width:500, height:500});
*shape.drawSVGPath(path).beginFill('#0ff').endFill();
- * @param {String} pathData 要绘制的SVG路径数据。 - * @returns {Graphics} Graphics对象本身。 + * @param {String} pathData The SVG path data to draw. + * @returns {Graphics} The Graphics Object. */ drawSVGPath: function(pathData){ var me = this, addAction = me._addAction, @@ -3897,7 +3986,8 @@ return Class.create(/** @lends Graphics.prototype */{ }, /** - * 执行全部绘制动作。内部私有方法。 + * @language=en + * Apply all draw actions. private function. * @private */ _draw: function(context){ @@ -3915,7 +4005,8 @@ return Class.create(/** @lends Graphics.prototype */{ }, /** - * 重写渲染实现。 + * @language=en + * Overwrite render function. * @private */ render: function(renderer, delta){ @@ -3929,8 +4020,9 @@ return Class.create(/** @lends Graphics.prototype */{ }, /** - * 清除所有绘制动作并复原所有初始状态。 - * @returns {Graphics} Graphics对象本身。 + * @language=en + * Clear all draw actions and reset to the initial state. + * @returns {Graphics} The Graphics Object. */ clear: function(){ var me = this; @@ -3952,7 +4044,8 @@ return Class.create(/** @lends Graphics.prototype */{ }, /** - * 添加一个绘制动作。内部私有方法。 + * @language=en + * Add a draw action, this is a private function. * @private */ _addAction: function(action){ @@ -3965,11 +4058,12 @@ return Class.create(/** @lends Graphics.prototype */{ })(); + return Graphics; }); /** - * Hilo 1.0.0 for cmd + * Hilo 1.0.1 for cmd * Copyright 2016 alibaba.com * Licensed under the MIT License */ @@ -3980,33 +4074,30 @@ var Hilo = require('hilo/core/Hilo'); var View = require('hilo/view/View'); var CacheMixin = require('hilo/view/CacheMixin'); -/** - * Hilo - * Copyright 2015 alibaba.com - * Licensed under the MIT License - */ + /** + * @language=en * ** var btn = new Hilo.Button({ * image: buttonImage, @@ -4430,24 +4526,24 @@ var Drawable = require('hilo/view/Drawable'); * disabledState: {rect:[192, 0, 64, 64]} * }); *- * @class Button类表示简单按钮类。它有弹起、经过、按下和不可用等四种状态。 + * @class Button class is a simple button class, contains four kinds of state: 'up', 'over', 'down', 'disabled' * @augments View - * @param {Object} properties 创建对象的属性参数。可包含此类所有可写属性。此外还包括: + * @param {Object} properties create object properties. Contains all writable properties. Also contains: *
* var bmp = new Bitmap({image:img}); * Hilo.copy(bmp, Hilo.drag); * bmp.startDrag([0, 0, 550, 400]); *- * @class drag是一个包含拖拽功能的mixin。可以通过 Class.mix(view, drag)或Hilo.copy(view, drag)来为view增加拖拽功能。 + * @class drag A mixin that contains drag method.You can mix drag method to the visual target by use Class.mix(target, drag) or Hilo.copy(target, drag). * @mixin * @static * @module hilo/util/drag @@ -5046,8 +5148,9 @@ var Hilo = require('hilo/core/Hilo'); */ var drag = { /** - * 开始拖拽 - * @param {Array} bounds 拖拽范围,基于父容器坐标系,[x, y, width, height], 默认无限制 + * @language=en + * start drag. + * @param {Array} bounds The bounds area that the view can move, relative to the coordinates of the view's parent, [x, y, width, height], default is no limit. */ startDrag:function(bounds){ var that = this; @@ -5118,7 +5221,8 @@ var drag = { that.stopDrag = stopDrag; }, /** - * 停止拖拽 + * @language=en + * stop drag. */ stopDrag:function(){ @@ -5129,7 +5233,7 @@ return drag; }); /** - * Hilo 1.0.0 for cmd + * Hilo 1.0.1 for cmd * Copyright 2016 alibaba.com * Licensed under the MIT License */ @@ -5137,18 +5241,15 @@ define(function(require, exports, module){ var Class = require('hilo/core/Class'); -/** - * Hilo - * Copyright 2015 alibaba.com - * Licensed under the MIT License - */ + /** + * @language=en * *
- * ticker.addTick(Hilo.Tween);//需要把Tween加到ticker里才能使用 + * ticker.addTick(Hilo.Tween);//Tween works after being added to ticker * * var view = new View({x:5, y:10}); * Hilo.Tween.to(view, { @@ -5164,26 +5265,26 @@ var Class = require('hilo/core/Class'); * } * }); *- * @class Tween类提供缓动功能。 - * @param {Object} target 缓动对象。 - * @param {Object} fromProps 对象缓动的起始属性集合。 - * @param {Object} toProps 对象缓动的目标属性集合。 - * @param {Object} params 缓动参数。可包含Tween类所有可写属性。 + * @class Tween class makes tweening (easing, slow motion). + * @param {Object} target Tween target object. + * @param {Object} fromProps Beginning properties of target tweening object. + * @param {Object} toProps Ending properties of target tweening object. + * @param {Object} params Tweening parameters, include all writable Tween class properties. * @module hilo/tween/Tween * @requires hilo/core/Class - * @property {Object} target 缓动目标。只读属性。 - * @property {Int} duration 缓动总时长。单位毫秒。 - * @property {Int} delay 缓动延迟时间。单位毫秒。 - * @property {Boolean} paused 缓动是否暂停。默认为false。 - * @property {Boolean} loop 缓动是否循环。默认为false。 - * @property {Boolean} reverse 缓动是否反转播放。默认为false。 - * @property {Int} repeat 缓动重复的次数。默认为0。 - * @property {Int} repeatDelay 缓动重复的延迟时长。单位为毫秒。 - * @property {Function} ease 缓动变化函数。默认为null。 - * @property {Int} time 缓动已进行的时长。单位毫秒。只读属性。 - * @property {Function} onStart 缓动开始回调函数。它接受1个参数:tween。默认值为null。 - * @property {Function} onUpdate 缓动更新回调函数。它接受2个参数:ratio和tween。默认值为null。 - * @property {Function} onComplete 缓动结束回调函数。它接受1个参数:tween。默认值为null。 + * @property {Object} target Tween target object, readonly! + * @property {Int} duration Tweening duration, measure in ms. + * @property {Int} delay Tweenning delay time, measure in ms. + * @property {Boolean} paused Is tweening paused, default value is false. + * @property {Boolean} loop Does tweening loop, default value is false. + * @property {Boolean} reverse Does tweening reverse, default value is false. + * @property {Int} repeat Repeat times of tweening, default value is 0. + * @property {Int} repeatDelay Delay time of repeating tweening, measure in ms. + * @property {Function} ease Tweening transform function, default value is null. + * @property {Int} time Time that tweening taken, measure in ms, readonly! + * @property {Function} onStart Function invoked on the beginning of tweening. Require 1 parameter: tween. default value is null. + * @property {Function} onUpdate Function invoked on tweening update. Require 2 parameters: ratio, tween. default value is null. + * @property {Function} onComplete Function invoked on the end of tweening. Require 1 parameter: tween. default value is null. */ var Tween = (function(){ @@ -5236,10 +5337,11 @@ return Class.create(/** @lends Tween.prototype */{ onComplete: null, /** - * 设置缓动对象的初始和目标属性。 - * @param {Object} fromProps 缓动对象的初始属性。 - * @param {Object} toProps 缓动对象的目标属性。 - * @returns {Tween} Tween变换本身。可用于链式调用。 + * @language=en + * Set beginning properties and ending properties of tweening object. + * @param {Object} fromProps Beginning properties of target tweening object. + * @param {Object} toProps Ending properties of target tweening object. + * @returns {Tween} Current Tween, for chain calls. */ setProps: function(fromProps, toProps){ var me = this, target = me.target, @@ -5257,8 +5359,9 @@ return Class.create(/** @lends Tween.prototype */{ }, /** - * 启动缓动动画的播放。 - * @returns {Tween} Tween变换本身。可用于链式调用。 + * @language=en + * Starting the tweening. + * @returns {Tween} Current Tween, for chain calls. */ start: function(){ var me = this; @@ -5271,8 +5374,9 @@ return Class.create(/** @lends Tween.prototype */{ }, /** - * 停止缓动动画的播放。 - * @returns {Tween} Tween变换本身。可用于链式调用。 + * @language=en + * Stop the tweening. + * @returns {Tween} Current Tween, for chain calls. */ stop: function(){ Tween.remove(this); @@ -5280,8 +5384,9 @@ return Class.create(/** @lends Tween.prototype */{ }, /** - * 暂停缓动动画的播放。 - * @returns {Tween} Tween变换本身。可用于链式调用。 + * @language=en + * Pause the tweening. + * @returns {Tween} Current Tween, for chain calls. */ pause: function(){ var me = this; @@ -5291,8 +5396,9 @@ return Class.create(/** @lends Tween.prototype */{ }, /** - * 恢复缓动动画的播放。 - * @returns {Tween} Tween变换本身。可用于链式调用。 + * @language=en + * Continue to play the tweening. + * @returns {Tween} Current Tween, for chain calls. */ resume: function(){ var me = this; @@ -5303,10 +5409,11 @@ return Class.create(/** @lends Tween.prototype */{ }, /** - * 跳转Tween到指定的时间。 - * @param {Number} time 指定要跳转的时间。取值范围为:0 - duraion。 - * @param {Boolean} pause 是否暂停。 - * @returns {Tween} Tween变换本身。可用于链式调用。 + * @language=en + * Tween jumps to some point. + * @param {Number} time The time to jump to, range from 0 to duration. + * @param {Boolean} pause Is paused. + * @returns {Tween} Current Tween, for chain calls. */ seek: function(time, pause){ var me = this, current = now(); @@ -5320,9 +5427,10 @@ return Class.create(/** @lends Tween.prototype */{ }, /** - * 连接下一个Tween变换。其开始时间根据delay值不同而不同。当delay值为字符串且以'+'或'-'开始时,Tween的开始时间从当前变换结束点计算,否则以当前变换起始点计算。 - * @param {Tween} tween 要连接的Tween变换。 - * @returns {Tween} Tween变换本身。可用于链式调用。 + * @language=en + * Link next Tween. The beginning time of next Tween depends on the delay value. If delay is a string that begins with '+' or '-', next Tween will begin at (delay) ms after or before the current tween is ended. If delay is out of previous situation, next Tween will begin at (delay) ms after the beginning point of current Tween. + * @param {Tween} tween Tween to link. + * @returns {Tween} Current Tween, for chain calls. */ link: function(tween){ var me = this, delay = tween.delay, startTime = me._startTime; @@ -5340,7 +5448,8 @@ return Class.create(/** @lends Tween.prototype */{ }, /** - * Tween类的内部渲染方法。 + * @language=en + * Private render method inside Tween class. * @private */ _render: function(ratio){ @@ -5349,7 +5458,8 @@ return Class.create(/** @lends Tween.prototype */{ }, /** - * Tween类的内部更新方法。 + * @language=en + * Private update method inside Tween class. * @private */ _update: function(time, forceUpdate){ @@ -5426,12 +5536,14 @@ return Class.create(/** @lends Tween.prototype */{ Statics: /** @lends Tween */ { /** + * @language=en * @private */ _tweens: [], /** - * 更新所有Tween实例。 + * @language=en + * Update all Tween instances. * @returns {Object} Tween。 */ tick: function(){ @@ -5448,8 +5560,9 @@ return Class.create(/** @lends Tween.prototype */{ }, /** - * 添加Tween实例。 - * @param {Tween} tween 要添加的Tween对象。 + * @language=en + * Add a Tween instance. + * @param {Tween} tween Tween object to add. * @returns {Object} Tween。 */ add: function(tween){ @@ -5459,8 +5572,9 @@ return Class.create(/** @lends Tween.prototype */{ }, /** - * 删除Tween实例。 - * @param {Tween|Object|Array} tweenOrTarget 要删除的Tween对象或target对象或要删除的一组对象。 + * @language=en + * Remove one Tween target. + * @param {Tween|Object|Array} tweenOrTarget Tween object, target object or an array of object to remove * @returns {Object} Tween。 */ remove: function(tweenOrTarget){ @@ -5488,7 +5602,8 @@ return Class.create(/** @lends Tween.prototype */{ }, /** - * 删除所有Tween实例。 + * @language=en + * Remove all Tween instances. * @returns {Object} Tween。 */ removeAll: function(){ @@ -5497,12 +5612,13 @@ return Class.create(/** @lends Tween.prototype */{ }, /** - * 创建一个缓动动画,让目标对象从开始属性变换到目标属性。 - * @param {Object|Array} target 缓动目标对象或缓动目标数组。 - * @param fromProps 缓动目标对象的开始属性。 - * @param toProps 缓动目标对象的目标属性。 - * @param params 缓动动画的参数。 - * @returns {Tween|Array} 一个Tween实例对象或Tween实例数组。 + * @language=en + * Create a tween, make target object easing from beginning properties to ending properties. + * @param {Object|Array} target Tweening target or tweening target array. + * @param fromProps Beginning properties of target tweening object. + * @param toProps Ending properties of target tweening object. + * @param params Tweening parameters. + * @returns {Tween|Array} An tween instance or an array of tween instance. */ fromTo: function(target, fromProps, toProps, params){ var isArray = target instanceof Array; @@ -5520,22 +5636,24 @@ return Class.create(/** @lends Tween.prototype */{ }, /** - * 创建一个缓动动画,让目标对象从当前属性变换到目标属性。 - * @param {Object|Array} target 缓动目标对象或缓动目标数组。 - * @param toProps 缓动目标对象的目标属性。 - * @param params 缓动动画的参数。 - * @returns {Tween|Array} 一个Tween实例对象或Tween实例数组。 + * @language=en + * Create a tween, make target object easing from current properties to ending properties. + * @param {Object|Array} target Tweening target or tweening target array. + * @param toProps Ending properties of target tweening object. + * @param params Tweening parameters. + * @returns {Tween|Array} An tween instance or an array of tween instance. */ to: function(target, toProps, params){ return Tween.fromTo(target, null, toProps, params); }, /** - * 创建一个缓动动画,让目标对象从指定的起始属性变换到当前属性。 - * @param {Object|Array} target 缓动目标对象或缓动目标数组。 - * @param fromProps 缓动目标对象的目标属性。 - * @param params 缓动动画的参数。 - * @returns {Tween|Array} 一个Tween实例对象或Tween实例数组。 + * @language=en + * Create a tween, make target object easing from beginning properties to current properties. + * @param {Object|Array} target Tweening target or tweening target array. + * @param fromProps Beginning properties of target tweening object. + * @param params Tweening parameters. + * @returns {Tween|Array} An tween instance or an array of tween instance. */ from: function(target, fromProps, params){ return Tween.fromTo(target, fromProps, null, params); @@ -5546,24 +5664,22 @@ return Class.create(/** @lends Tween.prototype */{ })(); + return Tween; }); /** - * Hilo 1.0.0 for cmd + * Hilo 1.0.1 for cmd * Copyright 2016 alibaba.com * Licensed under the MIT License */ define(function(require, exports, module){ -/** - * Hilo - * Copyright 2015 alibaba.com - * Licensed under the MIT License - */ + /** - * @class Ease类包含为Tween类提供各种缓动功能的函数。 + * @language=en + * @class Ease class provides multiple easing functions for Tween. * @module hilo/tween/Ease * @static */ @@ -5579,14 +5695,16 @@ function createEase(obj, easeInFn, easeOutFn, easeInOutFn, easeNoneFn){ } /** - * 线性匀速缓动函数。包含EaseNone函数。 + * @language=en + * Linear easing function.Include EaseNone. */ var Linear = createEase(null, null, null, null, function(k){ return k; }); /** - * 二次缓动函数。包含EaseIn、EaseOut、EaseInOut三个函数。 + * @language=en + * Quad easing function.Include EaseIn, EaseOut, EaseInOut. */ var Quad = createEase(null, function(k){ @@ -5603,7 +5721,8 @@ var Quad = createEase(null, ); /** - * 三次缓动函数。包含EaseIn、EaseOut、EaseInOut三个函数。 + * @language=en + * Cubic easing function.Include EaseIn, EaseOut, EaseInOut. */ var Cubic = createEase(null, function(k){ @@ -5620,7 +5739,8 @@ var Cubic = createEase(null, ); /** - * 四次缓动函数。包含EaseIn、EaseOut、EaseInOut三个函数。 + * @language=en + * Quart easing function.Include EaseIn, EaseOut, EaseInOut. */ var Quart = createEase(null, function(k){ @@ -5637,7 +5757,8 @@ var Quart = createEase(null, ); /** - * 五次缓动函数。包含EaseIn、EaseOut、EaseInOut三个函数。 + * @language=en + * Quint easing function.Include EaseIn, EaseOut, EaseInOut. */ var Quint = createEase(null, function(k){ @@ -5659,7 +5780,8 @@ var math = Math, pow = math.pow, sqrt = math.sqrt; /** - * 正弦缓动函数。包含EaseIn、EaseOut、EaseInOut三个函数。 + * @language=en + * Sine easing function.Include EaseIn, EaseOut, EaseInOut. */ var Sine = createEase(null, function(k){ @@ -5676,7 +5798,8 @@ var Sine = createEase(null, ); /** - * 指数缓动函数。包含EaseIn、EaseOut、EaseInOut三个函数。 + * @language=en + * Expo easing function.Include EaseIn, EaseOut, EaseInOut. */ var Expo = createEase(null, function(k){ @@ -5695,7 +5818,8 @@ var Expo = createEase(null, ); /** - * 圆形缓动函数。包含EaseIn、EaseOut、EaseInOut三个函数。 + * @language=en + * Circ easing function.Include EaseIn, EaseOut, EaseInOut. */ var Circ = createEase(null, function(k){ @@ -5713,7 +5837,8 @@ var Circ = createEase(null, ); /** - * 弹性缓动函数。包含EaseIn、EaseOut、EaseInOut三个函数。 + * @language=en + * Elastic easing function.Include EaseIn, EaseOut, EaseInOut. */ var Elastic = createEase( { @@ -5743,7 +5868,8 @@ var Elastic = createEase( ); /** - * 向后缓动函数。包含EaseIn、EaseOut、EaseInOut三个函数。 + * @language=en + * Back easing function.Include EaseIn, EaseOut, EaseInOut. */ var Back = createEase( { @@ -5770,7 +5896,8 @@ var Back = createEase( ); /** - * 弹跳缓动函数。包含EaseIn、EaseOut、EaseInOut三个函数。 + * @language=en + * Bounce easing function.Include EaseIn, EaseOut, EaseInOut. */ var Bounce = createEase(null, function(k){ @@ -5814,7 +5941,7 @@ return Ease; }); /** - * Hilo 1.0.0 for cmd + * Hilo 1.0.1 for cmd * Copyright 2016 alibaba.com * Licensed under the MIT License */ @@ -5822,15 +5949,12 @@ define(function(require, exports, module){ var Class = require('hilo/core/Class'); -/** - * Hilo - * Copyright 2015 alibaba.com - * Licensed under the MIT License - */ + /** + * @language=en * @private - * @class 图片资源加载器。 + * @class image resources loader. * @module hilo/loader/ImageLoader * @requires hilo/core/Class */ @@ -5870,7 +5994,7 @@ return ImageLoader; }); /** - * Hilo 1.0.0 for cmd + * Hilo 1.0.1 for cmd * Copyright 2016 alibaba.com * Licensed under the MIT License */ @@ -5878,15 +6002,12 @@ define(function(require, exports, module){ var Class = require('hilo/core/Class'); -/** - * Hilo - * Copyright 2015 alibaba.com - * Licensed under the MIT License - */ + /** + * @language=en * @private - * @class javascript或JSONP加载器。 + * @class javascript or JSONP loader * @module hilo/loader/ScriptLoader * @requires hilo/core/Class */ @@ -5941,7 +6062,7 @@ return ScriptLoader; }); /** - * Hilo 1.0.0 for cmd + * Hilo 1.0.1 for cmd * Copyright 2016 alibaba.com * Licensed under the MIT License */ @@ -5952,23 +6073,20 @@ var EventMixin = require('hilo/event/EventMixin'); var ImageLoader = require('hilo/loader/ImageLoader'); var ScriptLoader = require('hilo/loader/ScriptLoader'); -/** - * Hilo - * Copyright 2015 alibaba.com - * Licensed under the MIT License - */ + //TODO: 超时timeout,失败重连次数maxTries,更多的下载器Loader,队列暂停恢复等。 /** - * @class LoadQueue是一个队列下载工具。 - * @param {Object} source 要下载的资源。可以是单个资源对象或多个资源的数组。 + * @language=en + * @class LoadQueue is a queue-like loader. + * @param {Object} source ,resource that need to be loaded,could be a single object or array resource. * @module hilo/loader/LoadQueue * @requires hilo/core/Class * @requires hilo/event/EventMixin * @requires hilo/loader/ImageLoader * @requires hilo/loader/ScriptLoader - * @property {Int} maxConnections 同时下载的最大连接数。默认为2。 + * @property {Int} maxConnections ,the limited concurrent connections. default value 2. */ var LoadQueue = Class.create(/** @lends LoadQueue.prototype */{ Mixes: EventMixin, @@ -5985,15 +6103,16 @@ var LoadQueue = Class.create(/** @lends LoadQueue.prototype */{ _currentIndex: -1, /** - * 增加要下载的资源。可以是单个资源对象或多个资源的数组。 - * @param {Object|Array} source 资源对象或资源对象数组。每个资源对象包含以下属性: + * @language=en + * Add desired resource,could be a single object or array resource. + * @param {Object|Array} source ,a single object or array resource. Each resource contains properties like below: *
* var audio = WebSound.getAudio({ * src: 'test.mp3', @@ -6695,7 +6842,7 @@ var WebAudio = require('hilo/media/WebAudio'); * console.log('end'); * }).play(); *- * @class 声音播放管理器。 + * @class Audio playing manager. * @static * @module hilo/media/WebSound * @requires hilo/core/Hilo @@ -6706,7 +6853,8 @@ var WebSound = { _audios: {}, /** - * 激活音频功能。注意:需用户事件触发此方法才有效。目前仅对WebAudio有效。 + * @language=en + * Activate audio function. Note: Require user action events to activate. Currently support WebAudio. */ enableAudio: function(){ if(WebAudio.isSupported){ @@ -6715,9 +6863,10 @@ var WebSound = { }, /** - * 获取音频对象。优先使用WebAudio。 - * @param {String|Object} source 若source为String,则为音频src地址;若为Object,则需包含src属性。 - * @returns {WebAudio|HTMLAudio} 音频播放对象实例。 + * @language=en + * Get audio element. Use WebAudio if supported. + * @param {String|Object} source If String, it's the source of the audio; If Object, it should contains a src property. + * @returns {WebAudio|HTMLAudio} Audio playing instance. */ getAudio: function(source){ source = this._normalizeSource(source); @@ -6735,8 +6884,9 @@ var WebSound = { }, /** - * 删除音频对象。 - * @param {String|Object} source 若source为String,则为音频src地址;若为Object,则需包含src属性。 + * @language=en + * Remove audio element. + * @param {String|Object} source If String, it's the source of the audio; If Object, it should contains a src property. */ removeAudio: function(source){ var src = typeof source === 'string' ? source : source.src; @@ -6750,6 +6900,7 @@ var WebSound = { }, /** + * @language=en * @private */ _normalizeSource: function(source){ @@ -6765,7 +6916,7 @@ return WebSound; }); /** - * Hilo 1.0.0 for cmd + * Hilo 1.0.1 for cmd * Copyright 2016 alibaba.com * Licensed under the MIT License */ @@ -6774,24 +6925,21 @@ define(function(require, exports, module){ var Hilo = require('hilo/core/Hilo'); var Class = require('hilo/core/Class'); -/** - * Hilo - * Copyright 2015 alibaba.com - * Licensed under the MIT License - */ + /** - * @class Camera类表示摄像机。 - * @param {Object} properties 创建对象的属性参数。可包含此类所有可写属性。 + * @language=en + * @class Camera. + * @param {Object} properties The properties to create a view object, contains all writeable props of this class * @module hilo/game/Camera * @requires hilo/core/Hilo * @requires hilo/core/Class - * @property {Number} width 镜头宽 - * @property {Number} height 镜头高 - * @property {Object} scroll 滚动值 {x:0, y:0} - * @property {View} target 摄像机跟随的目标 - * @property {Array} bounds 摄像机移动边界的矩形区域 [x, y, width, height] - * @property {Array} deadzone 摄像机不移动的矩形区域 [ x, y, width, height] + * @property {Number} width The width of the camera. + * @property {Number} height The height of the camera. + * @property {Object} scroll The scrolling value of the camera {x:0, y:0}. + * @property {View} target The target that the camera follow. + * @property {Array} bounds The rect area where camera is allowed to move [x, y, width, height]. + * @property {Array} deadzone The rect area where camera isn't allowed to move[ x, y, width, height]. */ var Camera = Class.create(/** @lends Camera.prototype */{ constructor:function(properties){ @@ -6810,7 +6958,8 @@ var Camera = Class.create(/** @lends Camera.prototype */{ Hilo.copy(this, properties); }, /** - * 更新 + * @language=en + * update. * @param {Number} deltaTime */ tick:function(deltaTime){ @@ -6844,9 +6993,10 @@ var Camera = Class.create(/** @lends Camera.prototype */{ } }, /** - * 跟随目标 - * @param {Object} target 跟随的目标,必须是有x,y属性的对象 - * @param {Array} deadzone 摄像机不移动的矩形区域 [ x, y, width, height] + * @language=en + * Follow the target. + * @param {Object} target The target that the camera follow. It must has x and y properties. + * @param {Array} deadzone The rect area where camera isn't allowed to move[ x, y, width, height]. */ follow:function(target, deadzone){ this.target = target; @@ -6862,7 +7012,7 @@ return Camera; }); /** - * Hilo 1.0.0 for cmd + * Hilo 1.0.1 for cmd * Copyright 2016 alibaba.com * Licensed under the MIT License */ @@ -6871,48 +7021,45 @@ define(function(require, exports, module){ var Hilo = require('hilo/core/Hilo'); var Class = require('hilo/core/Class'); -/** - * Hilo - * Copyright 2015 alibaba.com - * Licensed under the MIT License - */ + /** - * @class Camera3d 伪3D虚拟摄像机。 + * @language=en + * @class Camera3d is a pseudo-3d camera. * @module hilo/game/Camera3d * @requires hilo/core/Hilo * @requires hilo/core/Class - * @property {Number} fv 镜头视点距离(屏幕视点相对眼睛距离,绝对了坐标缩放比例) - * @property {Number} fx 镜头视点X(屏幕视点相对屏幕左上角X距离) - * @property {Number} fy 镜头视点Y(屏幕视点相对屏幕左上角Y距离) - * @property {Object} stage 3D对象所在容器,可以是stage或container,结合ticker时是必须参数,用来Z深度排序 - * @property {Number} x 镜头三维坐标x - * @property {Number} y 镜头三维坐标y - * @property {Number} z 镜头三维坐标z - * @property {Number} rotationX X轴旋转角度 - * @property {Number} rotationY Y轴旋转角度 - * @property {Number} rotationZ Z轴旋转角度 + * @property {Number} fv The distance of the fov(The distance between eyes and the Z plane,it determines the scale ratio of the 3d object). + * @property {Number} fx The x position of the screen viewpoint(The distance between the screen viewpoint and the screen left top corner on the x axis). + * @property {Number} fy The y position of the screen viewpoint(The distance between the screen viewpoint and the screen left top corner on the y axis). + * @property {Object} stage The 3d object's container, it can be stage or container.It is required if you need to sort the 3d object by z axis. + * @property {Number} x The x position. + * @property {Number} y The y position. + * @property {Number} z The z position. + * @property {Number} rotationX The x rotation. + * @property {Number} rotationY The y rotation. + * @property {Number} rotationZ The z rotation. */ var Camera3d = (function(){ var degtorad = Math.PI / 180; - //向量旋转 - function rotateX(x, y, z, ca, sa) {//绕X轴旋转 + //Rotate the axis. + function rotateX(x, y, z, ca, sa) {//rotate x return { x: x, y: y * ca - z * sa, z: y * sa + z * ca }; } - function rotateY(x, y, z, ca, sa) {//绕Y轴旋转 + function rotateY(x, y, z, ca, sa) {//rotate y return { x: x * ca - z * sa, y: y, z: x * sa + z * ca }; } - function rotateZ(x, y, z, ca, sa) {//绕Z轴旋转 + function rotateZ(x, y, z, ca, sa) {//rotate z return { x: x * ca - y * sa, y: x * sa + y * ca, @@ -6934,10 +7081,11 @@ var Camera3d = (function(){ }, /** - * 仿射矩阵位移变换,不同于直接修改Camera3d.x/y/z. 是在Camera3d依次做坐标位移 - 旋转变换 后,再加上一个位移变换。主要功能可以做Zoomin/out 功能 - * @param {Number} x坐标 - * @param {Number} y坐标 - * @param {Number} z坐标 + * @language=en + * Translate the camera,used for Zoomin/out feature. + * @param {Number} x The x position. + * @param {Number} y The y position. + * @param {Number} z The z position. */ translate : function(x,y,z){ this.tx = x; @@ -6946,33 +7094,38 @@ var Camera3d = (function(){ }, /** - * 旋转X轴方向角度,相当于欧拉角系统的 beta - * @param {Number} X旋转角度 + * @language=en + * Rotate by the x axis. + * @param {Number} angle The rotate degree. */ rotateX : function(angle){ this.rotationX = angle; }, /** - * 旋转Y轴方向角度,相当于欧拉角系统的 gamma - * @param {Number} Y旋转角度 + * @language=en + * Rotate by the y axis. + * @param {Number} angle The rotate degree. */ rotateY : function(angle){ this.rotationY = angle; }, /** - * 旋转Z轴方向角度,相当于欧拉角系统的 alpha - * @param {Number} Z旋转角度 + * @language=en + * Rotate by the z axis. + * @param {Number} angle The rotate degree. */ rotateZ : function(angle){ this.rotationZ = angle; }, /** - * 将三维坐标转换投影为二维坐标,同时返回Z轴深度,和投影显示的缩放比例 - * @param {object} 三维坐标对象 - * @param {object} Hilo.View对象,用于自动转换坐标 + * @language=en + * Project the 3d point to 2d point. + * @param {object} vector3D The 3d position, it must have x, y and z properties. + * @param {View} view The view related to the 3d position.It'll be auto translated by the 3d position. + * @returns {Object} The 2d object include z and scale properties, e.g.:{x:x, y:y, z:z, scale} */ project : function(vector3D, view){ @@ -6987,10 +7140,10 @@ var Camera3d = (function(){ // 旋转变换前的 仿射矩阵位移, dx = vector3D.x - this.x, dy = vector3D.y - this.y, - dz = vector3D.z - this.z, + dz = vector3D.z - this.z; // 旋转矩阵变换 - vector = rotateZ(dx, dy, dz, cosZ, sinZ); + var vector = rotateZ(dx, dy, dz, cosZ, sinZ); vector = rotateY(vector.x, vector.y, vector.z, cosY, sinY); vector = rotateX(vector.x, vector.y, vector.z, cosX, sinX); @@ -7003,24 +7156,27 @@ var Camera3d = (function(){ _x = vector.x * perspective, _y = -vector.y * perspective; - if(view) { - view.x = _x + this.fx; - view.y = _y + this.fy; - view.z = -vector.z; - view.scaleX = perspective; - view.scaleY = perspective; - } else { - return { - x : _x + this.fx, - y : _y + this.fy, - z : -vector.z, - scale : perspective - }; + var result = { + x : _x + this.fx, + y : _y + this.fy, + z : -vector.z, + scale : perspective + }; + + if(view){ + view.x = result.x; + view.y = result.y; + view.z = result.z; + view.scaleX = result.scale; + view.scaleY = result.scale; } + + return result; }, /** - * Z深度排序 + * @language=en + * Sort by z axis. */ sortZ : function(){ this.stage.children.sort(function(view_a, view_b){ @@ -7029,7 +7185,8 @@ var Camera3d = (function(){ }, /** - * Ticker 轮询使用 + * @language=en + * Used for the ticker. */ tick : function(){ this.sortZ(); @@ -7045,7 +7202,7 @@ return Camera3d; }); /** - * Hilo 1.0.0 for cmd + * Hilo 1.0.1 for cmd * Copyright 2016 alibaba.com * Licensed under the MIT License */ @@ -7058,16 +7215,13 @@ var Container = require('hilo/view/Container'); var Bitmap = require('hilo/view/Bitmap'); var Drawable = require('hilo/view/Drawable'); -/** - * Hilo - * Copyright 2015 alibaba.com - * Licensed under the MIT License - */ + /** + * @language=en * *
* var Bird = Hilo.Class.create({ * Extends: Animal, @@ -34,23 +31,24 @@ define(function(require, exports, module){ * swallow.fly(); * Bird.isBird(swallow); *- * @namespace Class是提供类的创建的辅助工具。 + * @namespace Class Class is created to aid the developer. * @static * @module hilo/core/Class */ var Class = (function(){ /** - * 根据参数指定的属性和方法创建类。 - * @param {Object} properties 要创建的类的相关属性和方法。主要有: + * @language=en + * Create a class based on the parameters, properties and methods specified. + * @param {Object} properties Properties and methods to create the class. *
* var audio = WebSound.getAudio({ * src: 'test.mp3', @@ -30,7 +27,7 @@ var WebAudio = require('hilo/media/WebAudio'); * console.log('end'); * }).play(); *- * @class 声音播放管理器。 + * @class Audio playing manager. * @static * @module hilo/media/WebSound * @requires hilo/core/Hilo @@ -41,7 +38,8 @@ var WebSound = { _audios: {}, /** - * 激活音频功能。注意:需用户事件触发此方法才有效。目前仅对WebAudio有效。 + * @language=en + * Activate audio function. Note: Require user action events to activate. Currently support WebAudio. */ enableAudio: function(){ if(WebAudio.isSupported){ @@ -50,9 +48,10 @@ var WebSound = { }, /** - * 获取音频对象。优先使用WebAudio。 - * @param {String|Object} source 若source为String,则为音频src地址;若为Object,则需包含src属性。 - * @returns {WebAudio|HTMLAudio} 音频播放对象实例。 + * @language=en + * Get audio element. Use WebAudio if supported. + * @param {String|Object} source If String, it's the source of the audio; If Object, it should contains a src property. + * @returns {WebAudio|HTMLAudio} Audio playing instance. */ getAudio: function(source){ source = this._normalizeSource(source); @@ -70,8 +69,9 @@ var WebSound = { }, /** - * 删除音频对象。 - * @param {String|Object} source 若source为String,则为音频src地址;若为Object,则需包含src属性。 + * @language=en + * Remove audio element. + * @param {String|Object} source If String, it's the source of the audio; If Object, it should contains a src property. */ removeAudio: function(source){ var src = typeof source === 'string' ? source : source.src; @@ -85,6 +85,7 @@ var WebSound = { }, /** + * @language=en * @private */ _normalizeSource: function(source){ diff --git a/build/cmd/hilo/media/WebSound.min.js b/build/cmd/hilo/media/WebSound.min.js index 0db48416..536395b1 100644 --- a/build/cmd/hilo/media/WebSound.min.js +++ b/build/cmd/hilo/media/WebSound.min.js @@ -1,5 +1,5 @@ /** - * Hilo 1.0.0 for cmd + * Hilo 1.0.1 for cmd * Copyright 2016 alibaba.com * Licensed under the MIT License */ diff --git a/build/cmd/hilo/renderer/CanvasRenderer.js b/build/cmd/hilo/renderer/CanvasRenderer.js index 72f23689..19b8228b 100644 --- a/build/cmd/hilo/renderer/CanvasRenderer.js +++ b/build/cmd/hilo/renderer/CanvasRenderer.js @@ -1,5 +1,5 @@ /** - * Hilo 1.0.0 for cmd + * Hilo 1.0.1 for cmd * Copyright 2016 alibaba.com * Licensed under the MIT License */ @@ -9,21 +9,18 @@ var Class = require('hilo/core/Class'); var Hilo = require('hilo/core/Hilo'); var Renderer = require('hilo/renderer/Renderer'); -/** - * Hilo - * Copyright 2015 alibaba.com - * Licensed under the MIT License - */ + /** - * @class canvas画布渲染器。所有可视对象将渲染在canvas画布上。舞台Stage会根据参数canvas选择不同的渲染器,开发者无需直接使用此类。 + * @language=en + * @class CanvasRenderer CanvasRenderer, all the visual object is drawing on the canvas element.The stage will create different renderer depend on the canvas and renderType properties, developer need not use this class directly. * @augments Renderer - * @param {Object} properties 创建对象的属性参数。可包含此类所有可写属性。 + * @param {Object} properties The properties to create a renderer, contains all writeable props of this class. * @module hilo/renderer/CanvasRenderer * @requires hilo/core/Class * @requires hilo/core/Hilo * @requires hilo/renderer/Renderer - * @property {CanvasRenderingContext2D} context canvas画布的上下文。只读属性。 + * @property {CanvasRenderingContext2D} context The context of the canvas element, readonly. */ var CanvasRenderer = Class.create(/** @lends CanvasRenderer.prototype */{ Extends: Renderer, @@ -68,7 +65,7 @@ var CanvasRenderer = Class.create(/** @lends CanvasRenderer.prototype */{ var drawable = target.drawable, image = drawable && drawable.image; if(image){ var rect = drawable.rect, sw = rect[2], sh = rect[3], offsetX = rect[4], offsetY = rect[5]; - //ie9+浏览器宽高为0时会报错 + //ie9+浏览器宽高为0时会报错 fixed ie9 bug. if(!sw || !sh){ return; } diff --git a/build/cmd/hilo/renderer/CanvasRenderer.min.js b/build/cmd/hilo/renderer/CanvasRenderer.min.js index be4afd4e..5415a9c8 100644 --- a/build/cmd/hilo/renderer/CanvasRenderer.min.js +++ b/build/cmd/hilo/renderer/CanvasRenderer.min.js @@ -1,6 +1,6 @@ /** - * Hilo 1.0.0 for cmd + * Hilo 1.0.1 for cmd * Copyright 2016 alibaba.com * Licensed under the MIT License */ -define(function(e,t,a){var r=e("hilo/core/Class"),i=e("hilo/core/Hilo"),n=e("hilo/renderer/Renderer"),s=r.create({Extends:n,constructor:function(e){s.superclass.constructor.call(this,e),this.context=this.canvas.getContext("2d")},renderType:"canvas",context:null,startDraw:function(e){return e.visible&&e.alpha>0?(e===this.stage&&this.context.clearRect(0,0,e.width,e.height),this.context.save(),!0):!1},draw:function(e){var t=this.context,a=e.width,r=e.height,i=e.background;i&&(t.fillStyle=i,t.fillRect(0,0,a,r));var n=e.drawable,s=n&&n.image;if(s){var c=n.rect,h=c[2],l=c[3],o=c[4],d=c[5];if(!h||!l)return;a||r||(a=e.width=h,r=e.height=l),(o||d)&&t.translate(o-.5*h,d-.5*l),t.drawImage(s,c[0],c[1],h,l,0,0,a,r)}},endDraw:function(e){this.context.restore()},transform:function(e){var t=e.drawable;if(t&&t.domElement)return void i.setElementStyleByView(e);var a=this.context,r=e.scaleX,n=e.scaleY;if(e===this.stage){var s=this.canvas.style,c=e._scaleX,h=e._scaleY;(!c&&1!=r||c&&c!=r)&&(e._scaleX=r,s.width=r*e.width+"px"),(!h&&1!=n||h&&h!=n)&&(e._scaleY=n,s.height=n*e.height+"px")}else{var l=e.x,o=e.y,d=e.pivotX,v=e.pivotY,f=e.rotation%360,u=e.mask;u&&(u._render(this),a.clip());var g=e.align;if(g)if("function"==typeof g)e.align();else{var w=e.parent;if(w){var b=e.width,p=e.height,x=w.width,m=w.height;switch(g){case"TL":l=0,o=0;break;case"T":l=x-b>>1,o=0;break;case"TR":l=x-b,o=0;break;case"L":l=0,o=m-p>>1;break;case"C":l=x-b>>1,o=m-p>>1;break;case"R":l=x-b,o=m-p>>1;break;case"BL":l=0,o=m-p;break;case"B":l=x-b>>1,o=m-p;break;case"BR":l=x-b,o=m-p}}}(0!=l||0!=o)&&a.translate(l,o),0!=f&&a.rotate(f*Math.PI/180),(1!=r||1!=n)&&a.scale(r,n),(0!=d||0!=v)&&a.translate(-d,-v)}e.alpha>0&&(a.globalAlpha*=e.alpha)},remove:function(e){var t=e.drawable,a=t&&t.domElement;if(a){var r=a.parentNode;r&&r.removeChild(a)}},clear:function(e,t,a,r){this.context.clearRect(e,t,a,r)},resize:function(e,t){this.canvas.width=e,this.canvas.height=t}});return s}); \ No newline at end of file +define(function(e,t,a){var r=e("hilo/core/Class"),i=e("hilo/core/Hilo"),n=e("hilo/renderer/Renderer"),s=r.create({Extends:n,constructor:function(e){s.superclass.constructor.call(this,e),this.context=this.canvas.getContext("2d")},renderType:"canvas",context:null,startDraw:function(e){return e.visible&&e.alpha>0?(e===this.stage&&this.context.clearRect(0,0,e.width,e.height),this.context.save(),!0):!1},draw:function(e){var t=this.context,a=e.width,r=e.height,i=e.background;i&&(t.fillStyle=i,t.fillRect(0,0,a,r));var n=e.drawable,s=n&&n.image;if(s){var c=n.rect,h=c[2],l=c[3],o=c[4],d=c[5];if(!h||!l)return;a||r||(a=e.width=h,r=e.height=l),(o||d)&&t.translate(o-.5*h,d-.5*l),t.drawImage(s,c[0],c[1],h,l,0,0,a,r)}},endDraw:function(e){this.context.restore()},transform:function(e){var t=e.drawable;if(t&&t.domElement)return void i.setElementStyleByView(e);var a=this.context,r=e.scaleX,n=e.scaleY;if(e===this.stage){var s=this.canvas.style,c=e._scaleX,h=e._scaleY;(!c&&1!=r||c&&c!=r)&&(e._scaleX=r,s.width=r*e.width+"px"),(!h&&1!=n||h&&h!=n)&&(e._scaleY=n,s.height=n*e.height+"px")}else{var l=e.x,o=e.y,d=e.pivotX,v=e.pivotY,f=e.rotation%360,u=e.mask;u&&(u._render(this),a.clip());var g=e.align;if(g)if("function"==typeof g)e.align();else{var w=e.parent;if(w){var b=e.width,p=e.height,x=w.width,m=w.height;switch(g){case"TL":l=0,o=0;break;case"T":l=x-b>>1,o=0;break;case"TR":l=x-b,o=0;break;case"L":l=0,o=m-p>>1;break;case"C":l=x-b>>1,o=m-p>>1;break;case"R":l=x-b,o=m-p>>1;break;case"BL":l=0,o=m-p;break;case"B":l=x-b>>1,o=m-p;break;case"BR":l=x-b,o=m-p}}}0==l&&0==o||a.translate(l,o),0!=f&&a.rotate(f*Math.PI/180),1==r&&1==n||a.scale(r,n),0==d&&0==v||a.translate(-d,-v)}e.alpha>0&&(a.globalAlpha*=e.alpha)},remove:function(e){var t=e.drawable,a=t&&t.domElement;if(a){var r=a.parentNode;r&&r.removeChild(a)}},clear:function(e,t,a,r){this.context.clearRect(e,t,a,r)},resize:function(e,t){this.canvas.width=e,this.canvas.height=t}});return s}); \ No newline at end of file diff --git a/build/cmd/hilo/renderer/DOMRenderer.js b/build/cmd/hilo/renderer/DOMRenderer.js index a3d193de..5f9a6d99 100644 --- a/build/cmd/hilo/renderer/DOMRenderer.js +++ b/build/cmd/hilo/renderer/DOMRenderer.js @@ -1,5 +1,5 @@ /** - * Hilo 1.0.0 for cmd + * Hilo 1.0.1 for cmd * Copyright 2016 alibaba.com * Licensed under the MIT License */ @@ -10,16 +10,13 @@ var Hilo = require('hilo/core/Hilo'); var Renderer = require('hilo/renderer/Renderer'); var Drawable = require('hilo/view/Drawable'); -/** - * Hilo - * Copyright 2015 alibaba.com - * Licensed under the MIT License - */ + /** - * @class DOM+CSS3渲染器。将可视对象以DOM元素方式渲染出来。舞台Stage会根据参数canvas选择不同的渲染器,开发者无需直接使用此类。 + * @language=en + * @class DomRenderer The DomRenderer, all the visual object is drawing using dom element.The stage will create different renderer depend on the canvas and renderType properties, developer need not use this class directly. * @augments Renderer - * @param {Object} properties 创建对象的属性参数。可包含此类所有可写属性。 + * @param {Object} properties The properties to create a renderer, contains all writeable props of this class. * @module hilo/renderer/DOMRenderer * @requires hilo/core/Class * @requires hilo/core/Hilo @@ -138,10 +135,11 @@ return Class.create({ }); /** - * 创建一个可渲染的DOM,可指定tagName,如canvas或div。 - * @param {Object} view 一个可视对象或类似的对象。 - * @param {Object} imageObj 指定渲染的image及相关设置,如绘制区域rect。 - * @return {HTMLElement} 新创建的DOM对象。 + * @language=en + * Create a dom element, you can set the tagName property,such as canvas and div. + * @param {Object} view A visual object. + * @param {Object} imageObj The image object to render, include the image propertiy and other associated properties, such as rect. + * @return {HTMLElement} The created dom element. * @private */ function createDOMDrawable(view, imageObj){ diff --git a/build/cmd/hilo/renderer/DOMRenderer.min.js b/build/cmd/hilo/renderer/DOMRenderer.min.js index 8eefe56d..82a535fc 100644 --- a/build/cmd/hilo/renderer/DOMRenderer.min.js +++ b/build/cmd/hilo/renderer/DOMRenderer.min.js @@ -1,5 +1,5 @@ /** - * Hilo 1.0.0 for cmd + * Hilo 1.0.1 for cmd * Copyright 2016 alibaba.com * Licensed under the MIT License */ diff --git a/build/cmd/hilo/renderer/Renderer.js b/build/cmd/hilo/renderer/Renderer.js index f08161d6..332ade94 100644 --- a/build/cmd/hilo/renderer/Renderer.js +++ b/build/cmd/hilo/renderer/Renderer.js @@ -1,5 +1,5 @@ /** - * Hilo 1.0.0 for cmd + * Hilo 1.0.1 for cmd * Copyright 2016 alibaba.com * Licensed under the MIT License */ @@ -8,21 +8,18 @@ define(function(require, exports, module){ var Hilo = require('hilo/core/Hilo'); var Class = require('hilo/core/Class'); -/** - * Hilo - * Copyright 2015 alibaba.com - * Licensed under the MIT License - */ + /** - * @class 渲染器抽象基类。 - * @param {Object} properties 创建对象的属性参数。可包含此类所有可写属性。 + * @language=en + * @class Renderer Renderer is the base class of renderer. + * @param {Object} properties The properties to create a renderer, contains all writeable props of this class. * @module hilo/renderer/Renderer * @requires hilo/core/Hilo * @requires hilo/core/Class - * @property {Object} canvas 渲染器对应的画布。它可能是一个普通的DOM元素,比如div,也可以是一个canvas画布元素。只读属性。 - * @property {Object} stage 渲染器对应的舞台。只读属性。 - * @property {String} renderType 渲染方式。只读属性。 + * @property {Object} canvas The canvas of renderer. It can be a dom element, such as a div element, or a canvas element. readonly. + * @property {Object} stage The stage of renderer, readonly. + * @property {String} renderType The render type of renderer, readonly. */ var Renderer = Class.create(/** @lends Renderer.prototype */{ constructor: function(properties){ @@ -35,52 +32,60 @@ var Renderer = Class.create(/** @lends Renderer.prototype */{ stage: null, /** - * 为开始绘制可视对象做准备。需要子类来实现。 - * @param {View} target 要绘制的可视对象。 + * @language=en + * Prepare for draw visual object. The subclass need to implement it. + * @param {View} target The visual target to draw. */ startDraw: function(target){ }, /** - * 绘制可视对象。需要子类来实现。 - * @param {View} target 要绘制的可视对象。 + * @language=en + * Draw the visual object. The subclass need to implement it. + * @param {View} target The visual target to draw. */ draw: function(target){ }, /** - * 结束绘制可视对象后的后续处理方法。需要子类来实现。 - * @param {View} target 要绘制的可视对象。 + * @language=en + * The handling method after draw the visual object. The subclass need to implement it. + * @param {View} target The visual target to draw. */ endDraw: function(target){ }, /** - * 对可视对象进行变换。需要子类来实现。 + * @language=en + * Transfrom the visual object. The subclass need to implement it. */ transform: function(){ }, /** - * 隐藏可视对象。需要子类来实现。 + * @language=en + * Hide the visual object. The subclass need to implement it. */ hide: function(){ }, /** - * 从画布中删除可视对象。注意:不是从stage中删除对象。需要子类来实现。 - * @param {View} target 要删除的可视对象。 + * @language=en + * Remove the visual object from canvas. Notice that it dosen't remove the object from stage. The subclass need to implement it. + * @param {View} target The visual target to remove. */ remove: function(target){ }, /** - * 清除画布指定区域。需要子类来实现。 - * @param {Number} x 指定区域的x轴坐标。 - * @param {Number} y 指定区域的y轴坐标。 - * @param {Number} width 指定区域的宽度。 - * @param {Number} height 指定区域的高度。 + * @language=en + * Clear the given region of canvas. The subclass need to implement it. + * @param {Number} x The position on the x axis of the given region. + * @param {Number} y The position on the y axis of the given region. + * @param {Number} width The width of the given region. + * @param {Number} height The height of the given region. */ clear: function(x, y, width, height){ }, /** - * 改变渲染器的画布大小。 - * @param {Number} width 指定渲染画布新的宽度。 - * @param {Number} height 指定渲染画布新的高度。 + * @language=en + * Resize the renderer's canvas. + * @param {Number} width The width of renderer's canvas. + * @param {Number} height The height of the renderer's canvas. */ resize: function(width, height){ } diff --git a/build/cmd/hilo/renderer/Renderer.min.js b/build/cmd/hilo/renderer/Renderer.min.js index 3e56c7e7..628befa0 100644 --- a/build/cmd/hilo/renderer/Renderer.min.js +++ b/build/cmd/hilo/renderer/Renderer.min.js @@ -1,5 +1,5 @@ /** - * Hilo 1.0.0 for cmd + * Hilo 1.0.1 for cmd * Copyright 2016 alibaba.com * Licensed under the MIT License */ diff --git a/build/cmd/hilo/renderer/WebGLRenderer.js b/build/cmd/hilo/renderer/WebGLRenderer.js index 3de6fc37..356364dc 100644 --- a/build/cmd/hilo/renderer/WebGLRenderer.js +++ b/build/cmd/hilo/renderer/WebGLRenderer.js @@ -1,5 +1,5 @@ /** - * Hilo 1.0.0 for cmd + * Hilo 1.0.1 for cmd * Copyright 2016 alibaba.com * Licensed under the MIT License */ @@ -9,11 +9,7 @@ var Class = require('hilo/core/Class'); var Renderer = require('hilo/renderer/Renderer'); var Matrix = require('hilo/geom/Matrix'); -/** - * Hilo - * Copyright 2015 alibaba.com - * Licensed under the MIT License - */ + /** * Heavily inspired by PIXI's SpriteRenderer: @@ -22,33 +18,37 @@ var Matrix = require('hilo/geom/Matrix'); var DEG2RAD = Math.PI / 180; /** - * @class webgl画布渲染器。所有可视对象将渲染在canvas画布上。 + * @language=en + * @class WebGLRenderer The WebGLRenderer, all the visual object is drawing on the canvas using WebGL.The stage will create different renderer depend on the canvas and renderType properties, developer need not use this class directly. * @augments Renderer - * @param {Object} properties 创建对象的属性参数。可包含此类所有可写属性。 + * @param {Object} properties The properties to create a renderer, contains all writeable props of this class. * @module hilo/renderer/WebGLRenderer * @requires hilo/core/Class * @requires hilo/renderer/Renderer * @requires hilo/geom/Matrix - * @property {WebGLRenderingContext} gl webgl上下文。只读属性。 + * @property {WebGLRenderingContext} gl The WebGL context of the renderer, readonly. */ var WebGLRenderer = Class.create(/** @lends WebGLRenderer.prototype */{ Extends: Renderer, Statics:/** @lends WebGLRenderer */{ /** - * 最大批渲染数量。 + * @language=en + * The max num of batch draw, default is 2000. * @type {Number} */ MAX_BATCH_NUM:2000, /** - * 顶点属性数。只读属性。 + * @language=en + * The num of vertex attributes, readonly. * @type {Number} */ ATTRIBUTE_NUM:5, /** - * 是否支持WebGL。只读属性。 + * @language=en + * is WebGL supported, readonly. * @type {Boolean} */ - isSupport:null + isSupported:null }, renderType:'webgl', gl:null, @@ -113,7 +113,6 @@ var WebGLRenderer = Class.create(/** @lends WebGLRenderer.prototype */{ } return false; }, - /** * @private * @see Renderer#draw @@ -404,6 +403,7 @@ var WebGLRenderer = Class.create(/** @lends WebGLRenderer.prototype */{ }); /** + * @language=en * shader * @param {WebGLRenderer} renderer [description] * @param {Object} source @@ -523,21 +523,15 @@ Shader.prototype = { } }; -WebGLRenderer.isSupport = function(){ - if(this._isSupport !== undefined){ - return this._isSupport; +WebGLRenderer.isSupported = (function(){ + var canvas = document.createElement('canvas'); + if(canvas.getContext && (canvas.getContext('webgl')||canvas.getContext('experimental-webgl'))){ + return true; } else{ - var canvas = document.createElement('canvas'); - if(canvas.getContext && (canvas.getContext('webgl')||canvas.getContext('experimental-webgl'))){ - this._isSupport = true; - } - else{ - this._isSupport = false; - } - return this._isSupport; + return false; } -}; +})(); return WebGLRenderer; diff --git a/build/cmd/hilo/renderer/WebGLRenderer.min.js b/build/cmd/hilo/renderer/WebGLRenderer.min.js index e82c7126..1c30dddb 100644 --- a/build/cmd/hilo/renderer/WebGLRenderer.min.js +++ b/build/cmd/hilo/renderer/WebGLRenderer.min.js @@ -1,6 +1,6 @@ /** - * Hilo 1.0.0 for cmd + * Hilo 1.0.1 for cmd * Copyright 2016 alibaba.com * Licensed under the MIT License */ -define(function(t,e,r){var i=t("hilo/core/Class"),a=t("hilo/renderer/Renderer"),n=t("hilo/geom/Matrix"),s=Math.PI/180,o=i.create({Extends:a,Statics:{MAX_BATCH_NUM:2e3,ATTRIBUTE_NUM:5,isSupport:null},renderType:"webgl",gl:null,constructor:function(t){window.__render=this,o.superclass.constructor.call(this,t);var e=this.gl=this.canvas.getContext("webgl")||this.canvas.getContext("experimental-webgl");this.maxBatchNum=o.MAX_BATCH_NUM,this.positionStride=4*o.ATTRIBUTE_NUM;var r=this.maxBatchNum*o.ATTRIBUTE_NUM*4,i=6*this.maxBatchNum;this.positions=new Float32Array(r),this.indexs=new Uint16Array(i);for(var a=0,n=0;i>a;a+=6,n+=4)this.indexs[a+0]=n+0,this.indexs[a+1]=n+1,this.indexs[a+2]=n+2,this.indexs[a+3]=n+1,this.indexs[a+4]=n+2,this.indexs[a+5]=n+3;this.batchIndex=0,this.sprites=[],e.blendFunc(e.ONE,e.ONE_MINUS_SRC_ALPHA),e.clearColor(0,0,0,0),e.disable(e.DEPTH_TEST),e.disable(e.CULL_FACE),e.enable(e.BLEND),this._initShaders(),this.defaultShader.active(),this.positionBuffer=e.createBuffer(),this.indexBuffer=e.createBuffer(),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,this.indexBuffer),e.bufferData(e.ELEMENT_ARRAY_BUFFER,this.indexs,e.STATIC_DRAW),e.bindBuffer(e.ARRAY_BUFFER,this.positionBuffer),e.bufferData(e.ARRAY_BUFFER,this.positions,e.DYNAMIC_DRAW),e.vertexAttribPointer(this.a_position,2,e.FLOAT,!1,this.positionStride,0),e.vertexAttribPointer(this.a_TexCoord,2,e.FLOAT,!1,this.positionStride,8),e.vertexAttribPointer(this.a_alpha,1,e.FLOAT,!1,this.positionStride,16)},context:null,startDraw:function(t){return t.visible&&t.alpha>0?(t===this.stage&&this.clear(),!0):!1},draw:function(t){var e=(this.context,t.width),r=t.height,i=(t.background,t.drawable),a=i&&i.image;if(a){this.gl;a.texture||this.activeShader.uploadTexture(a);var n=i.rect,s=n[2],o=n[3];n[4],n[5];e||r||(e=t.width=s,r=t.height=o),this.batchIndex>=this.maxBatchNum&&this._renderBatches();var h=this._createVertexs(a,n[0],n[1],s,o,0,0,e,r),l=this.batchIndex*this.positionStride,_=this.positions,d=t.__webglRenderAlpha;_[l+0]=h[0],_[l+1]=h[1],_[l+2]=h[2],_[l+3]=h[3],_[l+4]=d,_[l+5]=h[4],_[l+6]=h[5],_[l+7]=h[6],_[l+8]=h[7],_[l+9]=d,_[l+10]=h[8],_[l+11]=h[9],_[l+12]=h[10],_[l+13]=h[11],_[l+14]=d,_[l+15]=h[12],_[l+16]=h[13],_[l+17]=h[14],_[l+18]=h[15],_[l+19]=d;for(var c=t.__webglWorldMatrix,u=0;4>u;u++){var f=_[l+5*u],p=_[l+5*u+1];_[l+5*u]=c.a*f+c.c*p+c.tx,_[l+5*u+1]=c.b*f+c.d*p+c.ty}t.texture=a.texture,this.sprites[this.batchIndex++]=t}},endDraw:function(t){t===this.stage&&this._renderBatches()},transform:function(t){var e=t.drawable;if(e&&e.domElement)return void Hilo.setElementStyleByView(t);var r=(this.context,t.scaleX),i=t.scaleY;if(t===this.stage){var a=this.canvas.style,s=t._scaleX,o=t._scaleY;(!s&&1!=r||s&&s!=r)&&(t._scaleX=r,a.width=r*t.width+"px"),(!o&&1!=i||o&&o!=i)&&(t._scaleY=i,a.height=i*t.height+"px"),t.__webglWorldMatrix=t.__webglWorldMatrix||new n(1,0,0,1,0,0)}else t.__webglWorldMatrix=t.__webglWorldMatrix||new n(1,0,0,1,0,0),this._setConcatenatedMatrix(t,t.parent);t.alpha>0&&(t.parent&&t.parent.__webglRenderAlpha?t.__webglRenderAlpha=t.alpha*t.parent.__webglRenderAlpha:t.__webglRenderAlpha=t.alpha)},remove:function(t){var e=t.drawable,r=e&&e.domElement;if(r){var i=r.parentNode;i&&i.removeChild(r)}},clear:function(t,e,r,i){this.gl.clear(this.gl.COLOR_BUFFER_BIT)},resize:function(t,e){(this.width!==t||this.height!==e)&&(this.width=this.canvas.width=t,this.height=this.canvas.height=e,this.gl.viewport(0,0,t,e),this.canvasHalfWidth=.5*t,this.canvasHalfHeight=.5*e,this._uploadProjectionTransform(!0))},_renderBatches:function(){var t=this.gl;t.bufferSubData(t.ARRAY_BUFFER,0,this.positions.subarray(0,this.batchIndex*this.positionStride));for(var e=0,r=0,i=null,a=0;a
- * ticker.addTick(Hilo.Tween);//需要把Tween加到ticker里才能使用 + * ticker.addTick(Hilo.Tween);//Tween works after being added to ticker * * var view = new View({x:5, y:10}); * Hilo.Tween.to(view, { @@ -34,26 +31,26 @@ var Class = require('hilo/core/Class'); * } * }); *- * @class Tween类提供缓动功能。 - * @param {Object} target 缓动对象。 - * @param {Object} fromProps 对象缓动的起始属性集合。 - * @param {Object} toProps 对象缓动的目标属性集合。 - * @param {Object} params 缓动参数。可包含Tween类所有可写属性。 + * @class Tween class makes tweening (easing, slow motion). + * @param {Object} target Tween target object. + * @param {Object} fromProps Beginning properties of target tweening object. + * @param {Object} toProps Ending properties of target tweening object. + * @param {Object} params Tweening parameters, include all writable Tween class properties. * @module hilo/tween/Tween * @requires hilo/core/Class - * @property {Object} target 缓动目标。只读属性。 - * @property {Int} duration 缓动总时长。单位毫秒。 - * @property {Int} delay 缓动延迟时间。单位毫秒。 - * @property {Boolean} paused 缓动是否暂停。默认为false。 - * @property {Boolean} loop 缓动是否循环。默认为false。 - * @property {Boolean} reverse 缓动是否反转播放。默认为false。 - * @property {Int} repeat 缓动重复的次数。默认为0。 - * @property {Int} repeatDelay 缓动重复的延迟时长。单位为毫秒。 - * @property {Function} ease 缓动变化函数。默认为null。 - * @property {Int} time 缓动已进行的时长。单位毫秒。只读属性。 - * @property {Function} onStart 缓动开始回调函数。它接受1个参数:tween。默认值为null。 - * @property {Function} onUpdate 缓动更新回调函数。它接受2个参数:ratio和tween。默认值为null。 - * @property {Function} onComplete 缓动结束回调函数。它接受1个参数:tween。默认值为null。 + * @property {Object} target Tween target object, readonly! + * @property {Int} duration Tweening duration, measure in ms. + * @property {Int} delay Tweenning delay time, measure in ms. + * @property {Boolean} paused Is tweening paused, default value is false. + * @property {Boolean} loop Does tweening loop, default value is false. + * @property {Boolean} reverse Does tweening reverse, default value is false. + * @property {Int} repeat Repeat times of tweening, default value is 0. + * @property {Int} repeatDelay Delay time of repeating tweening, measure in ms. + * @property {Function} ease Tweening transform function, default value is null. + * @property {Int} time Time that tweening taken, measure in ms, readonly! + * @property {Function} onStart Function invoked on the beginning of tweening. Require 1 parameter: tween. default value is null. + * @property {Function} onUpdate Function invoked on tweening update. Require 2 parameters: ratio, tween. default value is null. + * @property {Function} onComplete Function invoked on the end of tweening. Require 1 parameter: tween. default value is null. */ var Tween = (function(){ @@ -106,10 +103,11 @@ return Class.create(/** @lends Tween.prototype */{ onComplete: null, /** - * 设置缓动对象的初始和目标属性。 - * @param {Object} fromProps 缓动对象的初始属性。 - * @param {Object} toProps 缓动对象的目标属性。 - * @returns {Tween} Tween变换本身。可用于链式调用。 + * @language=en + * Set beginning properties and ending properties of tweening object. + * @param {Object} fromProps Beginning properties of target tweening object. + * @param {Object} toProps Ending properties of target tweening object. + * @returns {Tween} Current Tween, for chain calls. */ setProps: function(fromProps, toProps){ var me = this, target = me.target, @@ -127,8 +125,9 @@ return Class.create(/** @lends Tween.prototype */{ }, /** - * 启动缓动动画的播放。 - * @returns {Tween} Tween变换本身。可用于链式调用。 + * @language=en + * Starting the tweening. + * @returns {Tween} Current Tween, for chain calls. */ start: function(){ var me = this; @@ -141,8 +140,9 @@ return Class.create(/** @lends Tween.prototype */{ }, /** - * 停止缓动动画的播放。 - * @returns {Tween} Tween变换本身。可用于链式调用。 + * @language=en + * Stop the tweening. + * @returns {Tween} Current Tween, for chain calls. */ stop: function(){ Tween.remove(this); @@ -150,8 +150,9 @@ return Class.create(/** @lends Tween.prototype */{ }, /** - * 暂停缓动动画的播放。 - * @returns {Tween} Tween变换本身。可用于链式调用。 + * @language=en + * Pause the tweening. + * @returns {Tween} Current Tween, for chain calls. */ pause: function(){ var me = this; @@ -161,8 +162,9 @@ return Class.create(/** @lends Tween.prototype */{ }, /** - * 恢复缓动动画的播放。 - * @returns {Tween} Tween变换本身。可用于链式调用。 + * @language=en + * Continue to play the tweening. + * @returns {Tween} Current Tween, for chain calls. */ resume: function(){ var me = this; @@ -173,10 +175,11 @@ return Class.create(/** @lends Tween.prototype */{ }, /** - * 跳转Tween到指定的时间。 - * @param {Number} time 指定要跳转的时间。取值范围为:0 - duraion。 - * @param {Boolean} pause 是否暂停。 - * @returns {Tween} Tween变换本身。可用于链式调用。 + * @language=en + * Tween jumps to some point. + * @param {Number} time The time to jump to, range from 0 to duration. + * @param {Boolean} pause Is paused. + * @returns {Tween} Current Tween, for chain calls. */ seek: function(time, pause){ var me = this, current = now(); @@ -190,9 +193,10 @@ return Class.create(/** @lends Tween.prototype */{ }, /** - * 连接下一个Tween变换。其开始时间根据delay值不同而不同。当delay值为字符串且以'+'或'-'开始时,Tween的开始时间从当前变换结束点计算,否则以当前变换起始点计算。 - * @param {Tween} tween 要连接的Tween变换。 - * @returns {Tween} Tween变换本身。可用于链式调用。 + * @language=en + * Link next Tween. The beginning time of next Tween depends on the delay value. If delay is a string that begins with '+' or '-', next Tween will begin at (delay) ms after or before the current tween is ended. If delay is out of previous situation, next Tween will begin at (delay) ms after the beginning point of current Tween. + * @param {Tween} tween Tween to link. + * @returns {Tween} Current Tween, for chain calls. */ link: function(tween){ var me = this, delay = tween.delay, startTime = me._startTime; @@ -210,7 +214,8 @@ return Class.create(/** @lends Tween.prototype */{ }, /** - * Tween类的内部渲染方法。 + * @language=en + * Private render method inside Tween class. * @private */ _render: function(ratio){ @@ -219,7 +224,8 @@ return Class.create(/** @lends Tween.prototype */{ }, /** - * Tween类的内部更新方法。 + * @language=en + * Private update method inside Tween class. * @private */ _update: function(time, forceUpdate){ @@ -296,12 +302,14 @@ return Class.create(/** @lends Tween.prototype */{ Statics: /** @lends Tween */ { /** + * @language=en * @private */ _tweens: [], /** - * 更新所有Tween实例。 + * @language=en + * Update all Tween instances. * @returns {Object} Tween。 */ tick: function(){ @@ -318,8 +326,9 @@ return Class.create(/** @lends Tween.prototype */{ }, /** - * 添加Tween实例。 - * @param {Tween} tween 要添加的Tween对象。 + * @language=en + * Add a Tween instance. + * @param {Tween} tween Tween object to add. * @returns {Object} Tween。 */ add: function(tween){ @@ -329,8 +338,9 @@ return Class.create(/** @lends Tween.prototype */{ }, /** - * 删除Tween实例。 - * @param {Tween|Object|Array} tweenOrTarget 要删除的Tween对象或target对象或要删除的一组对象。 + * @language=en + * Remove one Tween target. + * @param {Tween|Object|Array} tweenOrTarget Tween object, target object or an array of object to remove * @returns {Object} Tween。 */ remove: function(tweenOrTarget){ @@ -358,7 +368,8 @@ return Class.create(/** @lends Tween.prototype */{ }, /** - * 删除所有Tween实例。 + * @language=en + * Remove all Tween instances. * @returns {Object} Tween。 */ removeAll: function(){ @@ -367,12 +378,13 @@ return Class.create(/** @lends Tween.prototype */{ }, /** - * 创建一个缓动动画,让目标对象从开始属性变换到目标属性。 - * @param {Object|Array} target 缓动目标对象或缓动目标数组。 - * @param fromProps 缓动目标对象的开始属性。 - * @param toProps 缓动目标对象的目标属性。 - * @param params 缓动动画的参数。 - * @returns {Tween|Array} 一个Tween实例对象或Tween实例数组。 + * @language=en + * Create a tween, make target object easing from beginning properties to ending properties. + * @param {Object|Array} target Tweening target or tweening target array. + * @param fromProps Beginning properties of target tweening object. + * @param toProps Ending properties of target tweening object. + * @param params Tweening parameters. + * @returns {Tween|Array} An tween instance or an array of tween instance. */ fromTo: function(target, fromProps, toProps, params){ var isArray = target instanceof Array; @@ -390,22 +402,24 @@ return Class.create(/** @lends Tween.prototype */{ }, /** - * 创建一个缓动动画,让目标对象从当前属性变换到目标属性。 - * @param {Object|Array} target 缓动目标对象或缓动目标数组。 - * @param toProps 缓动目标对象的目标属性。 - * @param params 缓动动画的参数。 - * @returns {Tween|Array} 一个Tween实例对象或Tween实例数组。 + * @language=en + * Create a tween, make target object easing from current properties to ending properties. + * @param {Object|Array} target Tweening target or tweening target array. + * @param toProps Ending properties of target tweening object. + * @param params Tweening parameters. + * @returns {Tween|Array} An tween instance or an array of tween instance. */ to: function(target, toProps, params){ return Tween.fromTo(target, null, toProps, params); }, /** - * 创建一个缓动动画,让目标对象从指定的起始属性变换到当前属性。 - * @param {Object|Array} target 缓动目标对象或缓动目标数组。 - * @param fromProps 缓动目标对象的目标属性。 - * @param params 缓动动画的参数。 - * @returns {Tween|Array} 一个Tween实例对象或Tween实例数组。 + * @language=en + * Create a tween, make target object easing from beginning properties to current properties. + * @param {Object|Array} target Tweening target or tweening target array. + * @param fromProps Beginning properties of target tweening object. + * @param params Tweening parameters. + * @returns {Tween|Array} An tween instance or an array of tween instance. */ from: function(target, fromProps, params){ return Tween.fromTo(target, fromProps, null, params); @@ -416,6 +430,7 @@ return Class.create(/** @lends Tween.prototype */{ })(); + return Tween; }); \ No newline at end of file diff --git a/build/cmd/hilo/tween/Tween.min.js b/build/cmd/hilo/tween/Tween.min.js index 78e29199..6e34516a 100644 --- a/build/cmd/hilo/tween/Tween.min.js +++ b/build/cmd/hilo/tween/Tween.min.js @@ -1,5 +1,5 @@ /** - * Hilo 1.0.0 for cmd + * Hilo 1.0.1 for cmd * Copyright 2016 alibaba.com * Licensed under the MIT License */ diff --git a/build/cmd/hilo/util/TextureAtlas.js b/build/cmd/hilo/util/TextureAtlas.js index e4542aa9..8753186b 100644 --- a/build/cmd/hilo/util/TextureAtlas.js +++ b/build/cmd/hilo/util/TextureAtlas.js @@ -1,5 +1,5 @@ /** - * Hilo 1.0.0 for cmd + * Hilo 1.0.1 for cmd * Copyright 2016 alibaba.com * Licensed under the MIT License */ @@ -7,13 +7,10 @@ define(function(require, exports, module){ var Class = require('hilo/core/Class'); -/** - * Hilo - * Copyright 2015 alibaba.com - * Licensed under the MIT License - */ + /** + * @language=en * @class TextureAtlas纹理集是将许多小的纹理图片整合到一起的一张大图。这个类可根据一个纹理集数据读取纹理小图、精灵动画等。 * @param {Object} atlasData 纹理集数据。它可包含如下数据: *
* var bmp = new Bitmap({image:img}); * Hilo.copy(bmp, Hilo.drag); * bmp.startDrag([0, 0, 550, 400]); *- * @class drag是一个包含拖拽功能的mixin。可以通过 Class.mix(view, drag)或Hilo.copy(view, drag)来为view增加拖拽功能。 + * @class drag A mixin that contains drag method.You can mix drag method to the visual target by use Class.mix(target, drag) or Hilo.copy(target, drag). * @mixin * @static * @module hilo/util/drag @@ -32,8 +29,9 @@ var Hilo = require('hilo/core/Hilo'); */ var drag = { /** - * 开始拖拽 - * @param {Array} bounds 拖拽范围,基于父容器坐标系,[x, y, width, height], 默认无限制 + * @language=en + * start drag. + * @param {Array} bounds The bounds area that the view can move, relative to the coordinates of the view's parent, [x, y, width, height], default is no limit. */ startDrag:function(bounds){ var that = this; @@ -104,7 +102,8 @@ var drag = { that.stopDrag = stopDrag; }, /** - * 停止拖拽 + * @language=en + * stop drag. */ stopDrag:function(){ diff --git a/build/cmd/hilo/util/drag.min.js b/build/cmd/hilo/util/drag.min.js index 06dadfb8..4b8f1ee6 100644 --- a/build/cmd/hilo/util/drag.min.js +++ b/build/cmd/hilo/util/drag.min.js @@ -1,5 +1,5 @@ /** - * Hilo 1.0.0 for cmd + * Hilo 1.0.1 for cmd * Copyright 2016 alibaba.com * Licensed under the MIT License */ diff --git a/build/cmd/hilo/util/polyfill.js b/build/cmd/hilo/util/polyfill.js index 7a4b606a..72322a7e 100644 --- a/build/cmd/hilo/util/polyfill.js +++ b/build/cmd/hilo/util/polyfill.js @@ -1,15 +1,11 @@ /** - * Hilo 1.0.0 for cmd + * Hilo 1.0.1 for cmd * Copyright 2016 alibaba.com * Licensed under the MIT License */ define(function(require, exports, module){ -/** - * Hilo - * Copyright 2015 alibaba.com - * Licensed under the MIT License - */ + var arrayProto = Array.prototype, slice = arrayProto.slice; diff --git a/build/cmd/hilo/util/polyfill.min.js b/build/cmd/hilo/util/polyfill.min.js index 5652e34b..585014d1 100644 --- a/build/cmd/hilo/util/polyfill.min.js +++ b/build/cmd/hilo/util/polyfill.min.js @@ -1,6 +1,6 @@ /** - * Hilo 1.0.0 for cmd + * Hilo 1.0.1 for cmd * Copyright 2016 alibaba.com * Licensed under the MIT License */ -define(function(t,n,r){var e=Array.prototype,i=e.slice;e.indexOf=e.indexOf||function(t,n){n=n||0;var r,e=this.length;if(0==e||n>=e)return-1;for(0>n&&(n=e+n),r=n;e>r;r++)if(this[r]===t)return r;return-1};var o=Function.prototype;o.bind=o.bind||function(t){function n(){var o=e.concat(i.call(arguments));return r.apply(this instanceof n?this:t,o)}var r=this,e=i.call(arguments,1),o=function(){};return o.prototype=r.prototype,n.prototype=new o,n}}); \ No newline at end of file +define(function(t,n,r){var i=Array.prototype,o=i.slice;i.indexOf=i.indexOf||function(t,n){n=n||0;var r,i=this.length;if(0==i||n>=i)return-1;for(0>n&&(n=i+n),r=n;i>r;r++)if(this[r]===t)return r;return-1};var e=Function.prototype;e.bind=e.bind||function(t){function n(){var e=i.concat(o.call(arguments));return r.apply(this instanceof n?this:t,e)}var r=this,i=o.call(arguments,1),e=function(){};return e.prototype=r.prototype,n.prototype=new e,n}}); \ No newline at end of file diff --git a/build/cmd/hilo/view/Bitmap.js b/build/cmd/hilo/view/Bitmap.js index fec28a01..0a064ab3 100644 --- a/build/cmd/hilo/view/Bitmap.js +++ b/build/cmd/hilo/view/Bitmap.js @@ -1,5 +1,5 @@ /** - * Hilo 1.0.0 for cmd + * Hilo 1.0.1 for cmd * Copyright 2016 alibaba.com * Licensed under the MIT License */ @@ -10,26 +10,23 @@ var Class = require('hilo/core/Class'); var View = require('hilo/view/View'); var Drawable = require('hilo/view/Drawable'); -/** - * Hilo - * Copyright 2015 alibaba.com - * Licensed under the MIT License - */ + /** + * @language=en * *
* var bmp = new Hilo.Bitmap({image:imgElem, rect:[0, 0, 100, 100]}); * stage.addChild(bmp); *- * @class Bitmap类表示位图图像类。 + * @class Bitmap * @augments View - * @param {Object} properties 创建对象的属性参数。可包含此类所有可写属性。此外还包括: + * @param {Object} properties the options of create Instance.It can contains all writable property and Moreover: *
* var btn = new Hilo.Button({ * image: buttonImage, @@ -29,24 +26,24 @@ var Drawable = require('hilo/view/Drawable'); * disabledState: {rect:[192, 0, 64, 64]} * }); *- * @class Button类表示简单按钮类。它有弹起、经过、按下和不可用等四种状态。 + * @class Button class is a simple button class, contains four kinds of state: 'up', 'over', 'down', 'disabled' * @augments View - * @param {Object} properties 创建对象的属性参数。可包含此类所有可写属性。此外还包括: + * @param {Object} properties create object properties. Contains all writable properties. Also contains: *
* var domView = new Hilo.DOMElement({ * element: Hilo.createElement('div', { @@ -35,11 +32,11 @@ var Drawable = require('hilo/view/Drawable'); * }).addTo(stage); ** @name DOMElement - * @class DOMElement是dom元素的包装。 + * @class DOMElement is a wrapper of dom element. * @augments View - * @param {Object} properties 创建对象的属性参数。可包含此类所有可写属性。特殊属性有: + * @param {Object} properties create Objects properties. Contains all writable properties in this class. Special properties include: *
var path = 'M250 150 L150 350 L350 350 Z';
*var shape = new Hilo.Graphics({width:500, height:500});
*shape.drawSVGPath(path).beginFill('#0ff').endFill();
- * @param {String} pathData 要绘制的SVG路径数据。 - * @returns {Graphics} Graphics对象本身。 + * @param {String} pathData The SVG path data to draw. + * @returns {Graphics} The Graphics Object. */ drawSVGPath: function(pathData){ var me = this, addAction = me._addAction, @@ -355,7 +370,8 @@ return Class.create(/** @lends Graphics.prototype */{ }, /** - * 执行全部绘制动作。内部私有方法。 + * @language=en + * Apply all draw actions. private function. * @private */ _draw: function(context){ @@ -373,7 +389,8 @@ return Class.create(/** @lends Graphics.prototype */{ }, /** - * 重写渲染实现。 + * @language=en + * Overwrite render function. * @private */ render: function(renderer, delta){ @@ -387,8 +404,9 @@ return Class.create(/** @lends Graphics.prototype */{ }, /** - * 清除所有绘制动作并复原所有初始状态。 - * @returns {Graphics} Graphics对象本身。 + * @language=en + * Clear all draw actions and reset to the initial state. + * @returns {Graphics} The Graphics Object. */ clear: function(){ var me = this; @@ -410,7 +428,8 @@ return Class.create(/** @lends Graphics.prototype */{ }, /** - * 添加一个绘制动作。内部私有方法。 + * @language=en + * Add a draw action, this is a private function. * @private */ _addAction: function(action){ @@ -423,6 +442,7 @@ return Class.create(/** @lends Graphics.prototype */{ })(); + return Graphics; }); \ No newline at end of file diff --git a/build/cmd/hilo/view/Graphics.min.js b/build/cmd/hilo/view/Graphics.min.js index 073e8425..1c86d543 100644 --- a/build/cmd/hilo/view/Graphics.min.js +++ b/build/cmd/hilo/view/Graphics.min.js @@ -1,5 +1,5 @@ /** - * Hilo 1.0.0 for cmd + * Hilo 1.0.1 for cmd * Copyright 2016 alibaba.com * Licensed under the MIT License */ diff --git a/build/cmd/hilo/view/Sprite.js b/build/cmd/hilo/view/Sprite.js index ce304eb6..c9366df1 100644 --- a/build/cmd/hilo/view/Sprite.js +++ b/build/cmd/hilo/view/Sprite.js @@ -1,5 +1,5 @@ /** - * Hilo 1.0.0 for cmd + * Hilo 1.0.1 for cmd * Copyright 2016 alibaba.com * Licensed under the MIT License */ @@ -10,31 +10,28 @@ var Class = require('hilo/core/Class'); var View = require('hilo/view/View'); var Drawable = require('hilo/view/Drawable'); -/** - * Hilo - * Copyright 2015 alibaba.com - * Licensed under the MIT License - */ + /** + * @language=en * ** var stage = new Hilo.Stage({ * renderType:'canvas', @@ -28,16 +25,16 @@ var WebGLRenderer = require('hilo/renderer/WebGLRenderer'); * height: 480 * }); *- * @class 舞台是可视对象树的根,可视对象只有添加到舞台或其子对象后才会被渲染出来。创建一个hilo应用一般都是从创建一个stage开始的。 + * @class Stage is the root of all visual object tree, any visual object will be render only after being added to Stage or any children elements of Stage. Normally, every hilo application start with an stage instance. * @augments Container - * @param {Object} properties 创建对象的属性参数。可包含此类所有可写属性。主要有: + * @param {Object} properties Properties parameters for the object. Includes all writable properties of this class. Some important like: *
* var Bird = Hilo.Class.create({ * Extends: Animal, @@ -32,23 +29,24 @@ * swallow.fly(); * Bird.isBird(swallow); *- * @namespace Class是提供类的创建的辅助工具。 + * @namespace Class Class is created to aid the developer. * @static * @module hilo/core/Class */ var Class = (function(){ /** - * 根据参数指定的属性和方法创建类。 - * @param {Object} properties 要创建的类的相关属性和方法。主要有: + * @language=en + * Create a class based on the parameters, properties and methods specified. + * @param {Object} properties Properties and methods to create the class. *
* var audio = WebSound.getAudio({ * src: 'test.mp3', @@ -28,7 +25,7 @@ var WebAudio = require('./WebAudio'); * console.log('end'); * }).play(); *- * @class 声音播放管理器。 + * @class Audio playing manager. * @static * @module hilo/media/WebSound * @requires hilo/core/Hilo @@ -39,7 +36,8 @@ var WebSound = { _audios: {}, /** - * 激活音频功能。注意:需用户事件触发此方法才有效。目前仅对WebAudio有效。 + * @language=en + * Activate audio function. Note: Require user action events to activate. Currently support WebAudio. */ enableAudio: function(){ if(WebAudio.isSupported){ @@ -48,9 +46,10 @@ var WebSound = { }, /** - * 获取音频对象。优先使用WebAudio。 - * @param {String|Object} source 若source为String,则为音频src地址;若为Object,则需包含src属性。 - * @returns {WebAudio|HTMLAudio} 音频播放对象实例。 + * @language=en + * Get audio element. Use WebAudio if supported. + * @param {String|Object} source If String, it's the source of the audio; If Object, it should contains a src property. + * @returns {WebAudio|HTMLAudio} Audio playing instance. */ getAudio: function(source){ source = this._normalizeSource(source); @@ -68,8 +67,9 @@ var WebSound = { }, /** - * 删除音频对象。 - * @param {String|Object} source 若source为String,则为音频src地址;若为Object,则需包含src属性。 + * @language=en + * Remove audio element. + * @param {String|Object} source If String, it's the source of the audio; If Object, it should contains a src property. */ removeAudio: function(source){ var src = typeof source === 'string' ? source : source.src; @@ -83,6 +83,7 @@ var WebSound = { }, /** + * @language=en * @private */ _normalizeSource: function(source){ diff --git a/build/commonjs/media/WebSound.min.js b/build/commonjs/media/WebSound.min.js index 56acbd54..a9c60063 100644 --- a/build/commonjs/media/WebSound.min.js +++ b/build/commonjs/media/WebSound.min.js @@ -1,5 +1,5 @@ /** - * Hilo 1.0.0 for commonjs + * Hilo 1.0.1 for commonjs * Copyright 2016 alibaba.com * Licensed under the MIT License */ diff --git a/build/commonjs/renderer/CanvasRenderer.js b/build/commonjs/renderer/CanvasRenderer.js index 80f2bbdc..9548a326 100644 --- a/build/commonjs/renderer/CanvasRenderer.js +++ b/build/commonjs/renderer/CanvasRenderer.js @@ -1,5 +1,5 @@ /** - * Hilo 1.0.0 for commonjs + * Hilo 1.0.1 for commonjs * Copyright 2016 alibaba.com * Licensed under the MIT License */ @@ -7,21 +7,18 @@ var Class = require('../core/Class'); var Hilo = require('../core/Hilo'); var Renderer = require('./Renderer'); -/** - * Hilo - * Copyright 2015 alibaba.com - * Licensed under the MIT License - */ + /** - * @class canvas画布渲染器。所有可视对象将渲染在canvas画布上。舞台Stage会根据参数canvas选择不同的渲染器,开发者无需直接使用此类。 + * @language=en + * @class CanvasRenderer CanvasRenderer, all the visual object is drawing on the canvas element.The stage will create different renderer depend on the canvas and renderType properties, developer need not use this class directly. * @augments Renderer - * @param {Object} properties 创建对象的属性参数。可包含此类所有可写属性。 + * @param {Object} properties The properties to create a renderer, contains all writeable props of this class. * @module hilo/renderer/CanvasRenderer * @requires hilo/core/Class * @requires hilo/core/Hilo * @requires hilo/renderer/Renderer - * @property {CanvasRenderingContext2D} context canvas画布的上下文。只读属性。 + * @property {CanvasRenderingContext2D} context The context of the canvas element, readonly. */ var CanvasRenderer = Class.create(/** @lends CanvasRenderer.prototype */{ Extends: Renderer, @@ -66,7 +63,7 @@ var CanvasRenderer = Class.create(/** @lends CanvasRenderer.prototype */{ var drawable = target.drawable, image = drawable && drawable.image; if(image){ var rect = drawable.rect, sw = rect[2], sh = rect[3], offsetX = rect[4], offsetY = rect[5]; - //ie9+浏览器宽高为0时会报错 + //ie9+浏览器宽高为0时会报错 fixed ie9 bug. if(!sw || !sh){ return; } diff --git a/build/commonjs/renderer/CanvasRenderer.min.js b/build/commonjs/renderer/CanvasRenderer.min.js index 0594a9c5..2a248bc3 100644 --- a/build/commonjs/renderer/CanvasRenderer.min.js +++ b/build/commonjs/renderer/CanvasRenderer.min.js @@ -1,6 +1,6 @@ /** - * Hilo 1.0.0 for commonjs + * Hilo 1.0.1 for commonjs * Copyright 2016 alibaba.com * Licensed under the MIT License */ -var Class=require("../core/Class"),Hilo=require("../core/Hilo"),Renderer=require("./Renderer"),CanvasRenderer=Class.create({Extends:Renderer,constructor:function(e){CanvasRenderer.superclass.constructor.call(this,e),this.context=this.canvas.getContext("2d")},renderType:"canvas",context:null,startDraw:function(e){return e.visible&&e.alpha>0?(e===this.stage&&this.context.clearRect(0,0,e.width,e.height),this.context.save(),!0):!1},draw:function(e){var t=this.context,a=e.width,r=e.height,i=e.background;i&&(t.fillStyle=i,t.fillRect(0,0,a,r));var s=e.drawable,n=s&&s.image;if(n){var c=s.rect,l=c[2],h=c[3],o=c[4],d=c[5];if(!l||!h)return;a||r||(a=e.width=l,r=e.height=h),(o||d)&&t.translate(o-.5*l,d-.5*h),t.drawImage(n,c[0],c[1],l,h,0,0,a,r)}},endDraw:function(e){this.context.restore()},transform:function(e){var t=e.drawable;if(t&&t.domElement)return void Hilo.setElementStyleByView(e);var a=this.context,r=e.scaleX,i=e.scaleY;if(e===this.stage){var s=this.canvas.style,n=e._scaleX,c=e._scaleY;(!n&&1!=r||n&&n!=r)&&(e._scaleX=r,s.width=r*e.width+"px"),(!c&&1!=i||c&&c!=i)&&(e._scaleY=i,s.height=i*e.height+"px")}else{var l=e.x,h=e.y,o=e.pivotX,d=e.pivotY,v=e.rotation%360,f=e.mask;f&&(f._render(this),a.clip());var u=e.align;if(u)if("function"==typeof u)e.align();else{var g=e.parent;if(g){var w=e.width,p=e.height,b=g.width,x=g.height;switch(u){case"TL":l=0,h=0;break;case"T":l=b-w>>1,h=0;break;case"TR":l=b-w,h=0;break;case"L":l=0,h=x-p>>1;break;case"C":l=b-w>>1,h=x-p>>1;break;case"R":l=b-w,h=x-p>>1;break;case"BL":l=0,h=x-p;break;case"B":l=b-w>>1,h=x-p;break;case"BR":l=b-w,h=x-p}}}(0!=l||0!=h)&&a.translate(l,h),0!=v&&a.rotate(v*Math.PI/180),(1!=r||1!=i)&&a.scale(r,i),(0!=o||0!=d)&&a.translate(-o,-d)}e.alpha>0&&(a.globalAlpha*=e.alpha)},remove:function(e){var t=e.drawable,a=t&&t.domElement;if(a){var r=a.parentNode;r&&r.removeChild(a)}},clear:function(e,t,a,r){this.context.clearRect(e,t,a,r)},resize:function(e,t){this.canvas.width=e,this.canvas.height=t}});module.exports=CanvasRenderer; \ No newline at end of file +var Class=require("../core/Class"),Hilo=require("../core/Hilo"),Renderer=require("./Renderer"),CanvasRenderer=Class.create({Extends:Renderer,constructor:function(e){CanvasRenderer.superclass.constructor.call(this,e),this.context=this.canvas.getContext("2d")},renderType:"canvas",context:null,startDraw:function(e){return e.visible&&e.alpha>0?(e===this.stage&&this.context.clearRect(0,0,e.width,e.height),this.context.save(),!0):!1},draw:function(e){var t=this.context,a=e.width,r=e.height,i=e.background;i&&(t.fillStyle=i,t.fillRect(0,0,a,r));var s=e.drawable,n=s&&s.image;if(n){var c=s.rect,l=c[2],h=c[3],o=c[4],d=c[5];if(!l||!h)return;a||r||(a=e.width=l,r=e.height=h),(o||d)&&t.translate(o-.5*l,d-.5*h),t.drawImage(n,c[0],c[1],l,h,0,0,a,r)}},endDraw:function(e){this.context.restore()},transform:function(e){var t=e.drawable;if(t&&t.domElement)return void Hilo.setElementStyleByView(e);var a=this.context,r=e.scaleX,i=e.scaleY;if(e===this.stage){var s=this.canvas.style,n=e._scaleX,c=e._scaleY;(!n&&1!=r||n&&n!=r)&&(e._scaleX=r,s.width=r*e.width+"px"),(!c&&1!=i||c&&c!=i)&&(e._scaleY=i,s.height=i*e.height+"px")}else{var l=e.x,h=e.y,o=e.pivotX,d=e.pivotY,v=e.rotation%360,f=e.mask;f&&(f._render(this),a.clip());var u=e.align;if(u)if("function"==typeof u)e.align();else{var g=e.parent;if(g){var w=e.width,p=e.height,b=g.width,x=g.height;switch(u){case"TL":l=0,h=0;break;case"T":l=b-w>>1,h=0;break;case"TR":l=b-w,h=0;break;case"L":l=0,h=x-p>>1;break;case"C":l=b-w>>1,h=x-p>>1;break;case"R":l=b-w,h=x-p>>1;break;case"BL":l=0,h=x-p;break;case"B":l=b-w>>1,h=x-p;break;case"BR":l=b-w,h=x-p}}}0==l&&0==h||a.translate(l,h),0!=v&&a.rotate(v*Math.PI/180),1==r&&1==i||a.scale(r,i),0==o&&0==d||a.translate(-o,-d)}e.alpha>0&&(a.globalAlpha*=e.alpha)},remove:function(e){var t=e.drawable,a=t&&t.domElement;if(a){var r=a.parentNode;r&&r.removeChild(a)}},clear:function(e,t,a,r){this.context.clearRect(e,t,a,r)},resize:function(e,t){this.canvas.width=e,this.canvas.height=t}});module.exports=CanvasRenderer; \ No newline at end of file diff --git a/build/commonjs/renderer/DOMRenderer.js b/build/commonjs/renderer/DOMRenderer.js index e1f18419..46a670d0 100644 --- a/build/commonjs/renderer/DOMRenderer.js +++ b/build/commonjs/renderer/DOMRenderer.js @@ -1,5 +1,5 @@ /** - * Hilo 1.0.0 for commonjs + * Hilo 1.0.1 for commonjs * Copyright 2016 alibaba.com * Licensed under the MIT License */ @@ -8,16 +8,13 @@ var Hilo = require('../core/Hilo'); var Renderer = require('./Renderer'); var Drawable = require('../view/Drawable'); -/** - * Hilo - * Copyright 2015 alibaba.com - * Licensed under the MIT License - */ + /** - * @class DOM+CSS3渲染器。将可视对象以DOM元素方式渲染出来。舞台Stage会根据参数canvas选择不同的渲染器,开发者无需直接使用此类。 + * @language=en + * @class DomRenderer The DomRenderer, all the visual object is drawing using dom element.The stage will create different renderer depend on the canvas and renderType properties, developer need not use this class directly. * @augments Renderer - * @param {Object} properties 创建对象的属性参数。可包含此类所有可写属性。 + * @param {Object} properties The properties to create a renderer, contains all writeable props of this class. * @module hilo/renderer/DOMRenderer * @requires hilo/core/Class * @requires hilo/core/Hilo @@ -136,10 +133,11 @@ return Class.create({ }); /** - * 创建一个可渲染的DOM,可指定tagName,如canvas或div。 - * @param {Object} view 一个可视对象或类似的对象。 - * @param {Object} imageObj 指定渲染的image及相关设置,如绘制区域rect。 - * @return {HTMLElement} 新创建的DOM对象。 + * @language=en + * Create a dom element, you can set the tagName property,such as canvas and div. + * @param {Object} view A visual object. + * @param {Object} imageObj The image object to render, include the image propertiy and other associated properties, such as rect. + * @return {HTMLElement} The created dom element. * @private */ function createDOMDrawable(view, imageObj){ diff --git a/build/commonjs/renderer/DOMRenderer.min.js b/build/commonjs/renderer/DOMRenderer.min.js index 289b8354..0f7661ef 100644 --- a/build/commonjs/renderer/DOMRenderer.min.js +++ b/build/commonjs/renderer/DOMRenderer.min.js @@ -1,5 +1,5 @@ /** - * Hilo 1.0.0 for commonjs + * Hilo 1.0.1 for commonjs * Copyright 2016 alibaba.com * Licensed under the MIT License */ diff --git a/build/commonjs/renderer/Renderer.js b/build/commonjs/renderer/Renderer.js index 8d6ff50e..bc197e71 100644 --- a/build/commonjs/renderer/Renderer.js +++ b/build/commonjs/renderer/Renderer.js @@ -1,26 +1,23 @@ /** - * Hilo 1.0.0 for commonjs + * Hilo 1.0.1 for commonjs * Copyright 2016 alibaba.com * Licensed under the MIT License */ var Hilo = require('../core/Hilo'); var Class = require('../core/Class'); -/** - * Hilo - * Copyright 2015 alibaba.com - * Licensed under the MIT License - */ + /** - * @class 渲染器抽象基类。 - * @param {Object} properties 创建对象的属性参数。可包含此类所有可写属性。 + * @language=en + * @class Renderer Renderer is the base class of renderer. + * @param {Object} properties The properties to create a renderer, contains all writeable props of this class. * @module hilo/renderer/Renderer * @requires hilo/core/Hilo * @requires hilo/core/Class - * @property {Object} canvas 渲染器对应的画布。它可能是一个普通的DOM元素,比如div,也可以是一个canvas画布元素。只读属性。 - * @property {Object} stage 渲染器对应的舞台。只读属性。 - * @property {String} renderType 渲染方式。只读属性。 + * @property {Object} canvas The canvas of renderer. It can be a dom element, such as a div element, or a canvas element. readonly. + * @property {Object} stage The stage of renderer, readonly. + * @property {String} renderType The render type of renderer, readonly. */ var Renderer = Class.create(/** @lends Renderer.prototype */{ constructor: function(properties){ @@ -33,52 +30,60 @@ var Renderer = Class.create(/** @lends Renderer.prototype */{ stage: null, /** - * 为开始绘制可视对象做准备。需要子类来实现。 - * @param {View} target 要绘制的可视对象。 + * @language=en + * Prepare for draw visual object. The subclass need to implement it. + * @param {View} target The visual target to draw. */ startDraw: function(target){ }, /** - * 绘制可视对象。需要子类来实现。 - * @param {View} target 要绘制的可视对象。 + * @language=en + * Draw the visual object. The subclass need to implement it. + * @param {View} target The visual target to draw. */ draw: function(target){ }, /** - * 结束绘制可视对象后的后续处理方法。需要子类来实现。 - * @param {View} target 要绘制的可视对象。 + * @language=en + * The handling method after draw the visual object. The subclass need to implement it. + * @param {View} target The visual target to draw. */ endDraw: function(target){ }, /** - * 对可视对象进行变换。需要子类来实现。 + * @language=en + * Transfrom the visual object. The subclass need to implement it. */ transform: function(){ }, /** - * 隐藏可视对象。需要子类来实现。 + * @language=en + * Hide the visual object. The subclass need to implement it. */ hide: function(){ }, /** - * 从画布中删除可视对象。注意:不是从stage中删除对象。需要子类来实现。 - * @param {View} target 要删除的可视对象。 + * @language=en + * Remove the visual object from canvas. Notice that it dosen't remove the object from stage. The subclass need to implement it. + * @param {View} target The visual target to remove. */ remove: function(target){ }, /** - * 清除画布指定区域。需要子类来实现。 - * @param {Number} x 指定区域的x轴坐标。 - * @param {Number} y 指定区域的y轴坐标。 - * @param {Number} width 指定区域的宽度。 - * @param {Number} height 指定区域的高度。 + * @language=en + * Clear the given region of canvas. The subclass need to implement it. + * @param {Number} x The position on the x axis of the given region. + * @param {Number} y The position on the y axis of the given region. + * @param {Number} width The width of the given region. + * @param {Number} height The height of the given region. */ clear: function(x, y, width, height){ }, /** - * 改变渲染器的画布大小。 - * @param {Number} width 指定渲染画布新的宽度。 - * @param {Number} height 指定渲染画布新的高度。 + * @language=en + * Resize the renderer's canvas. + * @param {Number} width The width of renderer's canvas. + * @param {Number} height The height of the renderer's canvas. */ resize: function(width, height){ } diff --git a/build/commonjs/renderer/Renderer.min.js b/build/commonjs/renderer/Renderer.min.js index 941e9c64..b59f9e1c 100644 --- a/build/commonjs/renderer/Renderer.min.js +++ b/build/commonjs/renderer/Renderer.min.js @@ -1,5 +1,5 @@ /** - * Hilo 1.0.0 for commonjs + * Hilo 1.0.1 for commonjs * Copyright 2016 alibaba.com * Licensed under the MIT License */ diff --git a/build/commonjs/renderer/WebGLRenderer.js b/build/commonjs/renderer/WebGLRenderer.js index 20f740a0..540c75f9 100644 --- a/build/commonjs/renderer/WebGLRenderer.js +++ b/build/commonjs/renderer/WebGLRenderer.js @@ -1,5 +1,5 @@ /** - * Hilo 1.0.0 for commonjs + * Hilo 1.0.1 for commonjs * Copyright 2016 alibaba.com * Licensed under the MIT License */ @@ -7,11 +7,7 @@ var Class = require('../core/Class'); var Renderer = require('./Renderer'); var Matrix = require('../geom/Matrix'); -/** - * Hilo - * Copyright 2015 alibaba.com - * Licensed under the MIT License - */ + /** * Heavily inspired by PIXI's SpriteRenderer: @@ -20,33 +16,37 @@ var Matrix = require('../geom/Matrix'); var DEG2RAD = Math.PI / 180; /** - * @class webgl画布渲染器。所有可视对象将渲染在canvas画布上。 + * @language=en + * @class WebGLRenderer The WebGLRenderer, all the visual object is drawing on the canvas using WebGL.The stage will create different renderer depend on the canvas and renderType properties, developer need not use this class directly. * @augments Renderer - * @param {Object} properties 创建对象的属性参数。可包含此类所有可写属性。 + * @param {Object} properties The properties to create a renderer, contains all writeable props of this class. * @module hilo/renderer/WebGLRenderer * @requires hilo/core/Class * @requires hilo/renderer/Renderer * @requires hilo/geom/Matrix - * @property {WebGLRenderingContext} gl webgl上下文。只读属性。 + * @property {WebGLRenderingContext} gl The WebGL context of the renderer, readonly. */ var WebGLRenderer = Class.create(/** @lends WebGLRenderer.prototype */{ Extends: Renderer, Statics:/** @lends WebGLRenderer */{ /** - * 最大批渲染数量。 + * @language=en + * The max num of batch draw, default is 2000. * @type {Number} */ MAX_BATCH_NUM:2000, /** - * 顶点属性数。只读属性。 + * @language=en + * The num of vertex attributes, readonly. * @type {Number} */ ATTRIBUTE_NUM:5, /** - * 是否支持WebGL。只读属性。 + * @language=en + * is WebGL supported, readonly. * @type {Boolean} */ - isSupport:null + isSupported:null }, renderType:'webgl', gl:null, @@ -111,7 +111,6 @@ var WebGLRenderer = Class.create(/** @lends WebGLRenderer.prototype */{ } return false; }, - /** * @private * @see Renderer#draw @@ -402,6 +401,7 @@ var WebGLRenderer = Class.create(/** @lends WebGLRenderer.prototype */{ }); /** + * @language=en * shader * @param {WebGLRenderer} renderer [description] * @param {Object} source @@ -521,20 +521,14 @@ Shader.prototype = { } }; -WebGLRenderer.isSupport = function(){ - if(this._isSupport !== undefined){ - return this._isSupport; +WebGLRenderer.isSupported = (function(){ + var canvas = document.createElement('canvas'); + if(canvas.getContext && (canvas.getContext('webgl')||canvas.getContext('experimental-webgl'))){ + return true; } else{ - var canvas = document.createElement('canvas'); - if(canvas.getContext && (canvas.getContext('webgl')||canvas.getContext('experimental-webgl'))){ - this._isSupport = true; - } - else{ - this._isSupport = false; - } - return this._isSupport; + return false; } -}; +})(); module.exports = WebGLRenderer; \ No newline at end of file diff --git a/build/commonjs/renderer/WebGLRenderer.min.js b/build/commonjs/renderer/WebGLRenderer.min.js index 2046a728..5048b157 100644 --- a/build/commonjs/renderer/WebGLRenderer.min.js +++ b/build/commonjs/renderer/WebGLRenderer.min.js @@ -1,6 +1,6 @@ /** - * Hilo 1.0.0 for commonjs + * Hilo 1.0.1 for commonjs * Copyright 2016 alibaba.com * Licensed under the MIT License */ -var Class=require("../core/Class"),Renderer=require("./Renderer"),Matrix=require("../geom/Matrix"),DEG2RAD=Math.PI/180,WebGLRenderer=Class.create({Extends:Renderer,Statics:{MAX_BATCH_NUM:2e3,ATTRIBUTE_NUM:5,isSupport:null},renderType:"webgl",gl:null,constructor:function(e){window.__render=this,WebGLRenderer.superclass.constructor.call(this,e);var t=this.gl=this.canvas.getContext("webgl")||this.canvas.getContext("experimental-webgl");this.maxBatchNum=WebGLRenderer.MAX_BATCH_NUM,this.positionStride=4*WebGLRenderer.ATTRIBUTE_NUM;var r=this.maxBatchNum*WebGLRenderer.ATTRIBUTE_NUM*4,i=6*this.maxBatchNum;this.positions=new Float32Array(r),this.indexs=new Uint16Array(i);for(var a=0,n=0;i>a;a+=6,n+=4)this.indexs[a+0]=n+0,this.indexs[a+1]=n+1,this.indexs[a+2]=n+2,this.indexs[a+3]=n+1,this.indexs[a+4]=n+2,this.indexs[a+5]=n+3;this.batchIndex=0,this.sprites=[],t.blendFunc(t.ONE,t.ONE_MINUS_SRC_ALPHA),t.clearColor(0,0,0,0),t.disable(t.DEPTH_TEST),t.disable(t.CULL_FACE),t.enable(t.BLEND),this._initShaders(),this.defaultShader.active(),this.positionBuffer=t.createBuffer(),this.indexBuffer=t.createBuffer(),t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,this.indexBuffer),t.bufferData(t.ELEMENT_ARRAY_BUFFER,this.indexs,t.STATIC_DRAW),t.bindBuffer(t.ARRAY_BUFFER,this.positionBuffer),t.bufferData(t.ARRAY_BUFFER,this.positions,t.DYNAMIC_DRAW),t.vertexAttribPointer(this.a_position,2,t.FLOAT,!1,this.positionStride,0),t.vertexAttribPointer(this.a_TexCoord,2,t.FLOAT,!1,this.positionStride,8),t.vertexAttribPointer(this.a_alpha,1,t.FLOAT,!1,this.positionStride,16)},context:null,startDraw:function(e){return e.visible&&e.alpha>0?(e===this.stage&&this.clear(),!0):!1},draw:function(e){var t=(this.context,e.width),r=e.height,i=(e.background,e.drawable),a=i&&i.image;if(a){this.gl;a.texture||this.activeShader.uploadTexture(a);var n=i.rect,s=n[2],o=n[3];n[4],n[5];t||r||(t=e.width=s,r=e.height=o),this.batchIndex>=this.maxBatchNum&&this._renderBatches();var h=this._createVertexs(a,n[0],n[1],s,o,0,0,t,r),l=this.batchIndex*this.positionStride,d=this.positions,_=e.__webglRenderAlpha;d[l+0]=h[0],d[l+1]=h[1],d[l+2]=h[2],d[l+3]=h[3],d[l+4]=_,d[l+5]=h[4],d[l+6]=h[5],d[l+7]=h[6],d[l+8]=h[7],d[l+9]=_,d[l+10]=h[8],d[l+11]=h[9],d[l+12]=h[10],d[l+13]=h[11],d[l+14]=_,d[l+15]=h[12],d[l+16]=h[13],d[l+17]=h[14],d[l+18]=h[15],d[l+19]=_;for(var c=e.__webglWorldMatrix,u=0;4>u;u++){var f=d[l+5*u],p=d[l+5*u+1];d[l+5*u]=c.a*f+c.c*p+c.tx,d[l+5*u+1]=c.b*f+c.d*p+c.ty}e.texture=a.texture,this.sprites[this.batchIndex++]=e}},endDraw:function(e){e===this.stage&&this._renderBatches()},transform:function(e){var t=e.drawable;if(t&&t.domElement)return void Hilo.setElementStyleByView(e);var r=(this.context,e.scaleX),i=e.scaleY;if(e===this.stage){var a=this.canvas.style,n=e._scaleX,s=e._scaleY;(!n&&1!=r||n&&n!=r)&&(e._scaleX=r,a.width=r*e.width+"px"),(!s&&1!=i||s&&s!=i)&&(e._scaleY=i,a.height=i*e.height+"px"),e.__webglWorldMatrix=e.__webglWorldMatrix||new Matrix(1,0,0,1,0,0)}else e.__webglWorldMatrix=e.__webglWorldMatrix||new Matrix(1,0,0,1,0,0),this._setConcatenatedMatrix(e,e.parent);e.alpha>0&&(e.parent&&e.parent.__webglRenderAlpha?e.__webglRenderAlpha=e.alpha*e.parent.__webglRenderAlpha:e.__webglRenderAlpha=e.alpha)},remove:function(e){var t=e.drawable,r=t&&t.domElement;if(r){var i=r.parentNode;i&&i.removeChild(r)}},clear:function(e,t,r,i){this.gl.clear(this.gl.COLOR_BUFFER_BIT)},resize:function(e,t){(this.width!==e||this.height!==t)&&(this.width=this.canvas.width=e,this.height=this.canvas.height=t,this.gl.viewport(0,0,e,t),this.canvasHalfWidth=.5*e,this.canvasHalfHeight=.5*t,this._uploadProjectionTransform(!0))},_renderBatches:function(){var e=this.gl;e.bufferSubData(e.ARRAY_BUFFER,0,this.positions.subarray(0,this.batchIndex*this.positionStride));for(var t=0,r=0,i=null,a=0;a
- * ticker.addTick(Hilo.Tween);//需要把Tween加到ticker里才能使用 + * ticker.addTick(Hilo.Tween);//Tween works after being added to ticker * * var view = new View({x:5, y:10}); * Hilo.Tween.to(view, { @@ -32,26 +29,26 @@ var Class = require('../core/Class'); * } * }); *- * @class Tween类提供缓动功能。 - * @param {Object} target 缓动对象。 - * @param {Object} fromProps 对象缓动的起始属性集合。 - * @param {Object} toProps 对象缓动的目标属性集合。 - * @param {Object} params 缓动参数。可包含Tween类所有可写属性。 + * @class Tween class makes tweening (easing, slow motion). + * @param {Object} target Tween target object. + * @param {Object} fromProps Beginning properties of target tweening object. + * @param {Object} toProps Ending properties of target tweening object. + * @param {Object} params Tweening parameters, include all writable Tween class properties. * @module hilo/tween/Tween * @requires hilo/core/Class - * @property {Object} target 缓动目标。只读属性。 - * @property {Int} duration 缓动总时长。单位毫秒。 - * @property {Int} delay 缓动延迟时间。单位毫秒。 - * @property {Boolean} paused 缓动是否暂停。默认为false。 - * @property {Boolean} loop 缓动是否循环。默认为false。 - * @property {Boolean} reverse 缓动是否反转播放。默认为false。 - * @property {Int} repeat 缓动重复的次数。默认为0。 - * @property {Int} repeatDelay 缓动重复的延迟时长。单位为毫秒。 - * @property {Function} ease 缓动变化函数。默认为null。 - * @property {Int} time 缓动已进行的时长。单位毫秒。只读属性。 - * @property {Function} onStart 缓动开始回调函数。它接受1个参数:tween。默认值为null。 - * @property {Function} onUpdate 缓动更新回调函数。它接受2个参数:ratio和tween。默认值为null。 - * @property {Function} onComplete 缓动结束回调函数。它接受1个参数:tween。默认值为null。 + * @property {Object} target Tween target object, readonly! + * @property {Int} duration Tweening duration, measure in ms. + * @property {Int} delay Tweenning delay time, measure in ms. + * @property {Boolean} paused Is tweening paused, default value is false. + * @property {Boolean} loop Does tweening loop, default value is false. + * @property {Boolean} reverse Does tweening reverse, default value is false. + * @property {Int} repeat Repeat times of tweening, default value is 0. + * @property {Int} repeatDelay Delay time of repeating tweening, measure in ms. + * @property {Function} ease Tweening transform function, default value is null. + * @property {Int} time Time that tweening taken, measure in ms, readonly! + * @property {Function} onStart Function invoked on the beginning of tweening. Require 1 parameter: tween. default value is null. + * @property {Function} onUpdate Function invoked on tweening update. Require 2 parameters: ratio, tween. default value is null. + * @property {Function} onComplete Function invoked on the end of tweening. Require 1 parameter: tween. default value is null. */ var Tween = (function(){ @@ -104,10 +101,11 @@ return Class.create(/** @lends Tween.prototype */{ onComplete: null, /** - * 设置缓动对象的初始和目标属性。 - * @param {Object} fromProps 缓动对象的初始属性。 - * @param {Object} toProps 缓动对象的目标属性。 - * @returns {Tween} Tween变换本身。可用于链式调用。 + * @language=en + * Set beginning properties and ending properties of tweening object. + * @param {Object} fromProps Beginning properties of target tweening object. + * @param {Object} toProps Ending properties of target tweening object. + * @returns {Tween} Current Tween, for chain calls. */ setProps: function(fromProps, toProps){ var me = this, target = me.target, @@ -125,8 +123,9 @@ return Class.create(/** @lends Tween.prototype */{ }, /** - * 启动缓动动画的播放。 - * @returns {Tween} Tween变换本身。可用于链式调用。 + * @language=en + * Starting the tweening. + * @returns {Tween} Current Tween, for chain calls. */ start: function(){ var me = this; @@ -139,8 +138,9 @@ return Class.create(/** @lends Tween.prototype */{ }, /** - * 停止缓动动画的播放。 - * @returns {Tween} Tween变换本身。可用于链式调用。 + * @language=en + * Stop the tweening. + * @returns {Tween} Current Tween, for chain calls. */ stop: function(){ Tween.remove(this); @@ -148,8 +148,9 @@ return Class.create(/** @lends Tween.prototype */{ }, /** - * 暂停缓动动画的播放。 - * @returns {Tween} Tween变换本身。可用于链式调用。 + * @language=en + * Pause the tweening. + * @returns {Tween} Current Tween, for chain calls. */ pause: function(){ var me = this; @@ -159,8 +160,9 @@ return Class.create(/** @lends Tween.prototype */{ }, /** - * 恢复缓动动画的播放。 - * @returns {Tween} Tween变换本身。可用于链式调用。 + * @language=en + * Continue to play the tweening. + * @returns {Tween} Current Tween, for chain calls. */ resume: function(){ var me = this; @@ -171,10 +173,11 @@ return Class.create(/** @lends Tween.prototype */{ }, /** - * 跳转Tween到指定的时间。 - * @param {Number} time 指定要跳转的时间。取值范围为:0 - duraion。 - * @param {Boolean} pause 是否暂停。 - * @returns {Tween} Tween变换本身。可用于链式调用。 + * @language=en + * Tween jumps to some point. + * @param {Number} time The time to jump to, range from 0 to duration. + * @param {Boolean} pause Is paused. + * @returns {Tween} Current Tween, for chain calls. */ seek: function(time, pause){ var me = this, current = now(); @@ -188,9 +191,10 @@ return Class.create(/** @lends Tween.prototype */{ }, /** - * 连接下一个Tween变换。其开始时间根据delay值不同而不同。当delay值为字符串且以'+'或'-'开始时,Tween的开始时间从当前变换结束点计算,否则以当前变换起始点计算。 - * @param {Tween} tween 要连接的Tween变换。 - * @returns {Tween} Tween变换本身。可用于链式调用。 + * @language=en + * Link next Tween. The beginning time of next Tween depends on the delay value. If delay is a string that begins with '+' or '-', next Tween will begin at (delay) ms after or before the current tween is ended. If delay is out of previous situation, next Tween will begin at (delay) ms after the beginning point of current Tween. + * @param {Tween} tween Tween to link. + * @returns {Tween} Current Tween, for chain calls. */ link: function(tween){ var me = this, delay = tween.delay, startTime = me._startTime; @@ -208,7 +212,8 @@ return Class.create(/** @lends Tween.prototype */{ }, /** - * Tween类的内部渲染方法。 + * @language=en + * Private render method inside Tween class. * @private */ _render: function(ratio){ @@ -217,7 +222,8 @@ return Class.create(/** @lends Tween.prototype */{ }, /** - * Tween类的内部更新方法。 + * @language=en + * Private update method inside Tween class. * @private */ _update: function(time, forceUpdate){ @@ -294,12 +300,14 @@ return Class.create(/** @lends Tween.prototype */{ Statics: /** @lends Tween */ { /** + * @language=en * @private */ _tweens: [], /** - * 更新所有Tween实例。 + * @language=en + * Update all Tween instances. * @returns {Object} Tween。 */ tick: function(){ @@ -316,8 +324,9 @@ return Class.create(/** @lends Tween.prototype */{ }, /** - * 添加Tween实例。 - * @param {Tween} tween 要添加的Tween对象。 + * @language=en + * Add a Tween instance. + * @param {Tween} tween Tween object to add. * @returns {Object} Tween。 */ add: function(tween){ @@ -327,8 +336,9 @@ return Class.create(/** @lends Tween.prototype */{ }, /** - * 删除Tween实例。 - * @param {Tween|Object|Array} tweenOrTarget 要删除的Tween对象或target对象或要删除的一组对象。 + * @language=en + * Remove one Tween target. + * @param {Tween|Object|Array} tweenOrTarget Tween object, target object or an array of object to remove * @returns {Object} Tween。 */ remove: function(tweenOrTarget){ @@ -356,7 +366,8 @@ return Class.create(/** @lends Tween.prototype */{ }, /** - * 删除所有Tween实例。 + * @language=en + * Remove all Tween instances. * @returns {Object} Tween。 */ removeAll: function(){ @@ -365,12 +376,13 @@ return Class.create(/** @lends Tween.prototype */{ }, /** - * 创建一个缓动动画,让目标对象从开始属性变换到目标属性。 - * @param {Object|Array} target 缓动目标对象或缓动目标数组。 - * @param fromProps 缓动目标对象的开始属性。 - * @param toProps 缓动目标对象的目标属性。 - * @param params 缓动动画的参数。 - * @returns {Tween|Array} 一个Tween实例对象或Tween实例数组。 + * @language=en + * Create a tween, make target object easing from beginning properties to ending properties. + * @param {Object|Array} target Tweening target or tweening target array. + * @param fromProps Beginning properties of target tweening object. + * @param toProps Ending properties of target tweening object. + * @param params Tweening parameters. + * @returns {Tween|Array} An tween instance or an array of tween instance. */ fromTo: function(target, fromProps, toProps, params){ var isArray = target instanceof Array; @@ -388,22 +400,24 @@ return Class.create(/** @lends Tween.prototype */{ }, /** - * 创建一个缓动动画,让目标对象从当前属性变换到目标属性。 - * @param {Object|Array} target 缓动目标对象或缓动目标数组。 - * @param toProps 缓动目标对象的目标属性。 - * @param params 缓动动画的参数。 - * @returns {Tween|Array} 一个Tween实例对象或Tween实例数组。 + * @language=en + * Create a tween, make target object easing from current properties to ending properties. + * @param {Object|Array} target Tweening target or tweening target array. + * @param toProps Ending properties of target tweening object. + * @param params Tweening parameters. + * @returns {Tween|Array} An tween instance or an array of tween instance. */ to: function(target, toProps, params){ return Tween.fromTo(target, null, toProps, params); }, /** - * 创建一个缓动动画,让目标对象从指定的起始属性变换到当前属性。 - * @param {Object|Array} target 缓动目标对象或缓动目标数组。 - * @param fromProps 缓动目标对象的目标属性。 - * @param params 缓动动画的参数。 - * @returns {Tween|Array} 一个Tween实例对象或Tween实例数组。 + * @language=en + * Create a tween, make target object easing from beginning properties to current properties. + * @param {Object|Array} target Tweening target or tweening target array. + * @param fromProps Beginning properties of target tweening object. + * @param params Tweening parameters. + * @returns {Tween|Array} An tween instance or an array of tween instance. */ from: function(target, fromProps, params){ return Tween.fromTo(target, fromProps, null, params); @@ -414,4 +428,5 @@ return Class.create(/** @lends Tween.prototype */{ })(); + module.exports = Tween; \ No newline at end of file diff --git a/build/commonjs/tween/Tween.min.js b/build/commonjs/tween/Tween.min.js index 9f6e064e..d003c5b5 100644 --- a/build/commonjs/tween/Tween.min.js +++ b/build/commonjs/tween/Tween.min.js @@ -1,6 +1,6 @@ /** - * Hilo 1.0.0 for commonjs + * Hilo 1.0.1 for commonjs * Copyright 2016 alibaba.com * Licensed under the MIT License */ -var Class=require("../core/Class"),Tween=function(){function e(){return+new Date}return Class.create({constructor:function(e,t,r,n){var a=this;a.target=e,a._startTime=0,a._seekTime=0,a._pausedTime=0,a._pausedStartTime=0,a._reverseFlag=1,a._repeatCount=0,3==arguments.length&&(n=r,r=t,t=null);for(var s in n)a[s]=n[s];a.setProps(t,r),!n.duration&&n.time&&(a.duration=n.time||0,a.time=0)},target:null,duration:0,delay:0,paused:!1,loop:!1,reverse:!1,repeat:0,repeatDelay:0,ease:null,time:0,onStart:null,onUpdate:null,onComplete:null,setProps:function(e,t){var r=this,n=r.target,a=e||t,s=r._fromProps={},i=r._toProps={};e=e||n,t=t||n;for(var u in a)i[u]=t[u]||0,n[u]=s[u]=e[u]||0;return r},start:function(){var t=this;return t._startTime=e()+t.delay,t._seekTime=0,t._pausedTime=0,t.paused=!1,Tween.add(t),t},stop:function(){return Tween.remove(this),this},pause:function(){var t=this;return t.paused=!0,t._pausedStartTime=e(),t},resume:function(){var t=this;return t.paused=!1,t._pausedStartTime&&(t._pausedTime+=e()-t._pausedStartTime),t._pausedStartTime=0,t},seek:function(t,r){var n=this,a=e();return n._startTime=a,n._seekTime=t,n._pausedTime=0,void 0!==r&&(n.paused=r),n._update(a,!0),Tween.add(n),n},link:function(e){var t=this,r=e.delay,n=t._startTime;if("string"==typeof r){var a=0==r.indexOf("+"),s=0==r.indexOf("-");r=a||s?Number(r.substr(1))*(a?1:-1):Number(r)}return e.delay=r,e._startTime=a||s?n+t.duration+r:n+r,t._next=e,Tween.remove(e),t},_render:function(e){var t,r=this,n=r.target,a=r._fromProps;for(t in a)n[t]=a[t]+(r._toProps[t]-a[t])*e},_update:function(t,r){var n=this;if(!n.paused||r){var a=t-n._startTime-n._pausedTime+n._seekTime;if(!(0>a)){var s,i=a/n.duration,u=!1;i=0>=i?0:i>=1?1:n.ease?n.ease(i):i,n.reverse&&(n._reverseFlag<0&&(i=1-i),1e-7>i&&(n.repeat>0&&n._repeatCount++>=n.repeat||0==n.repeat&&!n.loop?u=!0:(n._startTime=e(),n._pausedTime=0,n._reverseFlag*=-1))),0==n.time&&(s=n.onStart)&&s.call(n,n),n.time=a,n._render(i),(s=n.onUpdate)&&s.call(n,i,n),i>=1&&(n.reverse?(n._startTime=e(),n._pausedTime=0,n._reverseFlag*=-1):n.loop||n.repeat>0&&n._repeatCount++
* var bmp = new Bitmap({image:img}); * Hilo.copy(bmp, Hilo.drag); * bmp.startDrag([0, 0, 550, 400]); *- * @class drag是一个包含拖拽功能的mixin。可以通过 Class.mix(view, drag)或Hilo.copy(view, drag)来为view增加拖拽功能。 + * @class drag A mixin that contains drag method.You can mix drag method to the visual target by use Class.mix(target, drag) or Hilo.copy(target, drag). * @mixin * @static * @module hilo/util/drag @@ -30,8 +27,9 @@ var Hilo = require('../core/Hilo'); */ var drag = { /** - * 开始拖拽 - * @param {Array} bounds 拖拽范围,基于父容器坐标系,[x, y, width, height], 默认无限制 + * @language=en + * start drag. + * @param {Array} bounds The bounds area that the view can move, relative to the coordinates of the view's parent, [x, y, width, height], default is no limit. */ startDrag:function(bounds){ var that = this; @@ -102,7 +100,8 @@ var drag = { that.stopDrag = stopDrag; }, /** - * 停止拖拽 + * @language=en + * stop drag. */ stopDrag:function(){ diff --git a/build/commonjs/util/drag.min.js b/build/commonjs/util/drag.min.js index 19ace5fe..3d5c7220 100644 --- a/build/commonjs/util/drag.min.js +++ b/build/commonjs/util/drag.min.js @@ -1,5 +1,5 @@ /** - * Hilo 1.0.0 for commonjs + * Hilo 1.0.1 for commonjs * Copyright 2016 alibaba.com * Licensed under the MIT License */ diff --git a/build/commonjs/util/polyfill.js b/build/commonjs/util/polyfill.js index a17c9b83..db94026b 100644 --- a/build/commonjs/util/polyfill.js +++ b/build/commonjs/util/polyfill.js @@ -1,13 +1,9 @@ /** - * Hilo 1.0.0 for commonjs + * Hilo 1.0.1 for commonjs * Copyright 2016 alibaba.com * Licensed under the MIT License */ -/** - * Hilo - * Copyright 2015 alibaba.com - * Licensed under the MIT License - */ + var arrayProto = Array.prototype, slice = arrayProto.slice; diff --git a/build/commonjs/util/polyfill.min.js b/build/commonjs/util/polyfill.min.js index a1decb65..a80b0539 100644 --- a/build/commonjs/util/polyfill.min.js +++ b/build/commonjs/util/polyfill.min.js @@ -1,6 +1,6 @@ /** - * Hilo 1.0.0 for commonjs + * Hilo 1.0.1 for commonjs * Copyright 2016 alibaba.com * Licensed under the MIT License */ -var arrayProto=Array.prototype,slice=arrayProto.slice;arrayProto.indexOf=arrayProto.indexOf||function(r,t){t=t||0;var o,n=this.length;if(0==n||t>=n)return-1;for(0>t&&(t=n+t),o=t;n>o;o++)if(this[o]===r)return o;return-1};var fnProto=Function.prototype;fnProto.bind=fnProto.bind||function(r){function t(){var a=n.concat(slice.call(arguments));return o.apply(this instanceof t?this:r,a)}var o=this,n=slice.call(arguments,1),a=function(){};return a.prototype=o.prototype,t.prototype=new a,t}; \ No newline at end of file +var arrayProto=Array.prototype,slice=arrayProto.slice;arrayProto.indexOf=arrayProto.indexOf||function(r,t){t=t||0;var o,n=this.length;if(0==n||t>=n)return-1;for(0>t&&(t=n+t),o=t;n>o;o++)if(this[o]===r)return o;return-1};var fnProto=Function.prototype;fnProto.bind=fnProto.bind||function(r){function t(){var i=n.concat(slice.call(arguments));return o.apply(this instanceof t?this:r,i)}var o=this,n=slice.call(arguments,1),i=function(){};return i.prototype=o.prototype,t.prototype=new i,t}; \ No newline at end of file diff --git a/build/commonjs/view/Bitmap.js b/build/commonjs/view/Bitmap.js index 067f68ca..b1cd8f77 100644 --- a/build/commonjs/view/Bitmap.js +++ b/build/commonjs/view/Bitmap.js @@ -1,5 +1,5 @@ /** - * Hilo 1.0.0 for commonjs + * Hilo 1.0.1 for commonjs * Copyright 2016 alibaba.com * Licensed under the MIT License */ @@ -8,26 +8,23 @@ var Class = require('../core/Class'); var View = require('./View'); var Drawable = require('./Drawable'); -/** - * Hilo - * Copyright 2015 alibaba.com - * Licensed under the MIT License - */ + /** + * @language=en * *
* var bmp = new Hilo.Bitmap({image:imgElem, rect:[0, 0, 100, 100]}); * stage.addChild(bmp); *- * @class Bitmap类表示位图图像类。 + * @class Bitmap * @augments View - * @param {Object} properties 创建对象的属性参数。可包含此类所有可写属性。此外还包括: + * @param {Object} properties the options of create Instance.It can contains all writable property and Moreover: *
* var btn = new Hilo.Button({ * image: buttonImage, @@ -27,24 +24,24 @@ var Drawable = require('./Drawable'); * disabledState: {rect:[192, 0, 64, 64]} * }); *- * @class Button类表示简单按钮类。它有弹起、经过、按下和不可用等四种状态。 + * @class Button class is a simple button class, contains four kinds of state: 'up', 'over', 'down', 'disabled' * @augments View - * @param {Object} properties 创建对象的属性参数。可包含此类所有可写属性。此外还包括: + * @param {Object} properties create object properties. Contains all writable properties. Also contains: *
* var domView = new Hilo.DOMElement({ * element: Hilo.createElement('div', { @@ -33,11 +30,11 @@ var Drawable = require('./Drawable'); * }).addTo(stage); ** @name DOMElement - * @class DOMElement是dom元素的包装。 + * @class DOMElement is a wrapper of dom element. * @augments View - * @param {Object} properties 创建对象的属性参数。可包含此类所有可写属性。特殊属性有: + * @param {Object} properties create Objects properties. Contains all writable properties in this class. Special properties include: *
var path = 'M250 150 L150 350 L350 350 Z';
*var shape = new Hilo.Graphics({width:500, height:500});
*shape.drawSVGPath(path).beginFill('#0ff').endFill();
- * @param {String} pathData 要绘制的SVG路径数据。 - * @returns {Graphics} Graphics对象本身。 + * @param {String} pathData The SVG path data to draw. + * @returns {Graphics} The Graphics Object. */ drawSVGPath: function(pathData){ var me = this, addAction = me._addAction, @@ -353,7 +368,8 @@ return Class.create(/** @lends Graphics.prototype */{ }, /** - * 执行全部绘制动作。内部私有方法。 + * @language=en + * Apply all draw actions. private function. * @private */ _draw: function(context){ @@ -371,7 +387,8 @@ return Class.create(/** @lends Graphics.prototype */{ }, /** - * 重写渲染实现。 + * @language=en + * Overwrite render function. * @private */ render: function(renderer, delta){ @@ -385,8 +402,9 @@ return Class.create(/** @lends Graphics.prototype */{ }, /** - * 清除所有绘制动作并复原所有初始状态。 - * @returns {Graphics} Graphics对象本身。 + * @language=en + * Clear all draw actions and reset to the initial state. + * @returns {Graphics} The Graphics Object. */ clear: function(){ var me = this; @@ -408,7 +426,8 @@ return Class.create(/** @lends Graphics.prototype */{ }, /** - * 添加一个绘制动作。内部私有方法。 + * @language=en + * Add a draw action, this is a private function. * @private */ _addAction: function(action){ @@ -421,4 +440,5 @@ return Class.create(/** @lends Graphics.prototype */{ })(); + module.exports = Graphics; \ No newline at end of file diff --git a/build/commonjs/view/Graphics.min.js b/build/commonjs/view/Graphics.min.js index 42a1f335..85d02505 100644 --- a/build/commonjs/view/Graphics.min.js +++ b/build/commonjs/view/Graphics.min.js @@ -1,5 +1,5 @@ /** - * Hilo 1.0.0 for commonjs + * Hilo 1.0.1 for commonjs * Copyright 2016 alibaba.com * Licensed under the MIT License */ diff --git a/build/commonjs/view/Sprite.js b/build/commonjs/view/Sprite.js index 9f494352..e3762e8b 100644 --- a/build/commonjs/view/Sprite.js +++ b/build/commonjs/view/Sprite.js @@ -1,5 +1,5 @@ /** - * Hilo 1.0.0 for commonjs + * Hilo 1.0.1 for commonjs * Copyright 2016 alibaba.com * Licensed under the MIT License */ @@ -8,31 +8,28 @@ var Class = require('../core/Class'); var View = require('./View'); var Drawable = require('./Drawable'); -/** - * Hilo - * Copyright 2015 alibaba.com - * Licensed under the MIT License - */ + /** + * @language=en * ** var stage = new Hilo.Stage({ * renderType:'canvas', @@ -26,16 +23,16 @@ var WebGLRenderer = require('../renderer/WebGLRenderer'); * height: 480 * }); *- * @class 舞台是可视对象树的根,可视对象只有添加到舞台或其子对象后才会被渲染出来。创建一个hilo应用一般都是从创建一个stage开始的。 + * @class Stage is the root of all visual object tree, any visual object will be render only after being added to Stage or any children elements of Stage. Normally, every hilo application start with an stage instance. * @augments Container - * @param {Object} properties 创建对象的属性参数。可包含此类所有可写属性。主要有: + * @param {Object} properties Properties parameters for the object. Includes all writable properties of this class. Some important like: *
* var Bird = Hilo.Class.create({ * Extends: Animal, @@ -392,23 +401,24 @@ KISSY.add('hilo/core/Class', function(S){ * swallow.fly(); * Bird.isBird(swallow); *- * @namespace Class是提供类的创建的辅助工具。 + * @namespace Class Class is created to aid the developer. * @static * @module hilo/core/Class */ var Class = (function(){ /** - * 根据参数指定的属性和方法创建类。 - * @param {Object} properties 要创建的类的相关属性和方法。主要有: + * @language=en + * Create a class based on the parameters, properties and methods specified. + * @param {Object} properties Properties and methods to create the class. *
* var stage = new Hilo.Stage({ * renderType:'canvas', @@ -2835,16 +2883,16 @@ KISSY.add('hilo/view/Stage', function(S, Hilo, Class, Container, CanvasRenderer, * height: 480 * }); *- * @class 舞台是可视对象树的根,可视对象只有添加到舞台或其子对象后才会被渲染出来。创建一个hilo应用一般都是从创建一个stage开始的。 + * @class Stage is the root of all visual object tree, any visual object will be render only after being added to Stage or any children elements of Stage. Normally, every hilo application start with an stage instance. * @augments Container - * @param {Object} properties 创建对象的属性参数。可包含此类所有可写属性。主要有: + * @param {Object} properties Properties parameters for the object. Includes all writable properties of this class. Some important like: *
* var bmp = new Hilo.Bitmap({image:imgElem, rect:[0, 0, 100, 100]}); * stage.addChild(bmp); *- * @class Bitmap类表示位图图像类。 + * @class Bitmap * @augments View - * @param {Object} properties 创建对象的属性参数。可包含此类所有可写属性。此外还包括: + * @param {Object} properties the options of create Instance.It can contains all writable property and Moreover: *
* var domView = new Hilo.DOMElement({ * element: Hilo.createElement('div', { @@ -3442,11 +3510,11 @@ KISSY.add('hilo/view/DOMElement', function(S, Hilo, Class, View, Drawable){ * }).addTo(stage); ** @name DOMElement - * @class DOMElement是dom元素的包装。 + * @class DOMElement is a wrapper of dom element. * @augments View - * @param {Object} properties 创建对象的属性参数。可包含此类所有可写属性。特殊属性有: + * @param {Object} properties create Objects properties. Contains all writable properties in this class. Special properties include: *
var path = 'M250 150 L150 350 L350 350 Z';
*var shape = new Hilo.Graphics({width:500, height:500});
*shape.drawSVGPath(path).beginFill('#0ff').endFill();
- * @param {String} pathData 要绘制的SVG路径数据。 - * @returns {Graphics} Graphics对象本身。 + * @param {String} pathData The SVG path data to draw. + * @returns {Graphics} The Graphics Object. */ drawSVGPath: function(pathData){ var me = this, addAction = me._addAction, @@ -3862,7 +3951,8 @@ return Class.create(/** @lends Graphics.prototype */{ }, /** - * 执行全部绘制动作。内部私有方法。 + * @language=en + * Apply all draw actions. private function. * @private */ _draw: function(context){ @@ -3880,7 +3970,8 @@ return Class.create(/** @lends Graphics.prototype */{ }, /** - * 重写渲染实现。 + * @language=en + * Overwrite render function. * @private */ render: function(renderer, delta){ @@ -3894,8 +3985,9 @@ return Class.create(/** @lends Graphics.prototype */{ }, /** - * 清除所有绘制动作并复原所有初始状态。 - * @returns {Graphics} Graphics对象本身。 + * @language=en + * Clear all draw actions and reset to the initial state. + * @returns {Graphics} The Graphics Object. */ clear: function(){ var me = this; @@ -3917,7 +4009,8 @@ return Class.create(/** @lends Graphics.prototype */{ }, /** - * 添加一个绘制动作。内部私有方法。 + * @language=en + * Add a draw action, this is a private function. * @private */ _addAction: function(action){ @@ -3930,45 +4023,43 @@ return Class.create(/** @lends Graphics.prototype */{ })(); + return Graphics; }, { requires: ['hilo/core/Hilo', 'hilo/core/Class', 'hilo/view/View', 'hilo/view/CacheMixin'] }); /** - * Hilo 1.0.0 for kissy + * Hilo 1.0.1 for kissy * Copyright 2016 alibaba.com * Licensed under the MIT License */ KISSY.add('hilo/view/Text', function(S, Class, Hilo, View, CacheMixin){ -/** - * Hilo - * Copyright 2015 alibaba.com - * Licensed under the MIT License - */ + /** + * @language=en * ** var btn = new Hilo.Button({ * image: buttonImage, @@ -4386,24 +4482,24 @@ KISSY.add('hilo/view/Button', function(S, Hilo, Class, View, Drawable){ * disabledState: {rect:[192, 0, 64, 64]} * }); *- * @class Button类表示简单按钮类。它有弹起、经过、按下和不可用等四种状态。 + * @class Button class is a simple button class, contains four kinds of state: 'up', 'over', 'down', 'disabled' * @augments View - * @param {Object} properties 创建对象的属性参数。可包含此类所有可写属性。此外还包括: + * @param {Object} properties create object properties. Contains all writable properties. Also contains: *
* var bmp = new Bitmap({image:img}); * Hilo.copy(bmp, Hilo.drag); * bmp.startDrag([0, 0, 550, 400]); *- * @class drag是一个包含拖拽功能的mixin。可以通过 Class.mix(view, drag)或Hilo.copy(view, drag)来为view增加拖拽功能。 + * @class drag A mixin that contains drag method.You can mix drag method to the visual target by use Class.mix(target, drag) or Hilo.copy(target, drag). * @mixin * @static * @module hilo/util/drag @@ -5000,8 +5102,9 @@ KISSY.add('hilo/util/drag', function(S, Class, Hilo){ */ var drag = { /** - * 开始拖拽 - * @param {Array} bounds 拖拽范围,基于父容器坐标系,[x, y, width, height], 默认无限制 + * @language=en + * start drag. + * @param {Array} bounds The bounds area that the view can move, relative to the coordinates of the view's parent, [x, y, width, height], default is no limit. */ startDrag:function(bounds){ var that = this; @@ -5072,7 +5175,8 @@ var drag = { that.stopDrag = stopDrag; }, /** - * 停止拖拽 + * @language=en + * stop drag. */ stopDrag:function(){ @@ -5085,24 +5189,21 @@ return drag; requires: ['hilo/core/Class', 'hilo/core/Hilo'] }); /** - * Hilo 1.0.0 for kissy + * Hilo 1.0.1 for kissy * Copyright 2016 alibaba.com * Licensed under the MIT License */ KISSY.add('hilo/tween/Tween', function(S, Class){ -/** - * Hilo - * Copyright 2015 alibaba.com - * Licensed under the MIT License - */ + /** + * @language=en * *
- * ticker.addTick(Hilo.Tween);//需要把Tween加到ticker里才能使用 + * ticker.addTick(Hilo.Tween);//Tween works after being added to ticker * * var view = new View({x:5, y:10}); * Hilo.Tween.to(view, { @@ -5118,26 +5219,26 @@ KISSY.add('hilo/tween/Tween', function(S, Class){ * } * }); *- * @class Tween类提供缓动功能。 - * @param {Object} target 缓动对象。 - * @param {Object} fromProps 对象缓动的起始属性集合。 - * @param {Object} toProps 对象缓动的目标属性集合。 - * @param {Object} params 缓动参数。可包含Tween类所有可写属性。 + * @class Tween class makes tweening (easing, slow motion). + * @param {Object} target Tween target object. + * @param {Object} fromProps Beginning properties of target tweening object. + * @param {Object} toProps Ending properties of target tweening object. + * @param {Object} params Tweening parameters, include all writable Tween class properties. * @module hilo/tween/Tween * @requires hilo/core/Class - * @property {Object} target 缓动目标。只读属性。 - * @property {Int} duration 缓动总时长。单位毫秒。 - * @property {Int} delay 缓动延迟时间。单位毫秒。 - * @property {Boolean} paused 缓动是否暂停。默认为false。 - * @property {Boolean} loop 缓动是否循环。默认为false。 - * @property {Boolean} reverse 缓动是否反转播放。默认为false。 - * @property {Int} repeat 缓动重复的次数。默认为0。 - * @property {Int} repeatDelay 缓动重复的延迟时长。单位为毫秒。 - * @property {Function} ease 缓动变化函数。默认为null。 - * @property {Int} time 缓动已进行的时长。单位毫秒。只读属性。 - * @property {Function} onStart 缓动开始回调函数。它接受1个参数:tween。默认值为null。 - * @property {Function} onUpdate 缓动更新回调函数。它接受2个参数:ratio和tween。默认值为null。 - * @property {Function} onComplete 缓动结束回调函数。它接受1个参数:tween。默认值为null。 + * @property {Object} target Tween target object, readonly! + * @property {Int} duration Tweening duration, measure in ms. + * @property {Int} delay Tweenning delay time, measure in ms. + * @property {Boolean} paused Is tweening paused, default value is false. + * @property {Boolean} loop Does tweening loop, default value is false. + * @property {Boolean} reverse Does tweening reverse, default value is false. + * @property {Int} repeat Repeat times of tweening, default value is 0. + * @property {Int} repeatDelay Delay time of repeating tweening, measure in ms. + * @property {Function} ease Tweening transform function, default value is null. + * @property {Int} time Time that tweening taken, measure in ms, readonly! + * @property {Function} onStart Function invoked on the beginning of tweening. Require 1 parameter: tween. default value is null. + * @property {Function} onUpdate Function invoked on tweening update. Require 2 parameters: ratio, tween. default value is null. + * @property {Function} onComplete Function invoked on the end of tweening. Require 1 parameter: tween. default value is null. */ var Tween = (function(){ @@ -5190,10 +5291,11 @@ return Class.create(/** @lends Tween.prototype */{ onComplete: null, /** - * 设置缓动对象的初始和目标属性。 - * @param {Object} fromProps 缓动对象的初始属性。 - * @param {Object} toProps 缓动对象的目标属性。 - * @returns {Tween} Tween变换本身。可用于链式调用。 + * @language=en + * Set beginning properties and ending properties of tweening object. + * @param {Object} fromProps Beginning properties of target tweening object. + * @param {Object} toProps Ending properties of target tweening object. + * @returns {Tween} Current Tween, for chain calls. */ setProps: function(fromProps, toProps){ var me = this, target = me.target, @@ -5211,8 +5313,9 @@ return Class.create(/** @lends Tween.prototype */{ }, /** - * 启动缓动动画的播放。 - * @returns {Tween} Tween变换本身。可用于链式调用。 + * @language=en + * Starting the tweening. + * @returns {Tween} Current Tween, for chain calls. */ start: function(){ var me = this; @@ -5225,8 +5328,9 @@ return Class.create(/** @lends Tween.prototype */{ }, /** - * 停止缓动动画的播放。 - * @returns {Tween} Tween变换本身。可用于链式调用。 + * @language=en + * Stop the tweening. + * @returns {Tween} Current Tween, for chain calls. */ stop: function(){ Tween.remove(this); @@ -5234,8 +5338,9 @@ return Class.create(/** @lends Tween.prototype */{ }, /** - * 暂停缓动动画的播放。 - * @returns {Tween} Tween变换本身。可用于链式调用。 + * @language=en + * Pause the tweening. + * @returns {Tween} Current Tween, for chain calls. */ pause: function(){ var me = this; @@ -5245,8 +5350,9 @@ return Class.create(/** @lends Tween.prototype */{ }, /** - * 恢复缓动动画的播放。 - * @returns {Tween} Tween变换本身。可用于链式调用。 + * @language=en + * Continue to play the tweening. + * @returns {Tween} Current Tween, for chain calls. */ resume: function(){ var me = this; @@ -5257,10 +5363,11 @@ return Class.create(/** @lends Tween.prototype */{ }, /** - * 跳转Tween到指定的时间。 - * @param {Number} time 指定要跳转的时间。取值范围为:0 - duraion。 - * @param {Boolean} pause 是否暂停。 - * @returns {Tween} Tween变换本身。可用于链式调用。 + * @language=en + * Tween jumps to some point. + * @param {Number} time The time to jump to, range from 0 to duration. + * @param {Boolean} pause Is paused. + * @returns {Tween} Current Tween, for chain calls. */ seek: function(time, pause){ var me = this, current = now(); @@ -5274,9 +5381,10 @@ return Class.create(/** @lends Tween.prototype */{ }, /** - * 连接下一个Tween变换。其开始时间根据delay值不同而不同。当delay值为字符串且以'+'或'-'开始时,Tween的开始时间从当前变换结束点计算,否则以当前变换起始点计算。 - * @param {Tween} tween 要连接的Tween变换。 - * @returns {Tween} Tween变换本身。可用于链式调用。 + * @language=en + * Link next Tween. The beginning time of next Tween depends on the delay value. If delay is a string that begins with '+' or '-', next Tween will begin at (delay) ms after or before the current tween is ended. If delay is out of previous situation, next Tween will begin at (delay) ms after the beginning point of current Tween. + * @param {Tween} tween Tween to link. + * @returns {Tween} Current Tween, for chain calls. */ link: function(tween){ var me = this, delay = tween.delay, startTime = me._startTime; @@ -5294,7 +5402,8 @@ return Class.create(/** @lends Tween.prototype */{ }, /** - * Tween类的内部渲染方法。 + * @language=en + * Private render method inside Tween class. * @private */ _render: function(ratio){ @@ -5303,7 +5412,8 @@ return Class.create(/** @lends Tween.prototype */{ }, /** - * Tween类的内部更新方法。 + * @language=en + * Private update method inside Tween class. * @private */ _update: function(time, forceUpdate){ @@ -5380,12 +5490,14 @@ return Class.create(/** @lends Tween.prototype */{ Statics: /** @lends Tween */ { /** + * @language=en * @private */ _tweens: [], /** - * 更新所有Tween实例。 + * @language=en + * Update all Tween instances. * @returns {Object} Tween。 */ tick: function(){ @@ -5402,8 +5514,9 @@ return Class.create(/** @lends Tween.prototype */{ }, /** - * 添加Tween实例。 - * @param {Tween} tween 要添加的Tween对象。 + * @language=en + * Add a Tween instance. + * @param {Tween} tween Tween object to add. * @returns {Object} Tween。 */ add: function(tween){ @@ -5413,8 +5526,9 @@ return Class.create(/** @lends Tween.prototype */{ }, /** - * 删除Tween实例。 - * @param {Tween|Object|Array} tweenOrTarget 要删除的Tween对象或target对象或要删除的一组对象。 + * @language=en + * Remove one Tween target. + * @param {Tween|Object|Array} tweenOrTarget Tween object, target object or an array of object to remove * @returns {Object} Tween。 */ remove: function(tweenOrTarget){ @@ -5442,7 +5556,8 @@ return Class.create(/** @lends Tween.prototype */{ }, /** - * 删除所有Tween实例。 + * @language=en + * Remove all Tween instances. * @returns {Object} Tween。 */ removeAll: function(){ @@ -5451,12 +5566,13 @@ return Class.create(/** @lends Tween.prototype */{ }, /** - * 创建一个缓动动画,让目标对象从开始属性变换到目标属性。 - * @param {Object|Array} target 缓动目标对象或缓动目标数组。 - * @param fromProps 缓动目标对象的开始属性。 - * @param toProps 缓动目标对象的目标属性。 - * @param params 缓动动画的参数。 - * @returns {Tween|Array} 一个Tween实例对象或Tween实例数组。 + * @language=en + * Create a tween, make target object easing from beginning properties to ending properties. + * @param {Object|Array} target Tweening target or tweening target array. + * @param fromProps Beginning properties of target tweening object. + * @param toProps Ending properties of target tweening object. + * @param params Tweening parameters. + * @returns {Tween|Array} An tween instance or an array of tween instance. */ fromTo: function(target, fromProps, toProps, params){ var isArray = target instanceof Array; @@ -5474,22 +5590,24 @@ return Class.create(/** @lends Tween.prototype */{ }, /** - * 创建一个缓动动画,让目标对象从当前属性变换到目标属性。 - * @param {Object|Array} target 缓动目标对象或缓动目标数组。 - * @param toProps 缓动目标对象的目标属性。 - * @param params 缓动动画的参数。 - * @returns {Tween|Array} 一个Tween实例对象或Tween实例数组。 + * @language=en + * Create a tween, make target object easing from current properties to ending properties. + * @param {Object|Array} target Tweening target or tweening target array. + * @param toProps Ending properties of target tweening object. + * @param params Tweening parameters. + * @returns {Tween|Array} An tween instance or an array of tween instance. */ to: function(target, toProps, params){ return Tween.fromTo(target, null, toProps, params); }, /** - * 创建一个缓动动画,让目标对象从指定的起始属性变换到当前属性。 - * @param {Object|Array} target 缓动目标对象或缓动目标数组。 - * @param fromProps 缓动目标对象的目标属性。 - * @param params 缓动动画的参数。 - * @returns {Tween|Array} 一个Tween实例对象或Tween实例数组。 + * @language=en + * Create a tween, make target object easing from beginning properties to current properties. + * @param {Object|Array} target Tweening target or tweening target array. + * @param fromProps Beginning properties of target tweening object. + * @param params Tweening parameters. + * @returns {Tween|Array} An tween instance or an array of tween instance. */ from: function(target, fromProps, params){ return Tween.fromTo(target, fromProps, null, params); @@ -5500,26 +5618,24 @@ return Class.create(/** @lends Tween.prototype */{ })(); + return Tween; }, { requires: ['hilo/core/Class'] }); /** - * Hilo 1.0.0 for kissy + * Hilo 1.0.1 for kissy * Copyright 2016 alibaba.com * Licensed under the MIT License */ KISSY.add('hilo/tween/Ease', function(S){ -/** - * Hilo - * Copyright 2015 alibaba.com - * Licensed under the MIT License - */ + /** - * @class Ease类包含为Tween类提供各种缓动功能的函数。 + * @language=en + * @class Ease class provides multiple easing functions for Tween. * @module hilo/tween/Ease * @static */ @@ -5535,14 +5651,16 @@ function createEase(obj, easeInFn, easeOutFn, easeInOutFn, easeNoneFn){ } /** - * 线性匀速缓动函数。包含EaseNone函数。 + * @language=en + * Linear easing function.Include EaseNone. */ var Linear = createEase(null, null, null, null, function(k){ return k; }); /** - * 二次缓动函数。包含EaseIn、EaseOut、EaseInOut三个函数。 + * @language=en + * Quad easing function.Include EaseIn, EaseOut, EaseInOut. */ var Quad = createEase(null, function(k){ @@ -5559,7 +5677,8 @@ var Quad = createEase(null, ); /** - * 三次缓动函数。包含EaseIn、EaseOut、EaseInOut三个函数。 + * @language=en + * Cubic easing function.Include EaseIn, EaseOut, EaseInOut. */ var Cubic = createEase(null, function(k){ @@ -5576,7 +5695,8 @@ var Cubic = createEase(null, ); /** - * 四次缓动函数。包含EaseIn、EaseOut、EaseInOut三个函数。 + * @language=en + * Quart easing function.Include EaseIn, EaseOut, EaseInOut. */ var Quart = createEase(null, function(k){ @@ -5593,7 +5713,8 @@ var Quart = createEase(null, ); /** - * 五次缓动函数。包含EaseIn、EaseOut、EaseInOut三个函数。 + * @language=en + * Quint easing function.Include EaseIn, EaseOut, EaseInOut. */ var Quint = createEase(null, function(k){ @@ -5615,7 +5736,8 @@ var math = Math, pow = math.pow, sqrt = math.sqrt; /** - * 正弦缓动函数。包含EaseIn、EaseOut、EaseInOut三个函数。 + * @language=en + * Sine easing function.Include EaseIn, EaseOut, EaseInOut. */ var Sine = createEase(null, function(k){ @@ -5632,7 +5754,8 @@ var Sine = createEase(null, ); /** - * 指数缓动函数。包含EaseIn、EaseOut、EaseInOut三个函数。 + * @language=en + * Expo easing function.Include EaseIn, EaseOut, EaseInOut. */ var Expo = createEase(null, function(k){ @@ -5651,7 +5774,8 @@ var Expo = createEase(null, ); /** - * 圆形缓动函数。包含EaseIn、EaseOut、EaseInOut三个函数。 + * @language=en + * Circ easing function.Include EaseIn, EaseOut, EaseInOut. */ var Circ = createEase(null, function(k){ @@ -5669,7 +5793,8 @@ var Circ = createEase(null, ); /** - * 弹性缓动函数。包含EaseIn、EaseOut、EaseInOut三个函数。 + * @language=en + * Elastic easing function.Include EaseIn, EaseOut, EaseInOut. */ var Elastic = createEase( { @@ -5699,7 +5824,8 @@ var Elastic = createEase( ); /** - * 向后缓动函数。包含EaseIn、EaseOut、EaseInOut三个函数。 + * @language=en + * Back easing function.Include EaseIn, EaseOut, EaseInOut. */ var Back = createEase( { @@ -5726,7 +5852,8 @@ var Back = createEase( ); /** - * 弹跳缓动函数。包含EaseIn、EaseOut、EaseInOut三个函数。 + * @language=en + * Bounce easing function.Include EaseIn, EaseOut, EaseInOut. */ var Bounce = createEase(null, function(k){ @@ -5770,21 +5897,18 @@ return Ease; }); /** - * Hilo 1.0.0 for kissy + * Hilo 1.0.1 for kissy * Copyright 2016 alibaba.com * Licensed under the MIT License */ KISSY.add('hilo/loader/ImageLoader', function(S, Class){ -/** - * Hilo - * Copyright 2015 alibaba.com - * Licensed under the MIT License - */ + /** + * @language=en * @private - * @class 图片资源加载器。 + * @class image resources loader. * @module hilo/loader/ImageLoader * @requires hilo/core/Class */ @@ -5826,21 +5950,18 @@ return ImageLoader; requires: ['hilo/core/Class'] }); /** - * Hilo 1.0.0 for kissy + * Hilo 1.0.1 for kissy * Copyright 2016 alibaba.com * Licensed under the MIT License */ KISSY.add('hilo/loader/ScriptLoader', function(S, Class){ -/** - * Hilo - * Copyright 2015 alibaba.com - * Licensed under the MIT License - */ + /** + * @language=en * @private - * @class javascript或JSONP加载器。 + * @class javascript or JSONP loader * @module hilo/loader/ScriptLoader * @requires hilo/core/Class */ @@ -5897,29 +6018,26 @@ return ScriptLoader; requires: ['hilo/core/Class'] }); /** - * Hilo 1.0.0 for kissy + * Hilo 1.0.1 for kissy * Copyright 2016 alibaba.com * Licensed under the MIT License */ KISSY.add('hilo/loader/LoadQueue', function(S, Class, EventMixin, ImageLoader, ScriptLoader){ -/** - * Hilo - * Copyright 2015 alibaba.com - * Licensed under the MIT License - */ + //TODO: 超时timeout,失败重连次数maxTries,更多的下载器Loader,队列暂停恢复等。 /** - * @class LoadQueue是一个队列下载工具。 - * @param {Object} source 要下载的资源。可以是单个资源对象或多个资源的数组。 + * @language=en + * @class LoadQueue is a queue-like loader. + * @param {Object} source ,resource that need to be loaded,could be a single object or array resource. * @module hilo/loader/LoadQueue * @requires hilo/core/Class * @requires hilo/event/EventMixin * @requires hilo/loader/ImageLoader * @requires hilo/loader/ScriptLoader - * @property {Int} maxConnections 同时下载的最大连接数。默认为2。 + * @property {Int} maxConnections ,the limited concurrent connections. default value 2. */ var LoadQueue = Class.create(/** @lends LoadQueue.prototype */{ Mixes: EventMixin, @@ -5936,15 +6054,16 @@ var LoadQueue = Class.create(/** @lends LoadQueue.prototype */{ _currentIndex: -1, /** - * 增加要下载的资源。可以是单个资源对象或多个资源的数组。 - * @param {Object|Array} source 资源对象或资源对象数组。每个资源对象包含以下属性: + * @language=en + * Add desired resource,could be a single object or array resource. + * @param {Object|Array} source ,a single object or array resource. Each resource contains properties like below: *
* var audio = WebSound.getAudio({ * src: 'test.mp3', @@ -6640,7 +6787,7 @@ KISSY.add('hilo/media/WebSound', function(S, Hilo, HTMLAudio, WebAudio){ * console.log('end'); * }).play(); *- * @class 声音播放管理器。 + * @class Audio playing manager. * @static * @module hilo/media/WebSound * @requires hilo/core/Hilo @@ -6651,7 +6798,8 @@ var WebSound = { _audios: {}, /** - * 激活音频功能。注意:需用户事件触发此方法才有效。目前仅对WebAudio有效。 + * @language=en + * Activate audio function. Note: Require user action events to activate. Currently support WebAudio. */ enableAudio: function(){ if(WebAudio.isSupported){ @@ -6660,9 +6808,10 @@ var WebSound = { }, /** - * 获取音频对象。优先使用WebAudio。 - * @param {String|Object} source 若source为String,则为音频src地址;若为Object,则需包含src属性。 - * @returns {WebAudio|HTMLAudio} 音频播放对象实例。 + * @language=en + * Get audio element. Use WebAudio if supported. + * @param {String|Object} source If String, it's the source of the audio; If Object, it should contains a src property. + * @returns {WebAudio|HTMLAudio} Audio playing instance. */ getAudio: function(source){ source = this._normalizeSource(source); @@ -6680,8 +6829,9 @@ var WebSound = { }, /** - * 删除音频对象。 - * @param {String|Object} source 若source为String,则为音频src地址;若为Object,则需包含src属性。 + * @language=en + * Remove audio element. + * @param {String|Object} source If String, it's the source of the audio; If Object, it should contains a src property. */ removeAudio: function(source){ var src = typeof source === 'string' ? source : source.src; @@ -6695,6 +6845,7 @@ var WebSound = { }, /** + * @language=en * @private */ _normalizeSource: function(source){ @@ -6712,30 +6863,27 @@ return WebSound; requires: ['hilo/core/Hilo', 'hilo/media/HTMLAudio', 'hilo/media/WebAudio'] }); /** - * Hilo 1.0.0 for kissy + * Hilo 1.0.1 for kissy * Copyright 2016 alibaba.com * Licensed under the MIT License */ KISSY.add('hilo/game/Camera', function(S, Hilo, Class){ -/** - * Hilo - * Copyright 2015 alibaba.com - * Licensed under the MIT License - */ + /** - * @class Camera类表示摄像机。 - * @param {Object} properties 创建对象的属性参数。可包含此类所有可写属性。 + * @language=en + * @class Camera. + * @param {Object} properties The properties to create a view object, contains all writeable props of this class * @module hilo/game/Camera * @requires hilo/core/Hilo * @requires hilo/core/Class - * @property {Number} width 镜头宽 - * @property {Number} height 镜头高 - * @property {Object} scroll 滚动值 {x:0, y:0} - * @property {View} target 摄像机跟随的目标 - * @property {Array} bounds 摄像机移动边界的矩形区域 [x, y, width, height] - * @property {Array} deadzone 摄像机不移动的矩形区域 [ x, y, width, height] + * @property {Number} width The width of the camera. + * @property {Number} height The height of the camera. + * @property {Object} scroll The scrolling value of the camera {x:0, y:0}. + * @property {View} target The target that the camera follow. + * @property {Array} bounds The rect area where camera is allowed to move [x, y, width, height]. + * @property {Array} deadzone The rect area where camera isn't allowed to move[ x, y, width, height]. */ var Camera = Class.create(/** @lends Camera.prototype */{ constructor:function(properties){ @@ -6754,7 +6902,8 @@ var Camera = Class.create(/** @lends Camera.prototype */{ Hilo.copy(this, properties); }, /** - * 更新 + * @language=en + * update. * @param {Number} deltaTime */ tick:function(deltaTime){ @@ -6788,9 +6937,10 @@ var Camera = Class.create(/** @lends Camera.prototype */{ } }, /** - * 跟随目标 - * @param {Object} target 跟随的目标,必须是有x,y属性的对象 - * @param {Array} deadzone 摄像机不移动的矩形区域 [ x, y, width, height] + * @language=en + * Follow the target. + * @param {Object} target The target that the camera follow. It must has x and y properties. + * @param {Array} deadzone The rect area where camera isn't allowed to move[ x, y, width, height]. */ follow:function(target, deadzone){ this.target = target; @@ -6808,54 +6958,51 @@ return Camera; requires: ['hilo/core/Hilo', 'hilo/core/Class'] }); /** - * Hilo 1.0.0 for kissy + * Hilo 1.0.1 for kissy * Copyright 2016 alibaba.com * Licensed under the MIT License */ KISSY.add('hilo/game/Camera3d', function(S, Hilo, Class){ -/** - * Hilo - * Copyright 2015 alibaba.com - * Licensed under the MIT License - */ + /** - * @class Camera3d 伪3D虚拟摄像机。 + * @language=en + * @class Camera3d is a pseudo-3d camera. * @module hilo/game/Camera3d * @requires hilo/core/Hilo * @requires hilo/core/Class - * @property {Number} fv 镜头视点距离(屏幕视点相对眼睛距离,绝对了坐标缩放比例) - * @property {Number} fx 镜头视点X(屏幕视点相对屏幕左上角X距离) - * @property {Number} fy 镜头视点Y(屏幕视点相对屏幕左上角Y距离) - * @property {Object} stage 3D对象所在容器,可以是stage或container,结合ticker时是必须参数,用来Z深度排序 - * @property {Number} x 镜头三维坐标x - * @property {Number} y 镜头三维坐标y - * @property {Number} z 镜头三维坐标z - * @property {Number} rotationX X轴旋转角度 - * @property {Number} rotationY Y轴旋转角度 - * @property {Number} rotationZ Z轴旋转角度 + * @property {Number} fv The distance of the fov(The distance between eyes and the Z plane,it determines the scale ratio of the 3d object). + * @property {Number} fx The x position of the screen viewpoint(The distance between the screen viewpoint and the screen left top corner on the x axis). + * @property {Number} fy The y position of the screen viewpoint(The distance between the screen viewpoint and the screen left top corner on the y axis). + * @property {Object} stage The 3d object's container, it can be stage or container.It is required if you need to sort the 3d object by z axis. + * @property {Number} x The x position. + * @property {Number} y The y position. + * @property {Number} z The z position. + * @property {Number} rotationX The x rotation. + * @property {Number} rotationY The y rotation. + * @property {Number} rotationZ The z rotation. */ var Camera3d = (function(){ var degtorad = Math.PI / 180; - //向量旋转 - function rotateX(x, y, z, ca, sa) {//绕X轴旋转 + //Rotate the axis. + function rotateX(x, y, z, ca, sa) {//rotate x return { x: x, y: y * ca - z * sa, z: y * sa + z * ca }; } - function rotateY(x, y, z, ca, sa) {//绕Y轴旋转 + function rotateY(x, y, z, ca, sa) {//rotate y return { x: x * ca - z * sa, y: y, z: x * sa + z * ca }; } - function rotateZ(x, y, z, ca, sa) {//绕Z轴旋转 + function rotateZ(x, y, z, ca, sa) {//rotate z return { x: x * ca - y * sa, y: x * sa + y * ca, @@ -6877,10 +7024,11 @@ var Camera3d = (function(){ }, /** - * 仿射矩阵位移变换,不同于直接修改Camera3d.x/y/z. 是在Camera3d依次做坐标位移 - 旋转变换 后,再加上一个位移变换。主要功能可以做Zoomin/out 功能 - * @param {Number} x坐标 - * @param {Number} y坐标 - * @param {Number} z坐标 + * @language=en + * Translate the camera,used for Zoomin/out feature. + * @param {Number} x The x position. + * @param {Number} y The y position. + * @param {Number} z The z position. */ translate : function(x,y,z){ this.tx = x; @@ -6889,33 +7037,38 @@ var Camera3d = (function(){ }, /** - * 旋转X轴方向角度,相当于欧拉角系统的 beta - * @param {Number} X旋转角度 + * @language=en + * Rotate by the x axis. + * @param {Number} angle The rotate degree. */ rotateX : function(angle){ this.rotationX = angle; }, /** - * 旋转Y轴方向角度,相当于欧拉角系统的 gamma - * @param {Number} Y旋转角度 + * @language=en + * Rotate by the y axis. + * @param {Number} angle The rotate degree. */ rotateY : function(angle){ this.rotationY = angle; }, /** - * 旋转Z轴方向角度,相当于欧拉角系统的 alpha - * @param {Number} Z旋转角度 + * @language=en + * Rotate by the z axis. + * @param {Number} angle The rotate degree. */ rotateZ : function(angle){ this.rotationZ = angle; }, /** - * 将三维坐标转换投影为二维坐标,同时返回Z轴深度,和投影显示的缩放比例 - * @param {object} 三维坐标对象 - * @param {object} Hilo.View对象,用于自动转换坐标 + * @language=en + * Project the 3d point to 2d point. + * @param {object} vector3D The 3d position, it must have x, y and z properties. + * @param {View} view The view related to the 3d position.It'll be auto translated by the 3d position. + * @returns {Object} The 2d object include z and scale properties, e.g.:{x:x, y:y, z:z, scale} */ project : function(vector3D, view){ @@ -6930,10 +7083,10 @@ var Camera3d = (function(){ // 旋转变换前的 仿射矩阵位移, dx = vector3D.x - this.x, dy = vector3D.y - this.y, - dz = vector3D.z - this.z, + dz = vector3D.z - this.z; // 旋转矩阵变换 - vector = rotateZ(dx, dy, dz, cosZ, sinZ); + var vector = rotateZ(dx, dy, dz, cosZ, sinZ); vector = rotateY(vector.x, vector.y, vector.z, cosY, sinY); vector = rotateX(vector.x, vector.y, vector.z, cosX, sinX); @@ -6946,24 +7099,27 @@ var Camera3d = (function(){ _x = vector.x * perspective, _y = -vector.y * perspective; - if(view) { - view.x = _x + this.fx; - view.y = _y + this.fy; - view.z = -vector.z; - view.scaleX = perspective; - view.scaleY = perspective; - } else { - return { - x : _x + this.fx, - y : _y + this.fy, - z : -vector.z, - scale : perspective - }; + var result = { + x : _x + this.fx, + y : _y + this.fy, + z : -vector.z, + scale : perspective + }; + + if(view){ + view.x = result.x; + view.y = result.y; + view.z = result.z; + view.scaleX = result.scale; + view.scaleY = result.scale; } + + return result; }, /** - * Z深度排序 + * @language=en + * Sort by z axis. */ sortZ : function(){ this.stage.children.sort(function(view_a, view_b){ @@ -6972,7 +7128,8 @@ var Camera3d = (function(){ }, /** - * Ticker 轮询使用 + * @language=en + * Used for the ticker. */ tick : function(){ this.sortZ(); @@ -6990,22 +7147,19 @@ return Camera3d; requires: ['hilo/core/Hilo', 'hilo/core/Class'] }); /** - * Hilo 1.0.0 for kissy + * Hilo 1.0.1 for kissy * Copyright 2016 alibaba.com * Licensed under the MIT License */ KISSY.add('hilo/game/ParticleSystem', function(S, Hilo, Class, View, Container, Bitmap, Drawable){ -/** - * Hilo - * Copyright 2015 alibaba.com - * Licensed under the MIT License - */ + /** + * @language=en * *
* var Bird = Hilo.Class.create({ * Extends: Animal, @@ -34,23 +31,24 @@ KISSY.add('hilo/core/Class', function(S){ * swallow.fly(); * Bird.isBird(swallow); *- * @namespace Class是提供类的创建的辅助工具。 + * @namespace Class Class is created to aid the developer. * @static * @module hilo/core/Class */ var Class = (function(){ /** - * 根据参数指定的属性和方法创建类。 - * @param {Object} properties 要创建的类的相关属性和方法。主要有: + * @language=en + * Create a class based on the parameters, properties and methods specified. + * @param {Object} properties Properties and methods to create the class. *
* var audio = WebSound.getAudio({ * src: 'test.mp3', @@ -26,7 +23,7 @@ KISSY.add('hilo/media/WebSound', function(S, Hilo, HTMLAudio, WebAudio){ * console.log('end'); * }).play(); *- * @class 声音播放管理器。 + * @class Audio playing manager. * @static * @module hilo/media/WebSound * @requires hilo/core/Hilo @@ -37,7 +34,8 @@ var WebSound = { _audios: {}, /** - * 激活音频功能。注意:需用户事件触发此方法才有效。目前仅对WebAudio有效。 + * @language=en + * Activate audio function. Note: Require user action events to activate. Currently support WebAudio. */ enableAudio: function(){ if(WebAudio.isSupported){ @@ -46,9 +44,10 @@ var WebSound = { }, /** - * 获取音频对象。优先使用WebAudio。 - * @param {String|Object} source 若source为String,则为音频src地址;若为Object,则需包含src属性。 - * @returns {WebAudio|HTMLAudio} 音频播放对象实例。 + * @language=en + * Get audio element. Use WebAudio if supported. + * @param {String|Object} source If String, it's the source of the audio; If Object, it should contains a src property. + * @returns {WebAudio|HTMLAudio} Audio playing instance. */ getAudio: function(source){ source = this._normalizeSource(source); @@ -66,8 +65,9 @@ var WebSound = { }, /** - * 删除音频对象。 - * @param {String|Object} source 若source为String,则为音频src地址;若为Object,则需包含src属性。 + * @language=en + * Remove audio element. + * @param {String|Object} source If String, it's the source of the audio; If Object, it should contains a src property. */ removeAudio: function(source){ var src = typeof source === 'string' ? source : source.src; @@ -81,6 +81,7 @@ var WebSound = { }, /** + * @language=en * @private */ _normalizeSource: function(source){ diff --git a/build/kissy/hilo/media/WebSound.min.js b/build/kissy/hilo/media/WebSound.min.js index e748b711..7a185aff 100644 --- a/build/kissy/hilo/media/WebSound.min.js +++ b/build/kissy/hilo/media/WebSound.min.js @@ -1,5 +1,5 @@ /** - * Hilo 1.0.0 for kissy + * Hilo 1.0.1 for kissy * Copyright 2016 alibaba.com * Licensed under the MIT License */ diff --git a/build/kissy/hilo/renderer/CanvasRenderer.js b/build/kissy/hilo/renderer/CanvasRenderer.js index 91366208..68f56d02 100644 --- a/build/kissy/hilo/renderer/CanvasRenderer.js +++ b/build/kissy/hilo/renderer/CanvasRenderer.js @@ -1,25 +1,22 @@ /** - * Hilo 1.0.0 for kissy + * Hilo 1.0.1 for kissy * Copyright 2016 alibaba.com * Licensed under the MIT License */ KISSY.add('hilo/renderer/CanvasRenderer', function(S, Class, Hilo, Renderer){ -/** - * Hilo - * Copyright 2015 alibaba.com - * Licensed under the MIT License - */ + /** - * @class canvas画布渲染器。所有可视对象将渲染在canvas画布上。舞台Stage会根据参数canvas选择不同的渲染器,开发者无需直接使用此类。 + * @language=en + * @class CanvasRenderer CanvasRenderer, all the visual object is drawing on the canvas element.The stage will create different renderer depend on the canvas and renderType properties, developer need not use this class directly. * @augments Renderer - * @param {Object} properties 创建对象的属性参数。可包含此类所有可写属性。 + * @param {Object} properties The properties to create a renderer, contains all writeable props of this class. * @module hilo/renderer/CanvasRenderer * @requires hilo/core/Class * @requires hilo/core/Hilo * @requires hilo/renderer/Renderer - * @property {CanvasRenderingContext2D} context canvas画布的上下文。只读属性。 + * @property {CanvasRenderingContext2D} context The context of the canvas element, readonly. */ var CanvasRenderer = Class.create(/** @lends CanvasRenderer.prototype */{ Extends: Renderer, @@ -64,7 +61,7 @@ var CanvasRenderer = Class.create(/** @lends CanvasRenderer.prototype */{ var drawable = target.drawable, image = drawable && drawable.image; if(image){ var rect = drawable.rect, sw = rect[2], sh = rect[3], offsetX = rect[4], offsetY = rect[5]; - //ie9+浏览器宽高为0时会报错 + //ie9+浏览器宽高为0时会报错 fixed ie9 bug. if(!sw || !sh){ return; } diff --git a/build/kissy/hilo/renderer/CanvasRenderer.min.js b/build/kissy/hilo/renderer/CanvasRenderer.min.js index 4ca61104..7da24fd9 100644 --- a/build/kissy/hilo/renderer/CanvasRenderer.min.js +++ b/build/kissy/hilo/renderer/CanvasRenderer.min.js @@ -1,6 +1,6 @@ /** - * Hilo 1.0.0 for kissy + * Hilo 1.0.1 for kissy * Copyright 2016 alibaba.com * Licensed under the MIT License */ -KISSY.add("hilo/renderer/CanvasRenderer",function(e,t,a,r){var i=t.create({Extends:r,constructor:function(e){i.superclass.constructor.call(this,e),this.context=this.canvas.getContext("2d")},renderType:"canvas",context:null,startDraw:function(e){return e.visible&&e.alpha>0?(e===this.stage&&this.context.clearRect(0,0,e.width,e.height),this.context.save(),!0):!1},draw:function(e){var t=this.context,a=e.width,r=e.height,i=e.background;i&&(t.fillStyle=i,t.fillRect(0,0,a,r));var n=e.drawable,s=n&&n.image;if(s){var c=n.rect,h=c[2],l=c[3],o=c[4],d=c[5];if(!h||!l)return;a||r||(a=e.width=h,r=e.height=l),(o||d)&&t.translate(o-.5*h,d-.5*l),t.drawImage(s,c[0],c[1],h,l,0,0,a,r)}},endDraw:function(e){this.context.restore()},transform:function(e){var t=e.drawable;if(t&&t.domElement)return void a.setElementStyleByView(e);var r=this.context,i=e.scaleX,n=e.scaleY;if(e===this.stage){var s=this.canvas.style,c=e._scaleX,h=e._scaleY;(!c&&1!=i||c&&c!=i)&&(e._scaleX=i,s.width=i*e.width+"px"),(!h&&1!=n||h&&h!=n)&&(e._scaleY=n,s.height=n*e.height+"px")}else{var l=e.x,o=e.y,d=e.pivotX,v=e.pivotY,f=e.rotation%360,u=e.mask;u&&(u._render(this),r.clip());var g=e.align;if(g)if("function"==typeof g)e.align();else{var w=e.parent;if(w){var b=e.width,p=e.height,x=w.width,m=w.height;switch(g){case"TL":l=0,o=0;break;case"T":l=x-b>>1,o=0;break;case"TR":l=x-b,o=0;break;case"L":l=0,o=m-p>>1;break;case"C":l=x-b>>1,o=m-p>>1;break;case"R":l=x-b,o=m-p>>1;break;case"BL":l=0,o=m-p;break;case"B":l=x-b>>1,o=m-p;break;case"BR":l=x-b,o=m-p}}}(0!=l||0!=o)&&r.translate(l,o),0!=f&&r.rotate(f*Math.PI/180),(1!=i||1!=n)&&r.scale(i,n),(0!=d||0!=v)&&r.translate(-d,-v)}e.alpha>0&&(r.globalAlpha*=e.alpha)},remove:function(e){var t=e.drawable,a=t&&t.domElement;if(a){var r=a.parentNode;r&&r.removeChild(a)}},clear:function(e,t,a,r){this.context.clearRect(e,t,a,r)},resize:function(e,t){this.canvas.width=e,this.canvas.height=t}});return i},{requires:["hilo/core/Class","hilo/core/Hilo","hilo/renderer/Renderer"]}); \ No newline at end of file +KISSY.add("hilo/renderer/CanvasRenderer",function(e,t,a,r){var i=t.create({Extends:r,constructor:function(e){i.superclass.constructor.call(this,e),this.context=this.canvas.getContext("2d")},renderType:"canvas",context:null,startDraw:function(e){return e.visible&&e.alpha>0?(e===this.stage&&this.context.clearRect(0,0,e.width,e.height),this.context.save(),!0):!1},draw:function(e){var t=this.context,a=e.width,r=e.height,i=e.background;i&&(t.fillStyle=i,t.fillRect(0,0,a,r));var n=e.drawable,s=n&&n.image;if(s){var c=n.rect,h=c[2],l=c[3],o=c[4],d=c[5];if(!h||!l)return;a||r||(a=e.width=h,r=e.height=l),(o||d)&&t.translate(o-.5*h,d-.5*l),t.drawImage(s,c[0],c[1],h,l,0,0,a,r)}},endDraw:function(e){this.context.restore()},transform:function(e){var t=e.drawable;if(t&&t.domElement)return void a.setElementStyleByView(e);var r=this.context,i=e.scaleX,n=e.scaleY;if(e===this.stage){var s=this.canvas.style,c=e._scaleX,h=e._scaleY;(!c&&1!=i||c&&c!=i)&&(e._scaleX=i,s.width=i*e.width+"px"),(!h&&1!=n||h&&h!=n)&&(e._scaleY=n,s.height=n*e.height+"px")}else{var l=e.x,o=e.y,d=e.pivotX,v=e.pivotY,f=e.rotation%360,u=e.mask;u&&(u._render(this),r.clip());var g=e.align;if(g)if("function"==typeof g)e.align();else{var w=e.parent;if(w){var b=e.width,p=e.height,x=w.width,m=w.height;switch(g){case"TL":l=0,o=0;break;case"T":l=x-b>>1,o=0;break;case"TR":l=x-b,o=0;break;case"L":l=0,o=m-p>>1;break;case"C":l=x-b>>1,o=m-p>>1;break;case"R":l=x-b,o=m-p>>1;break;case"BL":l=0,o=m-p;break;case"B":l=x-b>>1,o=m-p;break;case"BR":l=x-b,o=m-p}}}0==l&&0==o||r.translate(l,o),0!=f&&r.rotate(f*Math.PI/180),1==i&&1==n||r.scale(i,n),0==d&&0==v||r.translate(-d,-v)}e.alpha>0&&(r.globalAlpha*=e.alpha)},remove:function(e){var t=e.drawable,a=t&&t.domElement;if(a){var r=a.parentNode;r&&r.removeChild(a)}},clear:function(e,t,a,r){this.context.clearRect(e,t,a,r)},resize:function(e,t){this.canvas.width=e,this.canvas.height=t}});return i},{requires:["hilo/core/Class","hilo/core/Hilo","hilo/renderer/Renderer"]}); \ No newline at end of file diff --git a/build/kissy/hilo/renderer/DOMRenderer.js b/build/kissy/hilo/renderer/DOMRenderer.js index 52e6e892..d6815011 100644 --- a/build/kissy/hilo/renderer/DOMRenderer.js +++ b/build/kissy/hilo/renderer/DOMRenderer.js @@ -1,20 +1,17 @@ /** - * Hilo 1.0.0 for kissy + * Hilo 1.0.1 for kissy * Copyright 2016 alibaba.com * Licensed under the MIT License */ KISSY.add('hilo/renderer/DOMRenderer', function(S, Class, Hilo, Renderer, Drawable){ -/** - * Hilo - * Copyright 2015 alibaba.com - * Licensed under the MIT License - */ + /** - * @class DOM+CSS3渲染器。将可视对象以DOM元素方式渲染出来。舞台Stage会根据参数canvas选择不同的渲染器,开发者无需直接使用此类。 + * @language=en + * @class DomRenderer The DomRenderer, all the visual object is drawing using dom element.The stage will create different renderer depend on the canvas and renderType properties, developer need not use this class directly. * @augments Renderer - * @param {Object} properties 创建对象的属性参数。可包含此类所有可写属性。 + * @param {Object} properties The properties to create a renderer, contains all writeable props of this class. * @module hilo/renderer/DOMRenderer * @requires hilo/core/Class * @requires hilo/core/Hilo @@ -133,10 +130,11 @@ return Class.create({ }); /** - * 创建一个可渲染的DOM,可指定tagName,如canvas或div。 - * @param {Object} view 一个可视对象或类似的对象。 - * @param {Object} imageObj 指定渲染的image及相关设置,如绘制区域rect。 - * @return {HTMLElement} 新创建的DOM对象。 + * @language=en + * Create a dom element, you can set the tagName property,such as canvas and div. + * @param {Object} view A visual object. + * @param {Object} imageObj The image object to render, include the image propertiy and other associated properties, such as rect. + * @return {HTMLElement} The created dom element. * @private */ function createDOMDrawable(view, imageObj){ diff --git a/build/kissy/hilo/renderer/DOMRenderer.min.js b/build/kissy/hilo/renderer/DOMRenderer.min.js index 42865a9b..7d5775a6 100644 --- a/build/kissy/hilo/renderer/DOMRenderer.min.js +++ b/build/kissy/hilo/renderer/DOMRenderer.min.js @@ -1,5 +1,5 @@ /** - * Hilo 1.0.0 for kissy + * Hilo 1.0.1 for kissy * Copyright 2016 alibaba.com * Licensed under the MIT License */ diff --git a/build/kissy/hilo/renderer/Renderer.js b/build/kissy/hilo/renderer/Renderer.js index 4dd34790..caf70455 100644 --- a/build/kissy/hilo/renderer/Renderer.js +++ b/build/kissy/hilo/renderer/Renderer.js @@ -1,25 +1,22 @@ /** - * Hilo 1.0.0 for kissy + * Hilo 1.0.1 for kissy * Copyright 2016 alibaba.com * Licensed under the MIT License */ KISSY.add('hilo/renderer/Renderer', function(S, Hilo, Class){ -/** - * Hilo - * Copyright 2015 alibaba.com - * Licensed under the MIT License - */ + /** - * @class 渲染器抽象基类。 - * @param {Object} properties 创建对象的属性参数。可包含此类所有可写属性。 + * @language=en + * @class Renderer Renderer is the base class of renderer. + * @param {Object} properties The properties to create a renderer, contains all writeable props of this class. * @module hilo/renderer/Renderer * @requires hilo/core/Hilo * @requires hilo/core/Class - * @property {Object} canvas 渲染器对应的画布。它可能是一个普通的DOM元素,比如div,也可以是一个canvas画布元素。只读属性。 - * @property {Object} stage 渲染器对应的舞台。只读属性。 - * @property {String} renderType 渲染方式。只读属性。 + * @property {Object} canvas The canvas of renderer. It can be a dom element, such as a div element, or a canvas element. readonly. + * @property {Object} stage The stage of renderer, readonly. + * @property {String} renderType The render type of renderer, readonly. */ var Renderer = Class.create(/** @lends Renderer.prototype */{ constructor: function(properties){ @@ -32,52 +29,60 @@ var Renderer = Class.create(/** @lends Renderer.prototype */{ stage: null, /** - * 为开始绘制可视对象做准备。需要子类来实现。 - * @param {View} target 要绘制的可视对象。 + * @language=en + * Prepare for draw visual object. The subclass need to implement it. + * @param {View} target The visual target to draw. */ startDraw: function(target){ }, /** - * 绘制可视对象。需要子类来实现。 - * @param {View} target 要绘制的可视对象。 + * @language=en + * Draw the visual object. The subclass need to implement it. + * @param {View} target The visual target to draw. */ draw: function(target){ }, /** - * 结束绘制可视对象后的后续处理方法。需要子类来实现。 - * @param {View} target 要绘制的可视对象。 + * @language=en + * The handling method after draw the visual object. The subclass need to implement it. + * @param {View} target The visual target to draw. */ endDraw: function(target){ }, /** - * 对可视对象进行变换。需要子类来实现。 + * @language=en + * Transfrom the visual object. The subclass need to implement it. */ transform: function(){ }, /** - * 隐藏可视对象。需要子类来实现。 + * @language=en + * Hide the visual object. The subclass need to implement it. */ hide: function(){ }, /** - * 从画布中删除可视对象。注意:不是从stage中删除对象。需要子类来实现。 - * @param {View} target 要删除的可视对象。 + * @language=en + * Remove the visual object from canvas. Notice that it dosen't remove the object from stage. The subclass need to implement it. + * @param {View} target The visual target to remove. */ remove: function(target){ }, /** - * 清除画布指定区域。需要子类来实现。 - * @param {Number} x 指定区域的x轴坐标。 - * @param {Number} y 指定区域的y轴坐标。 - * @param {Number} width 指定区域的宽度。 - * @param {Number} height 指定区域的高度。 + * @language=en + * Clear the given region of canvas. The subclass need to implement it. + * @param {Number} x The position on the x axis of the given region. + * @param {Number} y The position on the y axis of the given region. + * @param {Number} width The width of the given region. + * @param {Number} height The height of the given region. */ clear: function(x, y, width, height){ }, /** - * 改变渲染器的画布大小。 - * @param {Number} width 指定渲染画布新的宽度。 - * @param {Number} height 指定渲染画布新的高度。 + * @language=en + * Resize the renderer's canvas. + * @param {Number} width The width of renderer's canvas. + * @param {Number} height The height of the renderer's canvas. */ resize: function(width, height){ } diff --git a/build/kissy/hilo/renderer/Renderer.min.js b/build/kissy/hilo/renderer/Renderer.min.js index 5aaab594..2605989d 100644 --- a/build/kissy/hilo/renderer/Renderer.min.js +++ b/build/kissy/hilo/renderer/Renderer.min.js @@ -1,5 +1,5 @@ /** - * Hilo 1.0.0 for kissy + * Hilo 1.0.1 for kissy * Copyright 2016 alibaba.com * Licensed under the MIT License */ diff --git a/build/kissy/hilo/renderer/WebGLRenderer.js b/build/kissy/hilo/renderer/WebGLRenderer.js index 88e115f1..5b538d16 100644 --- a/build/kissy/hilo/renderer/WebGLRenderer.js +++ b/build/kissy/hilo/renderer/WebGLRenderer.js @@ -1,15 +1,11 @@ /** - * Hilo 1.0.0 for kissy + * Hilo 1.0.1 for kissy * Copyright 2016 alibaba.com * Licensed under the MIT License */ KISSY.add('hilo/renderer/WebGLRenderer', function(S, Class, Renderer, Matrix){ -/** - * Hilo - * Copyright 2015 alibaba.com - * Licensed under the MIT License - */ + /** * Heavily inspired by PIXI's SpriteRenderer: @@ -18,33 +14,37 @@ KISSY.add('hilo/renderer/WebGLRenderer', function(S, Class, Renderer, Matrix){ var DEG2RAD = Math.PI / 180; /** - * @class webgl画布渲染器。所有可视对象将渲染在canvas画布上。 + * @language=en + * @class WebGLRenderer The WebGLRenderer, all the visual object is drawing on the canvas using WebGL.The stage will create different renderer depend on the canvas and renderType properties, developer need not use this class directly. * @augments Renderer - * @param {Object} properties 创建对象的属性参数。可包含此类所有可写属性。 + * @param {Object} properties The properties to create a renderer, contains all writeable props of this class. * @module hilo/renderer/WebGLRenderer * @requires hilo/core/Class * @requires hilo/renderer/Renderer * @requires hilo/geom/Matrix - * @property {WebGLRenderingContext} gl webgl上下文。只读属性。 + * @property {WebGLRenderingContext} gl The WebGL context of the renderer, readonly. */ var WebGLRenderer = Class.create(/** @lends WebGLRenderer.prototype */{ Extends: Renderer, Statics:/** @lends WebGLRenderer */{ /** - * 最大批渲染数量。 + * @language=en + * The max num of batch draw, default is 2000. * @type {Number} */ MAX_BATCH_NUM:2000, /** - * 顶点属性数。只读属性。 + * @language=en + * The num of vertex attributes, readonly. * @type {Number} */ ATTRIBUTE_NUM:5, /** - * 是否支持WebGL。只读属性。 + * @language=en + * is WebGL supported, readonly. * @type {Boolean} */ - isSupport:null + isSupported:null }, renderType:'webgl', gl:null, @@ -109,7 +109,6 @@ var WebGLRenderer = Class.create(/** @lends WebGLRenderer.prototype */{ } return false; }, - /** * @private * @see Renderer#draw @@ -400,6 +399,7 @@ var WebGLRenderer = Class.create(/** @lends WebGLRenderer.prototype */{ }); /** + * @language=en * shader * @param {WebGLRenderer} renderer [description] * @param {Object} source @@ -519,21 +519,15 @@ Shader.prototype = { } }; -WebGLRenderer.isSupport = function(){ - if(this._isSupport !== undefined){ - return this._isSupport; +WebGLRenderer.isSupported = (function(){ + var canvas = document.createElement('canvas'); + if(canvas.getContext && (canvas.getContext('webgl')||canvas.getContext('experimental-webgl'))){ + return true; } else{ - var canvas = document.createElement('canvas'); - if(canvas.getContext && (canvas.getContext('webgl')||canvas.getContext('experimental-webgl'))){ - this._isSupport = true; - } - else{ - this._isSupport = false; - } - return this._isSupport; + return false; } -}; +})(); return WebGLRenderer; diff --git a/build/kissy/hilo/renderer/WebGLRenderer.min.js b/build/kissy/hilo/renderer/WebGLRenderer.min.js index 3eb0058d..779eca10 100644 --- a/build/kissy/hilo/renderer/WebGLRenderer.min.js +++ b/build/kissy/hilo/renderer/WebGLRenderer.min.js @@ -1,6 +1,6 @@ /** - * Hilo 1.0.0 for kissy + * Hilo 1.0.1 for kissy * Copyright 2016 alibaba.com * Licensed under the MIT License */ -KISSY.add("hilo/renderer/WebGLRenderer",function(t,e,r,i){var a=Math.PI/180,n=e.create({Extends:r,Statics:{MAX_BATCH_NUM:2e3,ATTRIBUTE_NUM:5,isSupport:null},renderType:"webgl",gl:null,constructor:function(t){window.__render=this,n.superclass.constructor.call(this,t);var e=this.gl=this.canvas.getContext("webgl")||this.canvas.getContext("experimental-webgl");this.maxBatchNum=n.MAX_BATCH_NUM,this.positionStride=4*n.ATTRIBUTE_NUM;var r=this.maxBatchNum*n.ATTRIBUTE_NUM*4,i=6*this.maxBatchNum;this.positions=new Float32Array(r),this.indexs=new Uint16Array(i);for(var a=0,s=0;i>a;a+=6,s+=4)this.indexs[a+0]=s+0,this.indexs[a+1]=s+1,this.indexs[a+2]=s+2,this.indexs[a+3]=s+1,this.indexs[a+4]=s+2,this.indexs[a+5]=s+3;this.batchIndex=0,this.sprites=[],e.blendFunc(e.ONE,e.ONE_MINUS_SRC_ALPHA),e.clearColor(0,0,0,0),e.disable(e.DEPTH_TEST),e.disable(e.CULL_FACE),e.enable(e.BLEND),this._initShaders(),this.defaultShader.active(),this.positionBuffer=e.createBuffer(),this.indexBuffer=e.createBuffer(),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,this.indexBuffer),e.bufferData(e.ELEMENT_ARRAY_BUFFER,this.indexs,e.STATIC_DRAW),e.bindBuffer(e.ARRAY_BUFFER,this.positionBuffer),e.bufferData(e.ARRAY_BUFFER,this.positions,e.DYNAMIC_DRAW),e.vertexAttribPointer(this.a_position,2,e.FLOAT,!1,this.positionStride,0),e.vertexAttribPointer(this.a_TexCoord,2,e.FLOAT,!1,this.positionStride,8),e.vertexAttribPointer(this.a_alpha,1,e.FLOAT,!1,this.positionStride,16)},context:null,startDraw:function(t){return t.visible&&t.alpha>0?(t===this.stage&&this.clear(),!0):!1},draw:function(t){var e=(this.context,t.width),r=t.height,i=(t.background,t.drawable),a=i&&i.image;if(a){this.gl;a.texture||this.activeShader.uploadTexture(a);var n=i.rect,s=n[2],o=n[3];n[4],n[5];e||r||(e=t.width=s,r=t.height=o),this.batchIndex>=this.maxBatchNum&&this._renderBatches();var h=this._createVertexs(a,n[0],n[1],s,o,0,0,e,r),l=this.batchIndex*this.positionStride,_=this.positions,d=t.__webglRenderAlpha;_[l+0]=h[0],_[l+1]=h[1],_[l+2]=h[2],_[l+3]=h[3],_[l+4]=d,_[l+5]=h[4],_[l+6]=h[5],_[l+7]=h[6],_[l+8]=h[7],_[l+9]=d,_[l+10]=h[8],_[l+11]=h[9],_[l+12]=h[10],_[l+13]=h[11],_[l+14]=d,_[l+15]=h[12],_[l+16]=h[13],_[l+17]=h[14],_[l+18]=h[15],_[l+19]=d;for(var c=t.__webglWorldMatrix,u=0;4>u;u++){var f=_[l+5*u],p=_[l+5*u+1];_[l+5*u]=c.a*f+c.c*p+c.tx,_[l+5*u+1]=c.b*f+c.d*p+c.ty}t.texture=a.texture,this.sprites[this.batchIndex++]=t}},endDraw:function(t){t===this.stage&&this._renderBatches()},transform:function(t){var e=t.drawable;if(e&&e.domElement)return void Hilo.setElementStyleByView(t);var r=(this.context,t.scaleX),a=t.scaleY;if(t===this.stage){var n=this.canvas.style,s=t._scaleX,o=t._scaleY;(!s&&1!=r||s&&s!=r)&&(t._scaleX=r,n.width=r*t.width+"px"),(!o&&1!=a||o&&o!=a)&&(t._scaleY=a,n.height=a*t.height+"px"),t.__webglWorldMatrix=t.__webglWorldMatrix||new i(1,0,0,1,0,0)}else t.__webglWorldMatrix=t.__webglWorldMatrix||new i(1,0,0,1,0,0),this._setConcatenatedMatrix(t,t.parent);t.alpha>0&&(t.parent&&t.parent.__webglRenderAlpha?t.__webglRenderAlpha=t.alpha*t.parent.__webglRenderAlpha:t.__webglRenderAlpha=t.alpha)},remove:function(t){var e=t.drawable,r=e&&e.domElement;if(r){var i=r.parentNode;i&&i.removeChild(r)}},clear:function(t,e,r,i){this.gl.clear(this.gl.COLOR_BUFFER_BIT)},resize:function(t,e){(this.width!==t||this.height!==e)&&(this.width=this.canvas.width=t,this.height=this.canvas.height=e,this.gl.viewport(0,0,t,e),this.canvasHalfWidth=.5*t,this.canvasHalfHeight=.5*e,this._uploadProjectionTransform(!0))},_renderBatches:function(){var t=this.gl;t.bufferSubData(t.ARRAY_BUFFER,0,this.positions.subarray(0,this.batchIndex*this.positionStride));for(var e=0,r=0,i=null,a=0;a
- * ticker.addTick(Hilo.Tween);//需要把Tween加到ticker里才能使用 + * ticker.addTick(Hilo.Tween);//Tween works after being added to ticker * * var view = new View({x:5, y:10}); * Hilo.Tween.to(view, { @@ -32,26 +29,26 @@ KISSY.add('hilo/tween/Tween', function(S, Class){ * } * }); *- * @class Tween类提供缓动功能。 - * @param {Object} target 缓动对象。 - * @param {Object} fromProps 对象缓动的起始属性集合。 - * @param {Object} toProps 对象缓动的目标属性集合。 - * @param {Object} params 缓动参数。可包含Tween类所有可写属性。 + * @class Tween class makes tweening (easing, slow motion). + * @param {Object} target Tween target object. + * @param {Object} fromProps Beginning properties of target tweening object. + * @param {Object} toProps Ending properties of target tweening object. + * @param {Object} params Tweening parameters, include all writable Tween class properties. * @module hilo/tween/Tween * @requires hilo/core/Class - * @property {Object} target 缓动目标。只读属性。 - * @property {Int} duration 缓动总时长。单位毫秒。 - * @property {Int} delay 缓动延迟时间。单位毫秒。 - * @property {Boolean} paused 缓动是否暂停。默认为false。 - * @property {Boolean} loop 缓动是否循环。默认为false。 - * @property {Boolean} reverse 缓动是否反转播放。默认为false。 - * @property {Int} repeat 缓动重复的次数。默认为0。 - * @property {Int} repeatDelay 缓动重复的延迟时长。单位为毫秒。 - * @property {Function} ease 缓动变化函数。默认为null。 - * @property {Int} time 缓动已进行的时长。单位毫秒。只读属性。 - * @property {Function} onStart 缓动开始回调函数。它接受1个参数:tween。默认值为null。 - * @property {Function} onUpdate 缓动更新回调函数。它接受2个参数:ratio和tween。默认值为null。 - * @property {Function} onComplete 缓动结束回调函数。它接受1个参数:tween。默认值为null。 + * @property {Object} target Tween target object, readonly! + * @property {Int} duration Tweening duration, measure in ms. + * @property {Int} delay Tweenning delay time, measure in ms. + * @property {Boolean} paused Is tweening paused, default value is false. + * @property {Boolean} loop Does tweening loop, default value is false. + * @property {Boolean} reverse Does tweening reverse, default value is false. + * @property {Int} repeat Repeat times of tweening, default value is 0. + * @property {Int} repeatDelay Delay time of repeating tweening, measure in ms. + * @property {Function} ease Tweening transform function, default value is null. + * @property {Int} time Time that tweening taken, measure in ms, readonly! + * @property {Function} onStart Function invoked on the beginning of tweening. Require 1 parameter: tween. default value is null. + * @property {Function} onUpdate Function invoked on tweening update. Require 2 parameters: ratio, tween. default value is null. + * @property {Function} onComplete Function invoked on the end of tweening. Require 1 parameter: tween. default value is null. */ var Tween = (function(){ @@ -104,10 +101,11 @@ return Class.create(/** @lends Tween.prototype */{ onComplete: null, /** - * 设置缓动对象的初始和目标属性。 - * @param {Object} fromProps 缓动对象的初始属性。 - * @param {Object} toProps 缓动对象的目标属性。 - * @returns {Tween} Tween变换本身。可用于链式调用。 + * @language=en + * Set beginning properties and ending properties of tweening object. + * @param {Object} fromProps Beginning properties of target tweening object. + * @param {Object} toProps Ending properties of target tweening object. + * @returns {Tween} Current Tween, for chain calls. */ setProps: function(fromProps, toProps){ var me = this, target = me.target, @@ -125,8 +123,9 @@ return Class.create(/** @lends Tween.prototype */{ }, /** - * 启动缓动动画的播放。 - * @returns {Tween} Tween变换本身。可用于链式调用。 + * @language=en + * Starting the tweening. + * @returns {Tween} Current Tween, for chain calls. */ start: function(){ var me = this; @@ -139,8 +138,9 @@ return Class.create(/** @lends Tween.prototype */{ }, /** - * 停止缓动动画的播放。 - * @returns {Tween} Tween变换本身。可用于链式调用。 + * @language=en + * Stop the tweening. + * @returns {Tween} Current Tween, for chain calls. */ stop: function(){ Tween.remove(this); @@ -148,8 +148,9 @@ return Class.create(/** @lends Tween.prototype */{ }, /** - * 暂停缓动动画的播放。 - * @returns {Tween} Tween变换本身。可用于链式调用。 + * @language=en + * Pause the tweening. + * @returns {Tween} Current Tween, for chain calls. */ pause: function(){ var me = this; @@ -159,8 +160,9 @@ return Class.create(/** @lends Tween.prototype */{ }, /** - * 恢复缓动动画的播放。 - * @returns {Tween} Tween变换本身。可用于链式调用。 + * @language=en + * Continue to play the tweening. + * @returns {Tween} Current Tween, for chain calls. */ resume: function(){ var me = this; @@ -171,10 +173,11 @@ return Class.create(/** @lends Tween.prototype */{ }, /** - * 跳转Tween到指定的时间。 - * @param {Number} time 指定要跳转的时间。取值范围为:0 - duraion。 - * @param {Boolean} pause 是否暂停。 - * @returns {Tween} Tween变换本身。可用于链式调用。 + * @language=en + * Tween jumps to some point. + * @param {Number} time The time to jump to, range from 0 to duration. + * @param {Boolean} pause Is paused. + * @returns {Tween} Current Tween, for chain calls. */ seek: function(time, pause){ var me = this, current = now(); @@ -188,9 +191,10 @@ return Class.create(/** @lends Tween.prototype */{ }, /** - * 连接下一个Tween变换。其开始时间根据delay值不同而不同。当delay值为字符串且以'+'或'-'开始时,Tween的开始时间从当前变换结束点计算,否则以当前变换起始点计算。 - * @param {Tween} tween 要连接的Tween变换。 - * @returns {Tween} Tween变换本身。可用于链式调用。 + * @language=en + * Link next Tween. The beginning time of next Tween depends on the delay value. If delay is a string that begins with '+' or '-', next Tween will begin at (delay) ms after or before the current tween is ended. If delay is out of previous situation, next Tween will begin at (delay) ms after the beginning point of current Tween. + * @param {Tween} tween Tween to link. + * @returns {Tween} Current Tween, for chain calls. */ link: function(tween){ var me = this, delay = tween.delay, startTime = me._startTime; @@ -208,7 +212,8 @@ return Class.create(/** @lends Tween.prototype */{ }, /** - * Tween类的内部渲染方法。 + * @language=en + * Private render method inside Tween class. * @private */ _render: function(ratio){ @@ -217,7 +222,8 @@ return Class.create(/** @lends Tween.prototype */{ }, /** - * Tween类的内部更新方法。 + * @language=en + * Private update method inside Tween class. * @private */ _update: function(time, forceUpdate){ @@ -294,12 +300,14 @@ return Class.create(/** @lends Tween.prototype */{ Statics: /** @lends Tween */ { /** + * @language=en * @private */ _tweens: [], /** - * 更新所有Tween实例。 + * @language=en + * Update all Tween instances. * @returns {Object} Tween。 */ tick: function(){ @@ -316,8 +324,9 @@ return Class.create(/** @lends Tween.prototype */{ }, /** - * 添加Tween实例。 - * @param {Tween} tween 要添加的Tween对象。 + * @language=en + * Add a Tween instance. + * @param {Tween} tween Tween object to add. * @returns {Object} Tween。 */ add: function(tween){ @@ -327,8 +336,9 @@ return Class.create(/** @lends Tween.prototype */{ }, /** - * 删除Tween实例。 - * @param {Tween|Object|Array} tweenOrTarget 要删除的Tween对象或target对象或要删除的一组对象。 + * @language=en + * Remove one Tween target. + * @param {Tween|Object|Array} tweenOrTarget Tween object, target object or an array of object to remove * @returns {Object} Tween。 */ remove: function(tweenOrTarget){ @@ -356,7 +366,8 @@ return Class.create(/** @lends Tween.prototype */{ }, /** - * 删除所有Tween实例。 + * @language=en + * Remove all Tween instances. * @returns {Object} Tween。 */ removeAll: function(){ @@ -365,12 +376,13 @@ return Class.create(/** @lends Tween.prototype */{ }, /** - * 创建一个缓动动画,让目标对象从开始属性变换到目标属性。 - * @param {Object|Array} target 缓动目标对象或缓动目标数组。 - * @param fromProps 缓动目标对象的开始属性。 - * @param toProps 缓动目标对象的目标属性。 - * @param params 缓动动画的参数。 - * @returns {Tween|Array} 一个Tween实例对象或Tween实例数组。 + * @language=en + * Create a tween, make target object easing from beginning properties to ending properties. + * @param {Object|Array} target Tweening target or tweening target array. + * @param fromProps Beginning properties of target tweening object. + * @param toProps Ending properties of target tweening object. + * @param params Tweening parameters. + * @returns {Tween|Array} An tween instance or an array of tween instance. */ fromTo: function(target, fromProps, toProps, params){ var isArray = target instanceof Array; @@ -388,22 +400,24 @@ return Class.create(/** @lends Tween.prototype */{ }, /** - * 创建一个缓动动画,让目标对象从当前属性变换到目标属性。 - * @param {Object|Array} target 缓动目标对象或缓动目标数组。 - * @param toProps 缓动目标对象的目标属性。 - * @param params 缓动动画的参数。 - * @returns {Tween|Array} 一个Tween实例对象或Tween实例数组。 + * @language=en + * Create a tween, make target object easing from current properties to ending properties. + * @param {Object|Array} target Tweening target or tweening target array. + * @param toProps Ending properties of target tweening object. + * @param params Tweening parameters. + * @returns {Tween|Array} An tween instance or an array of tween instance. */ to: function(target, toProps, params){ return Tween.fromTo(target, null, toProps, params); }, /** - * 创建一个缓动动画,让目标对象从指定的起始属性变换到当前属性。 - * @param {Object|Array} target 缓动目标对象或缓动目标数组。 - * @param fromProps 缓动目标对象的目标属性。 - * @param params 缓动动画的参数。 - * @returns {Tween|Array} 一个Tween实例对象或Tween实例数组。 + * @language=en + * Create a tween, make target object easing from beginning properties to current properties. + * @param {Object|Array} target Tweening target or tweening target array. + * @param fromProps Beginning properties of target tweening object. + * @param params Tweening parameters. + * @returns {Tween|Array} An tween instance or an array of tween instance. */ from: function(target, fromProps, params){ return Tween.fromTo(target, fromProps, null, params); @@ -414,6 +428,7 @@ return Class.create(/** @lends Tween.prototype */{ })(); + return Tween; }, { diff --git a/build/kissy/hilo/tween/Tween.min.js b/build/kissy/hilo/tween/Tween.min.js index 98d71d04..13bf9e68 100644 --- a/build/kissy/hilo/tween/Tween.min.js +++ b/build/kissy/hilo/tween/Tween.min.js @@ -1,5 +1,5 @@ /** - * Hilo 1.0.0 for kissy + * Hilo 1.0.1 for kissy * Copyright 2016 alibaba.com * Licensed under the MIT License */ diff --git a/build/kissy/hilo/util/TextureAtlas.js b/build/kissy/hilo/util/TextureAtlas.js index 0552ad00..18aeaedd 100644 --- a/build/kissy/hilo/util/TextureAtlas.js +++ b/build/kissy/hilo/util/TextureAtlas.js @@ -1,17 +1,14 @@ /** - * Hilo 1.0.0 for kissy + * Hilo 1.0.1 for kissy * Copyright 2016 alibaba.com * Licensed under the MIT License */ KISSY.add('hilo/util/TextureAtlas', function(S, Class){ -/** - * Hilo - * Copyright 2015 alibaba.com - * Licensed under the MIT License - */ + /** + * @language=en * @class TextureAtlas纹理集是将许多小的纹理图片整合到一起的一张大图。这个类可根据一个纹理集数据读取纹理小图、精灵动画等。 * @param {Object} atlasData 纹理集数据。它可包含如下数据: *
* var bmp = new Bitmap({image:img}); * Hilo.copy(bmp, Hilo.drag); * bmp.startDrag([0, 0, 550, 400]); *- * @class drag是一个包含拖拽功能的mixin。可以通过 Class.mix(view, drag)或Hilo.copy(view, drag)来为view增加拖拽功能。 + * @class drag A mixin that contains drag method.You can mix drag method to the visual target by use Class.mix(target, drag) or Hilo.copy(target, drag). * @mixin * @static * @module hilo/util/drag @@ -29,8 +26,9 @@ KISSY.add('hilo/util/drag', function(S, Class, Hilo){ */ var drag = { /** - * 开始拖拽 - * @param {Array} bounds 拖拽范围,基于父容器坐标系,[x, y, width, height], 默认无限制 + * @language=en + * start drag. + * @param {Array} bounds The bounds area that the view can move, relative to the coordinates of the view's parent, [x, y, width, height], default is no limit. */ startDrag:function(bounds){ var that = this; @@ -101,7 +99,8 @@ var drag = { that.stopDrag = stopDrag; }, /** - * 停止拖拽 + * @language=en + * stop drag. */ stopDrag:function(){ diff --git a/build/kissy/hilo/util/drag.min.js b/build/kissy/hilo/util/drag.min.js index 5170c7a6..b84d6b0a 100644 --- a/build/kissy/hilo/util/drag.min.js +++ b/build/kissy/hilo/util/drag.min.js @@ -1,5 +1,5 @@ /** - * Hilo 1.0.0 for kissy + * Hilo 1.0.1 for kissy * Copyright 2016 alibaba.com * Licensed under the MIT License */ diff --git a/build/kissy/hilo/util/polyfill.js b/build/kissy/hilo/util/polyfill.js index 05df8a3a..7e242bff 100644 --- a/build/kissy/hilo/util/polyfill.js +++ b/build/kissy/hilo/util/polyfill.js @@ -1,15 +1,11 @@ /** - * Hilo 1.0.0 for kissy + * Hilo 1.0.1 for kissy * Copyright 2016 alibaba.com * Licensed under the MIT License */ KISSY.add(function(S){ -/** - * Hilo - * Copyright 2015 alibaba.com - * Licensed under the MIT License - */ + var arrayProto = Array.prototype, slice = arrayProto.slice; diff --git a/build/kissy/hilo/util/polyfill.min.js b/build/kissy/hilo/util/polyfill.min.js index 8bb629b7..51535f4d 100644 --- a/build/kissy/hilo/util/polyfill.min.js +++ b/build/kissy/hilo/util/polyfill.min.js @@ -1,5 +1,5 @@ /** - * Hilo 1.0.0 for kissy + * Hilo 1.0.1 for kissy * Copyright 2016 alibaba.com * Licensed under the MIT License */ diff --git a/build/kissy/hilo/view/Bitmap.js b/build/kissy/hilo/view/Bitmap.js index 0d6de7e0..70d2227a 100644 --- a/build/kissy/hilo/view/Bitmap.js +++ b/build/kissy/hilo/view/Bitmap.js @@ -1,30 +1,27 @@ /** - * Hilo 1.0.0 for kissy + * Hilo 1.0.1 for kissy * Copyright 2016 alibaba.com * Licensed under the MIT License */ KISSY.add('hilo/view/Bitmap', function(S, Hilo, Class, View, Drawable){ -/** - * Hilo - * Copyright 2015 alibaba.com - * Licensed under the MIT License - */ + /** + * @language=en * *
* var bmp = new Hilo.Bitmap({image:imgElem, rect:[0, 0, 100, 100]}); * stage.addChild(bmp); *- * @class Bitmap类表示位图图像类。 + * @class Bitmap * @augments View - * @param {Object} properties 创建对象的属性参数。可包含此类所有可写属性。此外还包括: + * @param {Object} properties the options of create Instance.It can contains all writable property and Moreover: *
* var btn = new Hilo.Button({ * image: buttonImage, @@ -24,24 +21,24 @@ KISSY.add('hilo/view/Button', function(S, Hilo, Class, View, Drawable){ * disabledState: {rect:[192, 0, 64, 64]} * }); *- * @class Button类表示简单按钮类。它有弹起、经过、按下和不可用等四种状态。 + * @class Button class is a simple button class, contains four kinds of state: 'up', 'over', 'down', 'disabled' * @augments View - * @param {Object} properties 创建对象的属性参数。可包含此类所有可写属性。此外还包括: + * @param {Object} properties create object properties. Contains all writable properties. Also contains: *
* var domView = new Hilo.DOMElement({ * element: Hilo.createElement('div', { @@ -30,11 +27,11 @@ KISSY.add('hilo/view/DOMElement', function(S, Hilo, Class, View, Drawable){ * }).addTo(stage); ** @name DOMElement - * @class DOMElement是dom元素的包装。 + * @class DOMElement is a wrapper of dom element. * @augments View - * @param {Object} properties 创建对象的属性参数。可包含此类所有可写属性。特殊属性有: + * @param {Object} properties create Objects properties. Contains all writable properties in this class. Special properties include: *
var path = 'M250 150 L150 350 L350 350 Z';
*var shape = new Hilo.Graphics({width:500, height:500});
*shape.drawSVGPath(path).beginFill('#0ff').endFill();
- * @param {String} pathData 要绘制的SVG路径数据。 - * @returns {Graphics} Graphics对象本身。 + * @param {String} pathData The SVG path data to draw. + * @returns {Graphics} The Graphics Object. */ drawSVGPath: function(pathData){ var me = this, addAction = me._addAction, @@ -350,7 +365,8 @@ return Class.create(/** @lends Graphics.prototype */{ }, /** - * 执行全部绘制动作。内部私有方法。 + * @language=en + * Apply all draw actions. private function. * @private */ _draw: function(context){ @@ -368,7 +384,8 @@ return Class.create(/** @lends Graphics.prototype */{ }, /** - * 重写渲染实现。 + * @language=en + * Overwrite render function. * @private */ render: function(renderer, delta){ @@ -382,8 +399,9 @@ return Class.create(/** @lends Graphics.prototype */{ }, /** - * 清除所有绘制动作并复原所有初始状态。 - * @returns {Graphics} Graphics对象本身。 + * @language=en + * Clear all draw actions and reset to the initial state. + * @returns {Graphics} The Graphics Object. */ clear: function(){ var me = this; @@ -405,7 +423,8 @@ return Class.create(/** @lends Graphics.prototype */{ }, /** - * 添加一个绘制动作。内部私有方法。 + * @language=en + * Add a draw action, this is a private function. * @private */ _addAction: function(action){ @@ -418,6 +437,7 @@ return Class.create(/** @lends Graphics.prototype */{ })(); + return Graphics; }, { diff --git a/build/kissy/hilo/view/Graphics.min.js b/build/kissy/hilo/view/Graphics.min.js index ae12ba13..a90fafcd 100644 --- a/build/kissy/hilo/view/Graphics.min.js +++ b/build/kissy/hilo/view/Graphics.min.js @@ -1,5 +1,5 @@ /** - * Hilo 1.0.0 for kissy + * Hilo 1.0.1 for kissy * Copyright 2016 alibaba.com * Licensed under the MIT License */ diff --git a/build/kissy/hilo/view/Sprite.js b/build/kissy/hilo/view/Sprite.js index 6dc963d4..dc812757 100644 --- a/build/kissy/hilo/view/Sprite.js +++ b/build/kissy/hilo/view/Sprite.js @@ -1,35 +1,32 @@ /** - * Hilo 1.0.0 for kissy + * Hilo 1.0.1 for kissy * Copyright 2016 alibaba.com * Licensed under the MIT License */ KISSY.add('hilo/view/Sprite', function(S, Hilo, Class, View, Drawable){ -/** - * Hilo - * Copyright 2015 alibaba.com - * Licensed under the MIT License - */ + /** + * @language=en * ** var stage = new Hilo.Stage({ * renderType:'canvas', @@ -21,16 +18,16 @@ KISSY.add('hilo/view/Stage', function(S, Hilo, Class, Container, CanvasRenderer, * height: 480 * }); *- * @class 舞台是可视对象树的根,可视对象只有添加到舞台或其子对象后才会被渲染出来。创建一个hilo应用一般都是从创建一个stage开始的。 + * @class Stage is the root of all visual object tree, any visual object will be render only after being added to Stage or any children elements of Stage. Normally, every hilo application start with an stage instance. * @augments Container - * @param {Object} properties 创建对象的属性参数。可包含此类所有可写属性。主要有: + * @param {Object} properties Properties parameters for the object. Includes all writable properties of this class. Some important like: *
* var Bird = Hilo.Class.create({ * Extends: Animal, @@ -389,23 +398,24 @@ var Hilo = window.Hilo; * swallow.fly(); * Bird.isBird(swallow); *- * @namespace Class是提供类的创建的辅助工具。 + * @namespace Class Class is created to aid the developer. * @static * @module hilo/core/Class */ var Class = (function(){ /** - * 根据参数指定的属性和方法创建类。 - * @param {Object} properties 要创建的类的相关属性和方法。主要有: + * @language=en + * Create a class based on the parameters, properties and methods specified. + * @param {Object} properties Properties and methods to create the class. *
* var stage = new Hilo.Stage({ * renderType:'canvas', @@ -2814,16 +2862,16 @@ var WebGLRenderer = Hilo.WebGLRenderer; * height: 480 * }); *- * @class 舞台是可视对象树的根,可视对象只有添加到舞台或其子对象后才会被渲染出来。创建一个hilo应用一般都是从创建一个stage开始的。 + * @class Stage is the root of all visual object tree, any visual object will be render only after being added to Stage or any children elements of Stage. Normally, every hilo application start with an stage instance. * @augments Container - * @param {Object} properties 创建对象的属性参数。可包含此类所有可写属性。主要有: + * @param {Object} properties Properties parameters for the object. Includes all writable properties of this class. Some important like: *
* var bmp = new Hilo.Bitmap({image:imgElem, rect:[0, 0, 100, 100]}); * stage.addChild(bmp); *- * @class Bitmap类表示位图图像类。 + * @class Bitmap * @augments View - * @param {Object} properties 创建对象的属性参数。可包含此类所有可写属性。此外还包括: + * @param {Object} properties the options of create Instance.It can contains all writable property and Moreover: *
* var domView = new Hilo.DOMElement({ * element: Hilo.createElement('div', { @@ -3418,11 +3486,11 @@ var Drawable = Hilo.Drawable; * }).addTo(stage); ** @name DOMElement - * @class DOMElement是dom元素的包装。 + * @class DOMElement is a wrapper of dom element. * @augments View - * @param {Object} properties 创建对象的属性参数。可包含此类所有可写属性。特殊属性有: + * @param {Object} properties create Objects properties. Contains all writable properties in this class. Special properties include: *
var path = 'M250 150 L150 350 L350 350 Z';
*var shape = new Hilo.Graphics({width:500, height:500});
*shape.drawSVGPath(path).beginFill('#0ff').endFill();
- * @param {String} pathData 要绘制的SVG路径数据。 - * @returns {Graphics} Graphics对象本身。 + * @param {String} pathData The SVG path data to draw. + * @returns {Graphics} The Graphics Object. */ drawSVGPath: function(pathData){ var me = this, addAction = me._addAction, @@ -3837,7 +3926,8 @@ return Class.create(/** @lends Graphics.prototype */{ }, /** - * 执行全部绘制动作。内部私有方法。 + * @language=en + * Apply all draw actions. private function. * @private */ _draw: function(context){ @@ -3855,7 +3945,8 @@ return Class.create(/** @lends Graphics.prototype */{ }, /** - * 重写渲染实现。 + * @language=en + * Overwrite render function. * @private */ render: function(renderer, delta){ @@ -3869,8 +3960,9 @@ return Class.create(/** @lends Graphics.prototype */{ }, /** - * 清除所有绘制动作并复原所有初始状态。 - * @returns {Graphics} Graphics对象本身。 + * @language=en + * Clear all draw actions and reset to the initial state. + * @returns {Graphics} The Graphics Object. */ clear: function(){ var me = this; @@ -3892,7 +3984,8 @@ return Class.create(/** @lends Graphics.prototype */{ }, /** - * 添加一个绘制动作。内部私有方法。 + * @language=en + * Add a draw action, this is a private function. * @private */ _addAction: function(action){ @@ -3904,10 +3997,11 @@ return Class.create(/** @lends Graphics.prototype */{ }); })(); + Hilo.Graphics = Graphics; })(window); /** - * Hilo 1.0.0 for standalone + * Hilo 1.0.1 for standalone * Copyright 2016 alibaba.com * Licensed under the MIT License */ @@ -3916,33 +4010,30 @@ var Hilo = window.Hilo; var Class = Hilo.Class; var View = Hilo.View; var CacheMixin = Hilo.CacheMixin; -/** - * Hilo - * Copyright 2015 alibaba.com - * Licensed under the MIT License - */ + /** + * @language=en * ** var btn = new Hilo.Button({ * image: buttonImage, @@ -4358,24 +4454,24 @@ var Drawable = Hilo.Drawable; * disabledState: {rect:[192, 0, 64, 64]} * }); *- * @class Button类表示简单按钮类。它有弹起、经过、按下和不可用等四种状态。 + * @class Button class is a simple button class, contains four kinds of state: 'up', 'over', 'down', 'disabled' * @augments View - * @param {Object} properties 创建对象的属性参数。可包含此类所有可写属性。此外还包括: + * @param {Object} properties create object properties. Contains all writable properties. Also contains: *
* var bmp = new Bitmap({image:img}); * Hilo.copy(bmp, Hilo.drag); * bmp.startDrag([0, 0, 550, 400]); *- * @class drag是一个包含拖拽功能的mixin。可以通过 Class.mix(view, drag)或Hilo.copy(view, drag)来为view增加拖拽功能。 + * @class drag A mixin that contains drag method.You can mix drag method to the visual target by use Class.mix(target, drag) or Hilo.copy(target, drag). * @mixin * @static * @module hilo/util/drag @@ -4963,8 +5065,9 @@ var Class = Hilo.Class; */ var drag = { /** - * 开始拖拽 - * @param {Array} bounds 拖拽范围,基于父容器坐标系,[x, y, width, height], 默认无限制 + * @language=en + * start drag. + * @param {Array} bounds The bounds area that the view can move, relative to the coordinates of the view's parent, [x, y, width, height], default is no limit. */ startDrag:function(bounds){ var that = this; @@ -5035,7 +5138,8 @@ var drag = { that.stopDrag = stopDrag; }, /** - * 停止拖拽 + * @language=en + * stop drag. */ stopDrag:function(){ @@ -5044,25 +5148,22 @@ var drag = { Hilo.drag = drag; })(window); /** - * Hilo 1.0.0 for standalone + * Hilo 1.0.1 for standalone * Copyright 2016 alibaba.com * Licensed under the MIT License */ (function(window){ var Hilo = window.Hilo; var Class = Hilo.Class; -/** - * Hilo - * Copyright 2015 alibaba.com - * Licensed under the MIT License - */ + /** + * @language=en * *
- * ticker.addTick(Hilo.Tween);//需要把Tween加到ticker里才能使用 + * ticker.addTick(Hilo.Tween);//Tween works after being added to ticker * * var view = new View({x:5, y:10}); * Hilo.Tween.to(view, { @@ -5078,26 +5179,26 @@ var Class = Hilo.Class; * } * }); *- * @class Tween类提供缓动功能。 - * @param {Object} target 缓动对象。 - * @param {Object} fromProps 对象缓动的起始属性集合。 - * @param {Object} toProps 对象缓动的目标属性集合。 - * @param {Object} params 缓动参数。可包含Tween类所有可写属性。 + * @class Tween class makes tweening (easing, slow motion). + * @param {Object} target Tween target object. + * @param {Object} fromProps Beginning properties of target tweening object. + * @param {Object} toProps Ending properties of target tweening object. + * @param {Object} params Tweening parameters, include all writable Tween class properties. * @module hilo/tween/Tween * @requires hilo/core/Class - * @property {Object} target 缓动目标。只读属性。 - * @property {Int} duration 缓动总时长。单位毫秒。 - * @property {Int} delay 缓动延迟时间。单位毫秒。 - * @property {Boolean} paused 缓动是否暂停。默认为false。 - * @property {Boolean} loop 缓动是否循环。默认为false。 - * @property {Boolean} reverse 缓动是否反转播放。默认为false。 - * @property {Int} repeat 缓动重复的次数。默认为0。 - * @property {Int} repeatDelay 缓动重复的延迟时长。单位为毫秒。 - * @property {Function} ease 缓动变化函数。默认为null。 - * @property {Int} time 缓动已进行的时长。单位毫秒。只读属性。 - * @property {Function} onStart 缓动开始回调函数。它接受1个参数:tween。默认值为null。 - * @property {Function} onUpdate 缓动更新回调函数。它接受2个参数:ratio和tween。默认值为null。 - * @property {Function} onComplete 缓动结束回调函数。它接受1个参数:tween。默认值为null。 + * @property {Object} target Tween target object, readonly! + * @property {Int} duration Tweening duration, measure in ms. + * @property {Int} delay Tweenning delay time, measure in ms. + * @property {Boolean} paused Is tweening paused, default value is false. + * @property {Boolean} loop Does tweening loop, default value is false. + * @property {Boolean} reverse Does tweening reverse, default value is false. + * @property {Int} repeat Repeat times of tweening, default value is 0. + * @property {Int} repeatDelay Delay time of repeating tweening, measure in ms. + * @property {Function} ease Tweening transform function, default value is null. + * @property {Int} time Time that tweening taken, measure in ms, readonly! + * @property {Function} onStart Function invoked on the beginning of tweening. Require 1 parameter: tween. default value is null. + * @property {Function} onUpdate Function invoked on tweening update. Require 2 parameters: ratio, tween. default value is null. + * @property {Function} onComplete Function invoked on the end of tweening. Require 1 parameter: tween. default value is null. */ var Tween = (function(){ @@ -5150,10 +5251,11 @@ return Class.create(/** @lends Tween.prototype */{ onComplete: null, /** - * 设置缓动对象的初始和目标属性。 - * @param {Object} fromProps 缓动对象的初始属性。 - * @param {Object} toProps 缓动对象的目标属性。 - * @returns {Tween} Tween变换本身。可用于链式调用。 + * @language=en + * Set beginning properties and ending properties of tweening object. + * @param {Object} fromProps Beginning properties of target tweening object. + * @param {Object} toProps Ending properties of target tweening object. + * @returns {Tween} Current Tween, for chain calls. */ setProps: function(fromProps, toProps){ var me = this, target = me.target, @@ -5171,8 +5273,9 @@ return Class.create(/** @lends Tween.prototype */{ }, /** - * 启动缓动动画的播放。 - * @returns {Tween} Tween变换本身。可用于链式调用。 + * @language=en + * Starting the tweening. + * @returns {Tween} Current Tween, for chain calls. */ start: function(){ var me = this; @@ -5185,8 +5288,9 @@ return Class.create(/** @lends Tween.prototype */{ }, /** - * 停止缓动动画的播放。 - * @returns {Tween} Tween变换本身。可用于链式调用。 + * @language=en + * Stop the tweening. + * @returns {Tween} Current Tween, for chain calls. */ stop: function(){ Tween.remove(this); @@ -5194,8 +5298,9 @@ return Class.create(/** @lends Tween.prototype */{ }, /** - * 暂停缓动动画的播放。 - * @returns {Tween} Tween变换本身。可用于链式调用。 + * @language=en + * Pause the tweening. + * @returns {Tween} Current Tween, for chain calls. */ pause: function(){ var me = this; @@ -5205,8 +5310,9 @@ return Class.create(/** @lends Tween.prototype */{ }, /** - * 恢复缓动动画的播放。 - * @returns {Tween} Tween变换本身。可用于链式调用。 + * @language=en + * Continue to play the tweening. + * @returns {Tween} Current Tween, for chain calls. */ resume: function(){ var me = this; @@ -5217,10 +5323,11 @@ return Class.create(/** @lends Tween.prototype */{ }, /** - * 跳转Tween到指定的时间。 - * @param {Number} time 指定要跳转的时间。取值范围为:0 - duraion。 - * @param {Boolean} pause 是否暂停。 - * @returns {Tween} Tween变换本身。可用于链式调用。 + * @language=en + * Tween jumps to some point. + * @param {Number} time The time to jump to, range from 0 to duration. + * @param {Boolean} pause Is paused. + * @returns {Tween} Current Tween, for chain calls. */ seek: function(time, pause){ var me = this, current = now(); @@ -5234,9 +5341,10 @@ return Class.create(/** @lends Tween.prototype */{ }, /** - * 连接下一个Tween变换。其开始时间根据delay值不同而不同。当delay值为字符串且以'+'或'-'开始时,Tween的开始时间从当前变换结束点计算,否则以当前变换起始点计算。 - * @param {Tween} tween 要连接的Tween变换。 - * @returns {Tween} Tween变换本身。可用于链式调用。 + * @language=en + * Link next Tween. The beginning time of next Tween depends on the delay value. If delay is a string that begins with '+' or '-', next Tween will begin at (delay) ms after or before the current tween is ended. If delay is out of previous situation, next Tween will begin at (delay) ms after the beginning point of current Tween. + * @param {Tween} tween Tween to link. + * @returns {Tween} Current Tween, for chain calls. */ link: function(tween){ var me = this, delay = tween.delay, startTime = me._startTime; @@ -5254,7 +5362,8 @@ return Class.create(/** @lends Tween.prototype */{ }, /** - * Tween类的内部渲染方法。 + * @language=en + * Private render method inside Tween class. * @private */ _render: function(ratio){ @@ -5263,7 +5372,8 @@ return Class.create(/** @lends Tween.prototype */{ }, /** - * Tween类的内部更新方法。 + * @language=en + * Private update method inside Tween class. * @private */ _update: function(time, forceUpdate){ @@ -5340,12 +5450,14 @@ return Class.create(/** @lends Tween.prototype */{ Statics: /** @lends Tween */ { /** + * @language=en * @private */ _tweens: [], /** - * 更新所有Tween实例。 + * @language=en + * Update all Tween instances. * @returns {Object} Tween。 */ tick: function(){ @@ -5362,8 +5474,9 @@ return Class.create(/** @lends Tween.prototype */{ }, /** - * 添加Tween实例。 - * @param {Tween} tween 要添加的Tween对象。 + * @language=en + * Add a Tween instance. + * @param {Tween} tween Tween object to add. * @returns {Object} Tween。 */ add: function(tween){ @@ -5373,8 +5486,9 @@ return Class.create(/** @lends Tween.prototype */{ }, /** - * 删除Tween实例。 - * @param {Tween|Object|Array} tweenOrTarget 要删除的Tween对象或target对象或要删除的一组对象。 + * @language=en + * Remove one Tween target. + * @param {Tween|Object|Array} tweenOrTarget Tween object, target object or an array of object to remove * @returns {Object} Tween。 */ remove: function(tweenOrTarget){ @@ -5402,7 +5516,8 @@ return Class.create(/** @lends Tween.prototype */{ }, /** - * 删除所有Tween实例。 + * @language=en + * Remove all Tween instances. * @returns {Object} Tween。 */ removeAll: function(){ @@ -5411,12 +5526,13 @@ return Class.create(/** @lends Tween.prototype */{ }, /** - * 创建一个缓动动画,让目标对象从开始属性变换到目标属性。 - * @param {Object|Array} target 缓动目标对象或缓动目标数组。 - * @param fromProps 缓动目标对象的开始属性。 - * @param toProps 缓动目标对象的目标属性。 - * @param params 缓动动画的参数。 - * @returns {Tween|Array} 一个Tween实例对象或Tween实例数组。 + * @language=en + * Create a tween, make target object easing from beginning properties to ending properties. + * @param {Object|Array} target Tweening target or tweening target array. + * @param fromProps Beginning properties of target tweening object. + * @param toProps Ending properties of target tweening object. + * @param params Tweening parameters. + * @returns {Tween|Array} An tween instance or an array of tween instance. */ fromTo: function(target, fromProps, toProps, params){ var isArray = target instanceof Array; @@ -5434,22 +5550,24 @@ return Class.create(/** @lends Tween.prototype */{ }, /** - * 创建一个缓动动画,让目标对象从当前属性变换到目标属性。 - * @param {Object|Array} target 缓动目标对象或缓动目标数组。 - * @param toProps 缓动目标对象的目标属性。 - * @param params 缓动动画的参数。 - * @returns {Tween|Array} 一个Tween实例对象或Tween实例数组。 + * @language=en + * Create a tween, make target object easing from current properties to ending properties. + * @param {Object|Array} target Tweening target or tweening target array. + * @param toProps Ending properties of target tweening object. + * @param params Tweening parameters. + * @returns {Tween|Array} An tween instance or an array of tween instance. */ to: function(target, toProps, params){ return Tween.fromTo(target, null, toProps, params); }, /** - * 创建一个缓动动画,让目标对象从指定的起始属性变换到当前属性。 - * @param {Object|Array} target 缓动目标对象或缓动目标数组。 - * @param fromProps 缓动目标对象的目标属性。 - * @param params 缓动动画的参数。 - * @returns {Tween|Array} 一个Tween实例对象或Tween实例数组。 + * @language=en + * Create a tween, make target object easing from beginning properties to current properties. + * @param {Object|Array} target Tweening target or tweening target array. + * @param fromProps Beginning properties of target tweening object. + * @param params Tweening parameters. + * @returns {Tween|Array} An tween instance or an array of tween instance. */ from: function(target, fromProps, params){ return Tween.fromTo(target, fromProps, null, params); @@ -5459,23 +5577,21 @@ return Class.create(/** @lends Tween.prototype */{ }); })(); + Hilo.Tween = Tween; })(window); /** - * Hilo 1.0.0 for standalone + * Hilo 1.0.1 for standalone * Copyright 2016 alibaba.com * Licensed under the MIT License */ (function(window){ var Hilo = window.Hilo; -/** - * Hilo - * Copyright 2015 alibaba.com - * Licensed under the MIT License - */ + /** - * @class Ease类包含为Tween类提供各种缓动功能的函数。 + * @language=en + * @class Ease class provides multiple easing functions for Tween. * @module hilo/tween/Ease * @static */ @@ -5491,14 +5607,16 @@ function createEase(obj, easeInFn, easeOutFn, easeInOutFn, easeNoneFn){ } /** - * 线性匀速缓动函数。包含EaseNone函数。 + * @language=en + * Linear easing function.Include EaseNone. */ var Linear = createEase(null, null, null, null, function(k){ return k; }); /** - * 二次缓动函数。包含EaseIn、EaseOut、EaseInOut三个函数。 + * @language=en + * Quad easing function.Include EaseIn, EaseOut, EaseInOut. */ var Quad = createEase(null, function(k){ @@ -5515,7 +5633,8 @@ var Quad = createEase(null, ); /** - * 三次缓动函数。包含EaseIn、EaseOut、EaseInOut三个函数。 + * @language=en + * Cubic easing function.Include EaseIn, EaseOut, EaseInOut. */ var Cubic = createEase(null, function(k){ @@ -5532,7 +5651,8 @@ var Cubic = createEase(null, ); /** - * 四次缓动函数。包含EaseIn、EaseOut、EaseInOut三个函数。 + * @language=en + * Quart easing function.Include EaseIn, EaseOut, EaseInOut. */ var Quart = createEase(null, function(k){ @@ -5549,7 +5669,8 @@ var Quart = createEase(null, ); /** - * 五次缓动函数。包含EaseIn、EaseOut、EaseInOut三个函数。 + * @language=en + * Quint easing function.Include EaseIn, EaseOut, EaseInOut. */ var Quint = createEase(null, function(k){ @@ -5571,7 +5692,8 @@ var math = Math, pow = math.pow, sqrt = math.sqrt; /** - * 正弦缓动函数。包含EaseIn、EaseOut、EaseInOut三个函数。 + * @language=en + * Sine easing function.Include EaseIn, EaseOut, EaseInOut. */ var Sine = createEase(null, function(k){ @@ -5588,7 +5710,8 @@ var Sine = createEase(null, ); /** - * 指数缓动函数。包含EaseIn、EaseOut、EaseInOut三个函数。 + * @language=en + * Expo easing function.Include EaseIn, EaseOut, EaseInOut. */ var Expo = createEase(null, function(k){ @@ -5607,7 +5730,8 @@ var Expo = createEase(null, ); /** - * 圆形缓动函数。包含EaseIn、EaseOut、EaseInOut三个函数。 + * @language=en + * Circ easing function.Include EaseIn, EaseOut, EaseInOut. */ var Circ = createEase(null, function(k){ @@ -5625,7 +5749,8 @@ var Circ = createEase(null, ); /** - * 弹性缓动函数。包含EaseIn、EaseOut、EaseInOut三个函数。 + * @language=en + * Elastic easing function.Include EaseIn, EaseOut, EaseInOut. */ var Elastic = createEase( { @@ -5655,7 +5780,8 @@ var Elastic = createEase( ); /** - * 向后缓动函数。包含EaseIn、EaseOut、EaseInOut三个函数。 + * @language=en + * Back easing function.Include EaseIn, EaseOut, EaseInOut. */ var Back = createEase( { @@ -5682,7 +5808,8 @@ var Back = createEase( ); /** - * 弹跳缓动函数。包含EaseIn、EaseOut、EaseInOut三个函数。 + * @language=en + * Bounce easing function.Include EaseIn, EaseOut, EaseInOut. */ var Bounce = createEase(null, function(k){ @@ -5724,22 +5851,19 @@ return { Hilo.Ease = Ease; })(window); /** - * Hilo 1.0.0 for standalone + * Hilo 1.0.1 for standalone * Copyright 2016 alibaba.com * Licensed under the MIT License */ (function(window){ var Hilo = window.Hilo; var Class = Hilo.Class; -/** - * Hilo - * Copyright 2015 alibaba.com - * Licensed under the MIT License - */ + /** + * @language=en * @private - * @class 图片资源加载器。 + * @class image resources loader. * @module hilo/loader/ImageLoader * @requires hilo/core/Class */ @@ -5777,22 +5901,19 @@ var ImageLoader = Class.create({ Hilo.ImageLoader = ImageLoader; })(window); /** - * Hilo 1.0.0 for standalone + * Hilo 1.0.1 for standalone * Copyright 2016 alibaba.com * Licensed under the MIT License */ (function(window){ var Hilo = window.Hilo; var Class = Hilo.Class; -/** - * Hilo - * Copyright 2015 alibaba.com - * Licensed under the MIT License - */ + /** + * @language=en * @private - * @class javascript或JSONP加载器。 + * @class javascript or JSONP loader * @module hilo/loader/ScriptLoader * @requires hilo/core/Class */ @@ -5845,7 +5966,7 @@ var ScriptLoader = Class.create({ Hilo.ScriptLoader = ScriptLoader; })(window); /** - * Hilo 1.0.0 for standalone + * Hilo 1.0.1 for standalone * Copyright 2016 alibaba.com * Licensed under the MIT License */ @@ -5855,23 +5976,20 @@ var Class = Hilo.Class; var EventMixin = Hilo.EventMixin; var ImageLoader = Hilo.ImageLoader; var ScriptLoader = Hilo.ScriptLoader; -/** - * Hilo - * Copyright 2015 alibaba.com - * Licensed under the MIT License - */ + //TODO: 超时timeout,失败重连次数maxTries,更多的下载器Loader,队列暂停恢复等。 /** - * @class LoadQueue是一个队列下载工具。 - * @param {Object} source 要下载的资源。可以是单个资源对象或多个资源的数组。 + * @language=en + * @class LoadQueue is a queue-like loader. + * @param {Object} source ,resource that need to be loaded,could be a single object or array resource. * @module hilo/loader/LoadQueue * @requires hilo/core/Class * @requires hilo/event/EventMixin * @requires hilo/loader/ImageLoader * @requires hilo/loader/ScriptLoader - * @property {Int} maxConnections 同时下载的最大连接数。默认为2。 + * @property {Int} maxConnections ,the limited concurrent connections. default value 2. */ var LoadQueue = Class.create(/** @lends LoadQueue.prototype */{ Mixes: EventMixin, @@ -5888,15 +6006,16 @@ var LoadQueue = Class.create(/** @lends LoadQueue.prototype */{ _currentIndex: -1, /** - * 增加要下载的资源。可以是单个资源对象或多个资源的数组。 - * @param {Object|Array} source 资源对象或资源对象数组。每个资源对象包含以下属性: + * @language=en + * Add desired resource,could be a single object or array resource. + * @param {Object|Array} source ,a single object or array resource. Each resource contains properties like below: *
* var audio = WebSound.getAudio({ * src: 'test.mp3', @@ -6586,7 +6733,7 @@ var WebAudio = Hilo.WebAudio; * console.log('end'); * }).play(); *- * @class 声音播放管理器。 + * @class Audio playing manager. * @static * @module hilo/media/WebSound * @requires hilo/core/Hilo @@ -6597,7 +6744,8 @@ var WebSound = { _audios: {}, /** - * 激活音频功能。注意:需用户事件触发此方法才有效。目前仅对WebAudio有效。 + * @language=en + * Activate audio function. Note: Require user action events to activate. Currently support WebAudio. */ enableAudio: function(){ if(WebAudio.isSupported){ @@ -6606,9 +6754,10 @@ var WebSound = { }, /** - * 获取音频对象。优先使用WebAudio。 - * @param {String|Object} source 若source为String,则为音频src地址;若为Object,则需包含src属性。 - * @returns {WebAudio|HTMLAudio} 音频播放对象实例。 + * @language=en + * Get audio element. Use WebAudio if supported. + * @param {String|Object} source If String, it's the source of the audio; If Object, it should contains a src property. + * @returns {WebAudio|HTMLAudio} Audio playing instance. */ getAudio: function(source){ source = this._normalizeSource(source); @@ -6626,8 +6775,9 @@ var WebSound = { }, /** - * 删除音频对象。 - * @param {String|Object} source 若source为String,则为音频src地址;若为Object,则需包含src属性。 + * @language=en + * Remove audio element. + * @param {String|Object} source If String, it's the source of the audio; If Object, it should contains a src property. */ removeAudio: function(source){ var src = typeof source === 'string' ? source : source.src; @@ -6641,6 +6791,7 @@ var WebSound = { }, /** + * @language=en * @private */ _normalizeSource: function(source){ @@ -6654,31 +6805,28 @@ var WebSound = { Hilo.WebSound = WebSound; })(window); /** - * Hilo 1.0.0 for standalone + * Hilo 1.0.1 for standalone * Copyright 2016 alibaba.com * Licensed under the MIT License */ (function(window){ var Hilo = window.Hilo; var Class = Hilo.Class; -/** - * Hilo - * Copyright 2015 alibaba.com - * Licensed under the MIT License - */ + /** - * @class Camera类表示摄像机。 - * @param {Object} properties 创建对象的属性参数。可包含此类所有可写属性。 + * @language=en + * @class Camera. + * @param {Object} properties The properties to create a view object, contains all writeable props of this class * @module hilo/game/Camera * @requires hilo/core/Hilo * @requires hilo/core/Class - * @property {Number} width 镜头宽 - * @property {Number} height 镜头高 - * @property {Object} scroll 滚动值 {x:0, y:0} - * @property {View} target 摄像机跟随的目标 - * @property {Array} bounds 摄像机移动边界的矩形区域 [x, y, width, height] - * @property {Array} deadzone 摄像机不移动的矩形区域 [ x, y, width, height] + * @property {Number} width The width of the camera. + * @property {Number} height The height of the camera. + * @property {Object} scroll The scrolling value of the camera {x:0, y:0}. + * @property {View} target The target that the camera follow. + * @property {Array} bounds The rect area where camera is allowed to move [x, y, width, height]. + * @property {Array} deadzone The rect area where camera isn't allowed to move[ x, y, width, height]. */ var Camera = Class.create(/** @lends Camera.prototype */{ constructor:function(properties){ @@ -6697,7 +6845,8 @@ var Camera = Class.create(/** @lends Camera.prototype */{ Hilo.copy(this, properties); }, /** - * 更新 + * @language=en + * update. * @param {Number} deltaTime */ tick:function(deltaTime){ @@ -6731,9 +6880,10 @@ var Camera = Class.create(/** @lends Camera.prototype */{ } }, /** - * 跟随目标 - * @param {Object} target 跟随的目标,必须是有x,y属性的对象 - * @param {Array} deadzone 摄像机不移动的矩形区域 [ x, y, width, height] + * @language=en + * Follow the target. + * @param {Object} target The target that the camera follow. It must has x and y properties. + * @param {Array} deadzone The rect area where camera isn't allowed to move[ x, y, width, height]. */ follow:function(target, deadzone){ this.target = target; @@ -6747,55 +6897,52 @@ var Camera = Class.create(/** @lends Camera.prototype */{ Hilo.Camera = Camera; })(window); /** - * Hilo 1.0.0 for standalone + * Hilo 1.0.1 for standalone * Copyright 2016 alibaba.com * Licensed under the MIT License */ (function(window){ var Hilo = window.Hilo; var Class = Hilo.Class; -/** - * Hilo - * Copyright 2015 alibaba.com - * Licensed under the MIT License - */ + /** - * @class Camera3d 伪3D虚拟摄像机。 + * @language=en + * @class Camera3d is a pseudo-3d camera. * @module hilo/game/Camera3d * @requires hilo/core/Hilo * @requires hilo/core/Class - * @property {Number} fv 镜头视点距离(屏幕视点相对眼睛距离,绝对了坐标缩放比例) - * @property {Number} fx 镜头视点X(屏幕视点相对屏幕左上角X距离) - * @property {Number} fy 镜头视点Y(屏幕视点相对屏幕左上角Y距离) - * @property {Object} stage 3D对象所在容器,可以是stage或container,结合ticker时是必须参数,用来Z深度排序 - * @property {Number} x 镜头三维坐标x - * @property {Number} y 镜头三维坐标y - * @property {Number} z 镜头三维坐标z - * @property {Number} rotationX X轴旋转角度 - * @property {Number} rotationY Y轴旋转角度 - * @property {Number} rotationZ Z轴旋转角度 + * @property {Number} fv The distance of the fov(The distance between eyes and the Z plane,it determines the scale ratio of the 3d object). + * @property {Number} fx The x position of the screen viewpoint(The distance between the screen viewpoint and the screen left top corner on the x axis). + * @property {Number} fy The y position of the screen viewpoint(The distance between the screen viewpoint and the screen left top corner on the y axis). + * @property {Object} stage The 3d object's container, it can be stage or container.It is required if you need to sort the 3d object by z axis. + * @property {Number} x The x position. + * @property {Number} y The y position. + * @property {Number} z The z position. + * @property {Number} rotationX The x rotation. + * @property {Number} rotationY The y rotation. + * @property {Number} rotationZ The z rotation. */ var Camera3d = (function(){ var degtorad = Math.PI / 180; - //向量旋转 - function rotateX(x, y, z, ca, sa) {//绕X轴旋转 + //Rotate the axis. + function rotateX(x, y, z, ca, sa) {//rotate x return { x: x, y: y * ca - z * sa, z: y * sa + z * ca }; } - function rotateY(x, y, z, ca, sa) {//绕Y轴旋转 + function rotateY(x, y, z, ca, sa) {//rotate y return { x: x * ca - z * sa, y: y, z: x * sa + z * ca }; } - function rotateZ(x, y, z, ca, sa) {//绕Z轴旋转 + function rotateZ(x, y, z, ca, sa) {//rotate z return { x: x * ca - y * sa, y: x * sa + y * ca, @@ -6817,10 +6964,11 @@ var Camera3d = (function(){ }, /** - * 仿射矩阵位移变换,不同于直接修改Camera3d.x/y/z. 是在Camera3d依次做坐标位移 - 旋转变换 后,再加上一个位移变换。主要功能可以做Zoomin/out 功能 - * @param {Number} x坐标 - * @param {Number} y坐标 - * @param {Number} z坐标 + * @language=en + * Translate the camera,used for Zoomin/out feature. + * @param {Number} x The x position. + * @param {Number} y The y position. + * @param {Number} z The z position. */ translate : function(x,y,z){ this.tx = x; @@ -6829,33 +6977,38 @@ var Camera3d = (function(){ }, /** - * 旋转X轴方向角度,相当于欧拉角系统的 beta - * @param {Number} X旋转角度 + * @language=en + * Rotate by the x axis. + * @param {Number} angle The rotate degree. */ rotateX : function(angle){ this.rotationX = angle; }, /** - * 旋转Y轴方向角度,相当于欧拉角系统的 gamma - * @param {Number} Y旋转角度 + * @language=en + * Rotate by the y axis. + * @param {Number} angle The rotate degree. */ rotateY : function(angle){ this.rotationY = angle; }, /** - * 旋转Z轴方向角度,相当于欧拉角系统的 alpha - * @param {Number} Z旋转角度 + * @language=en + * Rotate by the z axis. + * @param {Number} angle The rotate degree. */ rotateZ : function(angle){ this.rotationZ = angle; }, /** - * 将三维坐标转换投影为二维坐标,同时返回Z轴深度,和投影显示的缩放比例 - * @param {object} 三维坐标对象 - * @param {object} Hilo.View对象,用于自动转换坐标 + * @language=en + * Project the 3d point to 2d point. + * @param {object} vector3D The 3d position, it must have x, y and z properties. + * @param {View} view The view related to the 3d position.It'll be auto translated by the 3d position. + * @returns {Object} The 2d object include z and scale properties, e.g.:{x:x, y:y, z:z, scale} */ project : function(vector3D, view){ @@ -6870,10 +7023,10 @@ var Camera3d = (function(){ // 旋转变换前的 仿射矩阵位移, dx = vector3D.x - this.x, dy = vector3D.y - this.y, - dz = vector3D.z - this.z, + dz = vector3D.z - this.z; // 旋转矩阵变换 - vector = rotateZ(dx, dy, dz, cosZ, sinZ); + var vector = rotateZ(dx, dy, dz, cosZ, sinZ); vector = rotateY(vector.x, vector.y, vector.z, cosY, sinY); vector = rotateX(vector.x, vector.y, vector.z, cosX, sinX); @@ -6886,24 +7039,27 @@ var Camera3d = (function(){ _x = vector.x * perspective, _y = -vector.y * perspective; - if(view) { - view.x = _x + this.fx; - view.y = _y + this.fy; - view.z = -vector.z; - view.scaleX = perspective; - view.scaleY = perspective; - } else { - return { - x : _x + this.fx, - y : _y + this.fy, - z : -vector.z, - scale : perspective - }; + var result = { + x : _x + this.fx, + y : _y + this.fy, + z : -vector.z, + scale : perspective + }; + + if(view){ + view.x = result.x; + view.y = result.y; + view.z = result.z; + view.scaleX = result.scale; + view.scaleY = result.scale; } + + return result; }, /** - * Z深度排序 + * @language=en + * Sort by z axis. */ sortZ : function(){ this.stage.children.sort(function(view_a, view_b){ @@ -6912,7 +7068,8 @@ var Camera3d = (function(){ }, /** - * Ticker 轮询使用 + * @language=en + * Used for the ticker. */ tick : function(){ this.sortZ(); @@ -6926,7 +7083,7 @@ var Camera3d = (function(){ Hilo.Camera3d = Camera3d; })(window); /** - * Hilo 1.0.0 for standalone + * Hilo 1.0.1 for standalone * Copyright 2016 alibaba.com * Licensed under the MIT License */ @@ -6937,16 +7094,13 @@ var View = Hilo.View; var Container = Hilo.Container; var Bitmap = Hilo.Bitmap; var Drawable = Hilo.Drawable; -/** - * Hilo - * Copyright 2015 alibaba.com - * Licensed under the MIT License - */ + /** + * @language=en * *
* var Bird = Hilo.Class.create({ * Extends: Animal, @@ -34,23 +31,24 @@ var Hilo = window.Hilo; * swallow.fly(); * Bird.isBird(swallow); *- * @namespace Class是提供类的创建的辅助工具。 + * @namespace Class Class is created to aid the developer. * @static * @module hilo/core/Class */ var Class = (function(){ /** - * 根据参数指定的属性和方法创建类。 - * @param {Object} properties 要创建的类的相关属性和方法。主要有: + * @language=en + * Create a class based on the parameters, properties and methods specified. + * @param {Object} properties Properties and methods to create the class. *
* var audio = WebSound.getAudio({ * src: 'test.mp3', @@ -28,7 +25,7 @@ var WebAudio = Hilo.WebAudio; * console.log('end'); * }).play(); *- * @class 声音播放管理器。 + * @class Audio playing manager. * @static * @module hilo/media/WebSound * @requires hilo/core/Hilo @@ -39,7 +36,8 @@ var WebSound = { _audios: {}, /** - * 激活音频功能。注意:需用户事件触发此方法才有效。目前仅对WebAudio有效。 + * @language=en + * Activate audio function. Note: Require user action events to activate. Currently support WebAudio. */ enableAudio: function(){ if(WebAudio.isSupported){ @@ -48,9 +46,10 @@ var WebSound = { }, /** - * 获取音频对象。优先使用WebAudio。 - * @param {String|Object} source 若source为String,则为音频src地址;若为Object,则需包含src属性。 - * @returns {WebAudio|HTMLAudio} 音频播放对象实例。 + * @language=en + * Get audio element. Use WebAudio if supported. + * @param {String|Object} source If String, it's the source of the audio; If Object, it should contains a src property. + * @returns {WebAudio|HTMLAudio} Audio playing instance. */ getAudio: function(source){ source = this._normalizeSource(source); @@ -68,8 +67,9 @@ var WebSound = { }, /** - * 删除音频对象。 - * @param {String|Object} source 若source为String,则为音频src地址;若为Object,则需包含src属性。 + * @language=en + * Remove audio element. + * @param {String|Object} source If String, it's the source of the audio; If Object, it should contains a src property. */ removeAudio: function(source){ var src = typeof source === 'string' ? source : source.src; @@ -83,6 +83,7 @@ var WebSound = { }, /** + * @language=en * @private */ _normalizeSource: function(source){ diff --git a/build/standalone/hilo/media/WebSound.min.js b/build/standalone/hilo/media/WebSound.min.js index 4cfcda4f..501ae72c 100644 --- a/build/standalone/hilo/media/WebSound.min.js +++ b/build/standalone/hilo/media/WebSound.min.js @@ -1,5 +1,5 @@ /** - * Hilo 1.0.0 for standalone + * Hilo 1.0.1 for standalone * Copyright 2016 alibaba.com * Licensed under the MIT License */ diff --git a/build/standalone/hilo/renderer/CanvasRenderer.js b/build/standalone/hilo/renderer/CanvasRenderer.js index 23447811..99a68a43 100644 --- a/build/standalone/hilo/renderer/CanvasRenderer.js +++ b/build/standalone/hilo/renderer/CanvasRenderer.js @@ -1,5 +1,5 @@ /** - * Hilo 1.0.0 for standalone + * Hilo 1.0.1 for standalone * Copyright 2016 alibaba.com * Licensed under the MIT License */ @@ -7,21 +7,18 @@ var Hilo = window.Hilo; var Class = Hilo.Class; var Renderer = Hilo.Renderer; -/** - * Hilo - * Copyright 2015 alibaba.com - * Licensed under the MIT License - */ + /** - * @class canvas画布渲染器。所有可视对象将渲染在canvas画布上。舞台Stage会根据参数canvas选择不同的渲染器,开发者无需直接使用此类。 + * @language=en + * @class CanvasRenderer CanvasRenderer, all the visual object is drawing on the canvas element.The stage will create different renderer depend on the canvas and renderType properties, developer need not use this class directly. * @augments Renderer - * @param {Object} properties 创建对象的属性参数。可包含此类所有可写属性。 + * @param {Object} properties The properties to create a renderer, contains all writeable props of this class. * @module hilo/renderer/CanvasRenderer * @requires hilo/core/Class * @requires hilo/core/Hilo * @requires hilo/renderer/Renderer - * @property {CanvasRenderingContext2D} context canvas画布的上下文。只读属性。 + * @property {CanvasRenderingContext2D} context The context of the canvas element, readonly. */ var CanvasRenderer = Class.create(/** @lends CanvasRenderer.prototype */{ Extends: Renderer, @@ -66,7 +63,7 @@ var CanvasRenderer = Class.create(/** @lends CanvasRenderer.prototype */{ var drawable = target.drawable, image = drawable && drawable.image; if(image){ var rect = drawable.rect, sw = rect[2], sh = rect[3], offsetX = rect[4], offsetY = rect[5]; - //ie9+浏览器宽高为0时会报错 + //ie9+浏览器宽高为0时会报错 fixed ie9 bug. if(!sw || !sh){ return; } diff --git a/build/standalone/hilo/renderer/CanvasRenderer.min.js b/build/standalone/hilo/renderer/CanvasRenderer.min.js index 860d77b9..369d4d06 100644 --- a/build/standalone/hilo/renderer/CanvasRenderer.min.js +++ b/build/standalone/hilo/renderer/CanvasRenderer.min.js @@ -1,6 +1,6 @@ /** - * Hilo 1.0.0 for standalone + * Hilo 1.0.1 for standalone * Copyright 2016 alibaba.com * Licensed under the MIT License */ -!function(e){var t=e.Hilo,a=t.Class,r=t.Renderer,i=a.create({Extends:r,constructor:function(e){i.superclass.constructor.call(this,e),this.context=this.canvas.getContext("2d")},renderType:"canvas",context:null,startDraw:function(e){return e.visible&&e.alpha>0?(e===this.stage&&this.context.clearRect(0,0,e.width,e.height),this.context.save(),!0):!1},draw:function(e){var t=this.context,a=e.width,r=e.height,i=e.background;i&&(t.fillStyle=i,t.fillRect(0,0,a,r));var s=e.drawable,n=s&&s.image;if(n){var c=s.rect,h=c[2],l=c[3],o=c[4],d=c[5];if(!h||!l)return;a||r||(a=e.width=h,r=e.height=l),(o||d)&&t.translate(o-.5*h,d-.5*l),t.drawImage(n,c[0],c[1],h,l,0,0,a,r)}},endDraw:function(e){this.context.restore()},transform:function(e){var a=e.drawable;if(a&&a.domElement)return void t.setElementStyleByView(e);var r=this.context,i=e.scaleX,s=e.scaleY;if(e===this.stage){var n=this.canvas.style,c=e._scaleX,h=e._scaleY;(!c&&1!=i||c&&c!=i)&&(e._scaleX=i,n.width=i*e.width+"px"),(!h&&1!=s||h&&h!=s)&&(e._scaleY=s,n.height=s*e.height+"px")}else{var l=e.x,o=e.y,d=e.pivotX,v=e.pivotY,f=e.rotation%360,w=e.mask;w&&(w._render(this),r.clip());var u=e.align;if(u)if("function"==typeof u)e.align();else{var g=e.parent;if(g){var b=e.width,p=e.height,x=g.width,m=g.height;switch(u){case"TL":l=0,o=0;break;case"T":l=x-b>>1,o=0;break;case"TR":l=x-b,o=0;break;case"L":l=0,o=m-p>>1;break;case"C":l=x-b>>1,o=m-p>>1;break;case"R":l=x-b,o=m-p>>1;break;case"BL":l=0,o=m-p;break;case"B":l=x-b>>1,o=m-p;break;case"BR":l=x-b,o=m-p}}}(0!=l||0!=o)&&r.translate(l,o),0!=f&&r.rotate(f*Math.PI/180),(1!=i||1!=s)&&r.scale(i,s),(0!=d||0!=v)&&r.translate(-d,-v)}e.alpha>0&&(r.globalAlpha*=e.alpha)},remove:function(e){var t=e.drawable,a=t&&t.domElement;if(a){var r=a.parentNode;r&&r.removeChild(a)}},clear:function(e,t,a,r){this.context.clearRect(e,t,a,r)},resize:function(e,t){this.canvas.width=e,this.canvas.height=t}});t.CanvasRenderer=i}(window); \ No newline at end of file +!function(e){var t=e.Hilo,a=t.Class,r=t.Renderer,i=a.create({Extends:r,constructor:function(e){i.superclass.constructor.call(this,e),this.context=this.canvas.getContext("2d")},renderType:"canvas",context:null,startDraw:function(e){return e.visible&&e.alpha>0?(e===this.stage&&this.context.clearRect(0,0,e.width,e.height),this.context.save(),!0):!1},draw:function(e){var t=this.context,a=e.width,r=e.height,i=e.background;i&&(t.fillStyle=i,t.fillRect(0,0,a,r));var s=e.drawable,n=s&&s.image;if(n){var c=s.rect,h=c[2],l=c[3],o=c[4],d=c[5];if(!h||!l)return;a||r||(a=e.width=h,r=e.height=l),(o||d)&&t.translate(o-.5*h,d-.5*l),t.drawImage(n,c[0],c[1],h,l,0,0,a,r)}},endDraw:function(e){this.context.restore()},transform:function(e){var a=e.drawable;if(a&&a.domElement)return void t.setElementStyleByView(e);var r=this.context,i=e.scaleX,s=e.scaleY;if(e===this.stage){var n=this.canvas.style,c=e._scaleX,h=e._scaleY;(!c&&1!=i||c&&c!=i)&&(e._scaleX=i,n.width=i*e.width+"px"),(!h&&1!=s||h&&h!=s)&&(e._scaleY=s,n.height=s*e.height+"px")}else{var l=e.x,o=e.y,d=e.pivotX,v=e.pivotY,f=e.rotation%360,w=e.mask;w&&(w._render(this),r.clip());var u=e.align;if(u)if("function"==typeof u)e.align();else{var g=e.parent;if(g){var b=e.width,p=e.height,x=g.width,m=g.height;switch(u){case"TL":l=0,o=0;break;case"T":l=x-b>>1,o=0;break;case"TR":l=x-b,o=0;break;case"L":l=0,o=m-p>>1;break;case"C":l=x-b>>1,o=m-p>>1;break;case"R":l=x-b,o=m-p>>1;break;case"BL":l=0,o=m-p;break;case"B":l=x-b>>1,o=m-p;break;case"BR":l=x-b,o=m-p}}}0==l&&0==o||r.translate(l,o),0!=f&&r.rotate(f*Math.PI/180),1==i&&1==s||r.scale(i,s),0==d&&0==v||r.translate(-d,-v)}e.alpha>0&&(r.globalAlpha*=e.alpha)},remove:function(e){var t=e.drawable,a=t&&t.domElement;if(a){var r=a.parentNode;r&&r.removeChild(a)}},clear:function(e,t,a,r){this.context.clearRect(e,t,a,r)},resize:function(e,t){this.canvas.width=e,this.canvas.height=t}});t.CanvasRenderer=i}(window); \ No newline at end of file diff --git a/build/standalone/hilo/renderer/DOMRenderer.js b/build/standalone/hilo/renderer/DOMRenderer.js index 92f6e3d8..ecfbd8bc 100644 --- a/build/standalone/hilo/renderer/DOMRenderer.js +++ b/build/standalone/hilo/renderer/DOMRenderer.js @@ -1,5 +1,5 @@ /** - * Hilo 1.0.0 for standalone + * Hilo 1.0.1 for standalone * Copyright 2016 alibaba.com * Licensed under the MIT License */ @@ -8,16 +8,13 @@ var Hilo = window.Hilo; var Class = Hilo.Class; var Renderer = Hilo.Renderer; var Drawable = Hilo.Drawable; -/** - * Hilo - * Copyright 2015 alibaba.com - * Licensed under the MIT License - */ + /** - * @class DOM+CSS3渲染器。将可视对象以DOM元素方式渲染出来。舞台Stage会根据参数canvas选择不同的渲染器,开发者无需直接使用此类。 + * @language=en + * @class DomRenderer The DomRenderer, all the visual object is drawing using dom element.The stage will create different renderer depend on the canvas and renderType properties, developer need not use this class directly. * @augments Renderer - * @param {Object} properties 创建对象的属性参数。可包含此类所有可写属性。 + * @param {Object} properties The properties to create a renderer, contains all writeable props of this class. * @module hilo/renderer/DOMRenderer * @requires hilo/core/Class * @requires hilo/core/Hilo @@ -136,10 +133,11 @@ return Class.create({ }); /** - * 创建一个可渲染的DOM,可指定tagName,如canvas或div。 - * @param {Object} view 一个可视对象或类似的对象。 - * @param {Object} imageObj 指定渲染的image及相关设置,如绘制区域rect。 - * @return {HTMLElement} 新创建的DOM对象。 + * @language=en + * Create a dom element, you can set the tagName property,such as canvas and div. + * @param {Object} view A visual object. + * @param {Object} imageObj The image object to render, include the image propertiy and other associated properties, such as rect. + * @return {HTMLElement} The created dom element. * @private */ function createDOMDrawable(view, imageObj){ diff --git a/build/standalone/hilo/renderer/DOMRenderer.min.js b/build/standalone/hilo/renderer/DOMRenderer.min.js index 980ee7a7..1a4a7e38 100644 --- a/build/standalone/hilo/renderer/DOMRenderer.min.js +++ b/build/standalone/hilo/renderer/DOMRenderer.min.js @@ -1,5 +1,5 @@ /** - * Hilo 1.0.0 for standalone + * Hilo 1.0.1 for standalone * Copyright 2016 alibaba.com * Licensed under the MIT License */ diff --git a/build/standalone/hilo/renderer/Renderer.js b/build/standalone/hilo/renderer/Renderer.js index 7999e48e..c937be51 100644 --- a/build/standalone/hilo/renderer/Renderer.js +++ b/build/standalone/hilo/renderer/Renderer.js @@ -1,26 +1,23 @@ /** - * Hilo 1.0.0 for standalone + * Hilo 1.0.1 for standalone * Copyright 2016 alibaba.com * Licensed under the MIT License */ (function(window){ var Hilo = window.Hilo; var Class = Hilo.Class; -/** - * Hilo - * Copyright 2015 alibaba.com - * Licensed under the MIT License - */ + /** - * @class 渲染器抽象基类。 - * @param {Object} properties 创建对象的属性参数。可包含此类所有可写属性。 + * @language=en + * @class Renderer Renderer is the base class of renderer. + * @param {Object} properties The properties to create a renderer, contains all writeable props of this class. * @module hilo/renderer/Renderer * @requires hilo/core/Hilo * @requires hilo/core/Class - * @property {Object} canvas 渲染器对应的画布。它可能是一个普通的DOM元素,比如div,也可以是一个canvas画布元素。只读属性。 - * @property {Object} stage 渲染器对应的舞台。只读属性。 - * @property {String} renderType 渲染方式。只读属性。 + * @property {Object} canvas The canvas of renderer. It can be a dom element, such as a div element, or a canvas element. readonly. + * @property {Object} stage The stage of renderer, readonly. + * @property {String} renderType The render type of renderer, readonly. */ var Renderer = Class.create(/** @lends Renderer.prototype */{ constructor: function(properties){ @@ -33,52 +30,60 @@ var Renderer = Class.create(/** @lends Renderer.prototype */{ stage: null, /** - * 为开始绘制可视对象做准备。需要子类来实现。 - * @param {View} target 要绘制的可视对象。 + * @language=en + * Prepare for draw visual object. The subclass need to implement it. + * @param {View} target The visual target to draw. */ startDraw: function(target){ }, /** - * 绘制可视对象。需要子类来实现。 - * @param {View} target 要绘制的可视对象。 + * @language=en + * Draw the visual object. The subclass need to implement it. + * @param {View} target The visual target to draw. */ draw: function(target){ }, /** - * 结束绘制可视对象后的后续处理方法。需要子类来实现。 - * @param {View} target 要绘制的可视对象。 + * @language=en + * The handling method after draw the visual object. The subclass need to implement it. + * @param {View} target The visual target to draw. */ endDraw: function(target){ }, /** - * 对可视对象进行变换。需要子类来实现。 + * @language=en + * Transfrom the visual object. The subclass need to implement it. */ transform: function(){ }, /** - * 隐藏可视对象。需要子类来实现。 + * @language=en + * Hide the visual object. The subclass need to implement it. */ hide: function(){ }, /** - * 从画布中删除可视对象。注意:不是从stage中删除对象。需要子类来实现。 - * @param {View} target 要删除的可视对象。 + * @language=en + * Remove the visual object from canvas. Notice that it dosen't remove the object from stage. The subclass need to implement it. + * @param {View} target The visual target to remove. */ remove: function(target){ }, /** - * 清除画布指定区域。需要子类来实现。 - * @param {Number} x 指定区域的x轴坐标。 - * @param {Number} y 指定区域的y轴坐标。 - * @param {Number} width 指定区域的宽度。 - * @param {Number} height 指定区域的高度。 + * @language=en + * Clear the given region of canvas. The subclass need to implement it. + * @param {Number} x The position on the x axis of the given region. + * @param {Number} y The position on the y axis of the given region. + * @param {Number} width The width of the given region. + * @param {Number} height The height of the given region. */ clear: function(x, y, width, height){ }, /** - * 改变渲染器的画布大小。 - * @param {Number} width 指定渲染画布新的宽度。 - * @param {Number} height 指定渲染画布新的高度。 + * @language=en + * Resize the renderer's canvas. + * @param {Number} width The width of renderer's canvas. + * @param {Number} height The height of the renderer's canvas. */ resize: function(width, height){ } diff --git a/build/standalone/hilo/renderer/Renderer.min.js b/build/standalone/hilo/renderer/Renderer.min.js index 14c69160..db14386a 100644 --- a/build/standalone/hilo/renderer/Renderer.min.js +++ b/build/standalone/hilo/renderer/Renderer.min.js @@ -1,5 +1,5 @@ /** - * Hilo 1.0.0 for standalone + * Hilo 1.0.1 for standalone * Copyright 2016 alibaba.com * Licensed under the MIT License */ diff --git a/build/standalone/hilo/renderer/WebGLRenderer.js b/build/standalone/hilo/renderer/WebGLRenderer.js index cc0919ef..3aea31e3 100644 --- a/build/standalone/hilo/renderer/WebGLRenderer.js +++ b/build/standalone/hilo/renderer/WebGLRenderer.js @@ -1,5 +1,5 @@ /** - * Hilo 1.0.0 for standalone + * Hilo 1.0.1 for standalone * Copyright 2016 alibaba.com * Licensed under the MIT License */ @@ -8,11 +8,7 @@ var Hilo = window.Hilo; var Class = Hilo.Class; var Renderer = Hilo.Renderer; var Matrix = Hilo.Matrix; -/** - * Hilo - * Copyright 2015 alibaba.com - * Licensed under the MIT License - */ + /** * Heavily inspired by PIXI's SpriteRenderer: @@ -21,33 +17,37 @@ var Matrix = Hilo.Matrix; var DEG2RAD = Math.PI / 180; /** - * @class webgl画布渲染器。所有可视对象将渲染在canvas画布上。 + * @language=en + * @class WebGLRenderer The WebGLRenderer, all the visual object is drawing on the canvas using WebGL.The stage will create different renderer depend on the canvas and renderType properties, developer need not use this class directly. * @augments Renderer - * @param {Object} properties 创建对象的属性参数。可包含此类所有可写属性。 + * @param {Object} properties The properties to create a renderer, contains all writeable props of this class. * @module hilo/renderer/WebGLRenderer * @requires hilo/core/Class * @requires hilo/renderer/Renderer * @requires hilo/geom/Matrix - * @property {WebGLRenderingContext} gl webgl上下文。只读属性。 + * @property {WebGLRenderingContext} gl The WebGL context of the renderer, readonly. */ var WebGLRenderer = Class.create(/** @lends WebGLRenderer.prototype */{ Extends: Renderer, Statics:/** @lends WebGLRenderer */{ /** - * 最大批渲染数量。 + * @language=en + * The max num of batch draw, default is 2000. * @type {Number} */ MAX_BATCH_NUM:2000, /** - * 顶点属性数。只读属性。 + * @language=en + * The num of vertex attributes, readonly. * @type {Number} */ ATTRIBUTE_NUM:5, /** - * 是否支持WebGL。只读属性。 + * @language=en + * is WebGL supported, readonly. * @type {Boolean} */ - isSupport:null + isSupported:null }, renderType:'webgl', gl:null, @@ -112,7 +112,6 @@ var WebGLRenderer = Class.create(/** @lends WebGLRenderer.prototype */{ } return false; }, - /** * @private * @see Renderer#draw @@ -403,6 +402,7 @@ var WebGLRenderer = Class.create(/** @lends WebGLRenderer.prototype */{ }); /** + * @language=en * shader * @param {WebGLRenderer} renderer [description] * @param {Object} source @@ -522,20 +522,14 @@ Shader.prototype = { } }; -WebGLRenderer.isSupport = function(){ - if(this._isSupport !== undefined){ - return this._isSupport; +WebGLRenderer.isSupported = (function(){ + var canvas = document.createElement('canvas'); + if(canvas.getContext && (canvas.getContext('webgl')||canvas.getContext('experimental-webgl'))){ + return true; } else{ - var canvas = document.createElement('canvas'); - if(canvas.getContext && (canvas.getContext('webgl')||canvas.getContext('experimental-webgl'))){ - this._isSupport = true; - } - else{ - this._isSupport = false; - } - return this._isSupport; + return false; } -}; +})(); Hilo.WebGLRenderer = WebGLRenderer; })(window); \ No newline at end of file diff --git a/build/standalone/hilo/renderer/WebGLRenderer.min.js b/build/standalone/hilo/renderer/WebGLRenderer.min.js index c80924ab..a5ac841a 100644 --- a/build/standalone/hilo/renderer/WebGLRenderer.min.js +++ b/build/standalone/hilo/renderer/WebGLRenderer.min.js @@ -1,6 +1,6 @@ /** - * Hilo 1.0.0 for standalone + * Hilo 1.0.1 for standalone * Copyright 2016 alibaba.com * Licensed under the MIT License */ -!function(t){var e=t.Hilo,r=e.Class,i=e.Renderer,a=e.Matrix,n=Math.PI/180,s=r.create({Extends:i,Statics:{MAX_BATCH_NUM:2e3,ATTRIBUTE_NUM:5,isSupport:null},renderType:"webgl",gl:null,constructor:function(e){t.__render=this,s.superclass.constructor.call(this,e);var r=this.gl=this.canvas.getContext("webgl")||this.canvas.getContext("experimental-webgl");this.maxBatchNum=s.MAX_BATCH_NUM,this.positionStride=4*s.ATTRIBUTE_NUM;var i=this.maxBatchNum*s.ATTRIBUTE_NUM*4,a=6*this.maxBatchNum;this.positions=new Float32Array(i),this.indexs=new Uint16Array(a);for(var n=0,o=0;a>n;n+=6,o+=4)this.indexs[n+0]=o+0,this.indexs[n+1]=o+1,this.indexs[n+2]=o+2,this.indexs[n+3]=o+1,this.indexs[n+4]=o+2,this.indexs[n+5]=o+3;this.batchIndex=0,this.sprites=[],r.blendFunc(r.ONE,r.ONE_MINUS_SRC_ALPHA),r.clearColor(0,0,0,0),r.disable(r.DEPTH_TEST),r.disable(r.CULL_FACE),r.enable(r.BLEND),this._initShaders(),this.defaultShader.active(),this.positionBuffer=r.createBuffer(),this.indexBuffer=r.createBuffer(),r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,this.indexBuffer),r.bufferData(r.ELEMENT_ARRAY_BUFFER,this.indexs,r.STATIC_DRAW),r.bindBuffer(r.ARRAY_BUFFER,this.positionBuffer),r.bufferData(r.ARRAY_BUFFER,this.positions,r.DYNAMIC_DRAW),r.vertexAttribPointer(this.a_position,2,r.FLOAT,!1,this.positionStride,0),r.vertexAttribPointer(this.a_TexCoord,2,r.FLOAT,!1,this.positionStride,8),r.vertexAttribPointer(this.a_alpha,1,r.FLOAT,!1,this.positionStride,16)},context:null,startDraw:function(t){return t.visible&&t.alpha>0?(t===this.stage&&this.clear(),!0):!1},draw:function(t){var e=(this.context,t.width),r=t.height,i=(t.background,t.drawable),a=i&&i.image;if(a){this.gl;a.texture||this.activeShader.uploadTexture(a);var n=i.rect,s=n[2],o=n[3];n[4],n[5];e||r||(e=t.width=s,r=t.height=o),this.batchIndex>=this.maxBatchNum&&this._renderBatches();var h=this._createVertexs(a,n[0],n[1],s,o,0,0,e,r),l=this.batchIndex*this.positionStride,_=this.positions,d=t.__webglRenderAlpha;_[l+0]=h[0],_[l+1]=h[1],_[l+2]=h[2],_[l+3]=h[3],_[l+4]=d,_[l+5]=h[4],_[l+6]=h[5],_[l+7]=h[6],_[l+8]=h[7],_[l+9]=d,_[l+10]=h[8],_[l+11]=h[9],_[l+12]=h[10],_[l+13]=h[11],_[l+14]=d,_[l+15]=h[12],_[l+16]=h[13],_[l+17]=h[14],_[l+18]=h[15],_[l+19]=d;for(var c=t.__webglWorldMatrix,u=0;4>u;u++){var f=_[l+5*u],p=_[l+5*u+1];_[l+5*u]=c.a*f+c.c*p+c.tx,_[l+5*u+1]=c.b*f+c.d*p+c.ty}t.texture=a.texture,this.sprites[this.batchIndex++]=t}},endDraw:function(t){t===this.stage&&this._renderBatches()},transform:function(t){var r=t.drawable;if(r&&r.domElement)return void e.setElementStyleByView(t);var i=(this.context,t.scaleX),n=t.scaleY;if(t===this.stage){var s=this.canvas.style,o=t._scaleX,h=t._scaleY;(!o&&1!=i||o&&o!=i)&&(t._scaleX=i,s.width=i*t.width+"px"),(!h&&1!=n||h&&h!=n)&&(t._scaleY=n,s.height=n*t.height+"px"),t.__webglWorldMatrix=t.__webglWorldMatrix||new a(1,0,0,1,0,0)}else t.__webglWorldMatrix=t.__webglWorldMatrix||new a(1,0,0,1,0,0),this._setConcatenatedMatrix(t,t.parent);t.alpha>0&&(t.parent&&t.parent.__webglRenderAlpha?t.__webglRenderAlpha=t.alpha*t.parent.__webglRenderAlpha:t.__webglRenderAlpha=t.alpha)},remove:function(t){var e=t.drawable,r=e&&e.domElement;if(r){var i=r.parentNode;i&&i.removeChild(r)}},clear:function(t,e,r,i){this.gl.clear(this.gl.COLOR_BUFFER_BIT)},resize:function(t,e){(this.width!==t||this.height!==e)&&(this.width=this.canvas.width=t,this.height=this.canvas.height=e,this.gl.viewport(0,0,t,e),this.canvasHalfWidth=.5*t,this.canvasHalfHeight=.5*e,this._uploadProjectionTransform(!0))},_renderBatches:function(){var t=this.gl;t.bufferSubData(t.ARRAY_BUFFER,0,this.positions.subarray(0,this.batchIndex*this.positionStride));for(var e=0,r=0,i=null,a=0;a
- * ticker.addTick(Hilo.Tween);//需要把Tween加到ticker里才能使用 + * ticker.addTick(Hilo.Tween);//Tween works after being added to ticker * * var view = new View({x:5, y:10}); * Hilo.Tween.to(view, { @@ -33,26 +30,26 @@ var Class = Hilo.Class; * } * }); *- * @class Tween类提供缓动功能。 - * @param {Object} target 缓动对象。 - * @param {Object} fromProps 对象缓动的起始属性集合。 - * @param {Object} toProps 对象缓动的目标属性集合。 - * @param {Object} params 缓动参数。可包含Tween类所有可写属性。 + * @class Tween class makes tweening (easing, slow motion). + * @param {Object} target Tween target object. + * @param {Object} fromProps Beginning properties of target tweening object. + * @param {Object} toProps Ending properties of target tweening object. + * @param {Object} params Tweening parameters, include all writable Tween class properties. * @module hilo/tween/Tween * @requires hilo/core/Class - * @property {Object} target 缓动目标。只读属性。 - * @property {Int} duration 缓动总时长。单位毫秒。 - * @property {Int} delay 缓动延迟时间。单位毫秒。 - * @property {Boolean} paused 缓动是否暂停。默认为false。 - * @property {Boolean} loop 缓动是否循环。默认为false。 - * @property {Boolean} reverse 缓动是否反转播放。默认为false。 - * @property {Int} repeat 缓动重复的次数。默认为0。 - * @property {Int} repeatDelay 缓动重复的延迟时长。单位为毫秒。 - * @property {Function} ease 缓动变化函数。默认为null。 - * @property {Int} time 缓动已进行的时长。单位毫秒。只读属性。 - * @property {Function} onStart 缓动开始回调函数。它接受1个参数:tween。默认值为null。 - * @property {Function} onUpdate 缓动更新回调函数。它接受2个参数:ratio和tween。默认值为null。 - * @property {Function} onComplete 缓动结束回调函数。它接受1个参数:tween。默认值为null。 + * @property {Object} target Tween target object, readonly! + * @property {Int} duration Tweening duration, measure in ms. + * @property {Int} delay Tweenning delay time, measure in ms. + * @property {Boolean} paused Is tweening paused, default value is false. + * @property {Boolean} loop Does tweening loop, default value is false. + * @property {Boolean} reverse Does tweening reverse, default value is false. + * @property {Int} repeat Repeat times of tweening, default value is 0. + * @property {Int} repeatDelay Delay time of repeating tweening, measure in ms. + * @property {Function} ease Tweening transform function, default value is null. + * @property {Int} time Time that tweening taken, measure in ms, readonly! + * @property {Function} onStart Function invoked on the beginning of tweening. Require 1 parameter: tween. default value is null. + * @property {Function} onUpdate Function invoked on tweening update. Require 2 parameters: ratio, tween. default value is null. + * @property {Function} onComplete Function invoked on the end of tweening. Require 1 parameter: tween. default value is null. */ var Tween = (function(){ @@ -105,10 +102,11 @@ return Class.create(/** @lends Tween.prototype */{ onComplete: null, /** - * 设置缓动对象的初始和目标属性。 - * @param {Object} fromProps 缓动对象的初始属性。 - * @param {Object} toProps 缓动对象的目标属性。 - * @returns {Tween} Tween变换本身。可用于链式调用。 + * @language=en + * Set beginning properties and ending properties of tweening object. + * @param {Object} fromProps Beginning properties of target tweening object. + * @param {Object} toProps Ending properties of target tweening object. + * @returns {Tween} Current Tween, for chain calls. */ setProps: function(fromProps, toProps){ var me = this, target = me.target, @@ -126,8 +124,9 @@ return Class.create(/** @lends Tween.prototype */{ }, /** - * 启动缓动动画的播放。 - * @returns {Tween} Tween变换本身。可用于链式调用。 + * @language=en + * Starting the tweening. + * @returns {Tween} Current Tween, for chain calls. */ start: function(){ var me = this; @@ -140,8 +139,9 @@ return Class.create(/** @lends Tween.prototype */{ }, /** - * 停止缓动动画的播放。 - * @returns {Tween} Tween变换本身。可用于链式调用。 + * @language=en + * Stop the tweening. + * @returns {Tween} Current Tween, for chain calls. */ stop: function(){ Tween.remove(this); @@ -149,8 +149,9 @@ return Class.create(/** @lends Tween.prototype */{ }, /** - * 暂停缓动动画的播放。 - * @returns {Tween} Tween变换本身。可用于链式调用。 + * @language=en + * Pause the tweening. + * @returns {Tween} Current Tween, for chain calls. */ pause: function(){ var me = this; @@ -160,8 +161,9 @@ return Class.create(/** @lends Tween.prototype */{ }, /** - * 恢复缓动动画的播放。 - * @returns {Tween} Tween变换本身。可用于链式调用。 + * @language=en + * Continue to play the tweening. + * @returns {Tween} Current Tween, for chain calls. */ resume: function(){ var me = this; @@ -172,10 +174,11 @@ return Class.create(/** @lends Tween.prototype */{ }, /** - * 跳转Tween到指定的时间。 - * @param {Number} time 指定要跳转的时间。取值范围为:0 - duraion。 - * @param {Boolean} pause 是否暂停。 - * @returns {Tween} Tween变换本身。可用于链式调用。 + * @language=en + * Tween jumps to some point. + * @param {Number} time The time to jump to, range from 0 to duration. + * @param {Boolean} pause Is paused. + * @returns {Tween} Current Tween, for chain calls. */ seek: function(time, pause){ var me = this, current = now(); @@ -189,9 +192,10 @@ return Class.create(/** @lends Tween.prototype */{ }, /** - * 连接下一个Tween变换。其开始时间根据delay值不同而不同。当delay值为字符串且以'+'或'-'开始时,Tween的开始时间从当前变换结束点计算,否则以当前变换起始点计算。 - * @param {Tween} tween 要连接的Tween变换。 - * @returns {Tween} Tween变换本身。可用于链式调用。 + * @language=en + * Link next Tween. The beginning time of next Tween depends on the delay value. If delay is a string that begins with '+' or '-', next Tween will begin at (delay) ms after or before the current tween is ended. If delay is out of previous situation, next Tween will begin at (delay) ms after the beginning point of current Tween. + * @param {Tween} tween Tween to link. + * @returns {Tween} Current Tween, for chain calls. */ link: function(tween){ var me = this, delay = tween.delay, startTime = me._startTime; @@ -209,7 +213,8 @@ return Class.create(/** @lends Tween.prototype */{ }, /** - * Tween类的内部渲染方法。 + * @language=en + * Private render method inside Tween class. * @private */ _render: function(ratio){ @@ -218,7 +223,8 @@ return Class.create(/** @lends Tween.prototype */{ }, /** - * Tween类的内部更新方法。 + * @language=en + * Private update method inside Tween class. * @private */ _update: function(time, forceUpdate){ @@ -295,12 +301,14 @@ return Class.create(/** @lends Tween.prototype */{ Statics: /** @lends Tween */ { /** + * @language=en * @private */ _tweens: [], /** - * 更新所有Tween实例。 + * @language=en + * Update all Tween instances. * @returns {Object} Tween。 */ tick: function(){ @@ -317,8 +325,9 @@ return Class.create(/** @lends Tween.prototype */{ }, /** - * 添加Tween实例。 - * @param {Tween} tween 要添加的Tween对象。 + * @language=en + * Add a Tween instance. + * @param {Tween} tween Tween object to add. * @returns {Object} Tween。 */ add: function(tween){ @@ -328,8 +337,9 @@ return Class.create(/** @lends Tween.prototype */{ }, /** - * 删除Tween实例。 - * @param {Tween|Object|Array} tweenOrTarget 要删除的Tween对象或target对象或要删除的一组对象。 + * @language=en + * Remove one Tween target. + * @param {Tween|Object|Array} tweenOrTarget Tween object, target object or an array of object to remove * @returns {Object} Tween。 */ remove: function(tweenOrTarget){ @@ -357,7 +367,8 @@ return Class.create(/** @lends Tween.prototype */{ }, /** - * 删除所有Tween实例。 + * @language=en + * Remove all Tween instances. * @returns {Object} Tween。 */ removeAll: function(){ @@ -366,12 +377,13 @@ return Class.create(/** @lends Tween.prototype */{ }, /** - * 创建一个缓动动画,让目标对象从开始属性变换到目标属性。 - * @param {Object|Array} target 缓动目标对象或缓动目标数组。 - * @param fromProps 缓动目标对象的开始属性。 - * @param toProps 缓动目标对象的目标属性。 - * @param params 缓动动画的参数。 - * @returns {Tween|Array} 一个Tween实例对象或Tween实例数组。 + * @language=en + * Create a tween, make target object easing from beginning properties to ending properties. + * @param {Object|Array} target Tweening target or tweening target array. + * @param fromProps Beginning properties of target tweening object. + * @param toProps Ending properties of target tweening object. + * @param params Tweening parameters. + * @returns {Tween|Array} An tween instance or an array of tween instance. */ fromTo: function(target, fromProps, toProps, params){ var isArray = target instanceof Array; @@ -389,22 +401,24 @@ return Class.create(/** @lends Tween.prototype */{ }, /** - * 创建一个缓动动画,让目标对象从当前属性变换到目标属性。 - * @param {Object|Array} target 缓动目标对象或缓动目标数组。 - * @param toProps 缓动目标对象的目标属性。 - * @param params 缓动动画的参数。 - * @returns {Tween|Array} 一个Tween实例对象或Tween实例数组。 + * @language=en + * Create a tween, make target object easing from current properties to ending properties. + * @param {Object|Array} target Tweening target or tweening target array. + * @param toProps Ending properties of target tweening object. + * @param params Tweening parameters. + * @returns {Tween|Array} An tween instance or an array of tween instance. */ to: function(target, toProps, params){ return Tween.fromTo(target, null, toProps, params); }, /** - * 创建一个缓动动画,让目标对象从指定的起始属性变换到当前属性。 - * @param {Object|Array} target 缓动目标对象或缓动目标数组。 - * @param fromProps 缓动目标对象的目标属性。 - * @param params 缓动动画的参数。 - * @returns {Tween|Array} 一个Tween实例对象或Tween实例数组。 + * @language=en + * Create a tween, make target object easing from beginning properties to current properties. + * @param {Object|Array} target Tweening target or tweening target array. + * @param fromProps Beginning properties of target tweening object. + * @param params Tweening parameters. + * @returns {Tween|Array} An tween instance or an array of tween instance. */ from: function(target, fromProps, params){ return Tween.fromTo(target, fromProps, null, params); @@ -414,5 +428,6 @@ return Class.create(/** @lends Tween.prototype */{ }); })(); + Hilo.Tween = Tween; })(window); \ No newline at end of file diff --git a/build/standalone/hilo/tween/Tween.min.js b/build/standalone/hilo/tween/Tween.min.js index a231c194..48e2cfbc 100644 --- a/build/standalone/hilo/tween/Tween.min.js +++ b/build/standalone/hilo/tween/Tween.min.js @@ -1,5 +1,5 @@ /** - * Hilo 1.0.0 for standalone + * Hilo 1.0.1 for standalone * Copyright 2016 alibaba.com * Licensed under the MIT License */ diff --git a/build/standalone/hilo/util/TextureAtlas.js b/build/standalone/hilo/util/TextureAtlas.js index 5d53b1d4..978fa3e4 100644 --- a/build/standalone/hilo/util/TextureAtlas.js +++ b/build/standalone/hilo/util/TextureAtlas.js @@ -1,18 +1,15 @@ /** - * Hilo 1.0.0 for standalone + * Hilo 1.0.1 for standalone * Copyright 2016 alibaba.com * Licensed under the MIT License */ (function(window){ var Hilo = window.Hilo; var Class = Hilo.Class; -/** - * Hilo - * Copyright 2015 alibaba.com - * Licensed under the MIT License - */ + /** + * @language=en * @class TextureAtlas纹理集是将许多小的纹理图片整合到一起的一张大图。这个类可根据一个纹理集数据读取纹理小图、精灵动画等。 * @param {Object} atlasData 纹理集数据。它可包含如下数据: *
* var bmp = new Bitmap({image:img}); * Hilo.copy(bmp, Hilo.drag); * bmp.startDrag([0, 0, 550, 400]); *- * @class drag是一个包含拖拽功能的mixin。可以通过 Class.mix(view, drag)或Hilo.copy(view, drag)来为view增加拖拽功能。 + * @class drag A mixin that contains drag method.You can mix drag method to the visual target by use Class.mix(target, drag) or Hilo.copy(target, drag). * @mixin * @static * @module hilo/util/drag @@ -30,8 +27,9 @@ var Class = Hilo.Class; */ var drag = { /** - * 开始拖拽 - * @param {Array} bounds 拖拽范围,基于父容器坐标系,[x, y, width, height], 默认无限制 + * @language=en + * start drag. + * @param {Array} bounds The bounds area that the view can move, relative to the coordinates of the view's parent, [x, y, width, height], default is no limit. */ startDrag:function(bounds){ var that = this; @@ -102,7 +100,8 @@ var drag = { that.stopDrag = stopDrag; }, /** - * 停止拖拽 + * @language=en + * stop drag. */ stopDrag:function(){ diff --git a/build/standalone/hilo/util/drag.min.js b/build/standalone/hilo/util/drag.min.js index ac9d1b9b..c23f169d 100644 --- a/build/standalone/hilo/util/drag.min.js +++ b/build/standalone/hilo/util/drag.min.js @@ -1,5 +1,5 @@ /** - * Hilo 1.0.0 for standalone + * Hilo 1.0.1 for standalone * Copyright 2016 alibaba.com * Licensed under the MIT License */ diff --git a/build/standalone/hilo/util/polyfill.js b/build/standalone/hilo/util/polyfill.js index ea7de60d..01f2ccc4 100644 --- a/build/standalone/hilo/util/polyfill.js +++ b/build/standalone/hilo/util/polyfill.js @@ -1,15 +1,11 @@ /** - * Hilo 1.0.0 for standalone + * Hilo 1.0.1 for standalone * Copyright 2016 alibaba.com * Licensed under the MIT License */ (function(window){ var Hilo = window.Hilo; -/** - * Hilo - * Copyright 2015 alibaba.com - * Licensed under the MIT License - */ + var arrayProto = Array.prototype, slice = arrayProto.slice; diff --git a/build/standalone/hilo/util/polyfill.min.js b/build/standalone/hilo/util/polyfill.min.js index 25399008..6030d4e3 100644 --- a/build/standalone/hilo/util/polyfill.min.js +++ b/build/standalone/hilo/util/polyfill.min.js @@ -1,6 +1,6 @@ /** - * Hilo 1.0.0 for standalone + * Hilo 1.0.1 for standalone * Copyright 2016 alibaba.com * Licensed under the MIT License */ -!function(n){var t=n.Hilo,r=Array.prototype,i=r.slice;r.indexOf=r.indexOf||function(n,t){t=t||0;var r,i=this.length;if(0==i||t>=i)return-1;for(0>t&&(t=i+t),r=t;i>r;r++)if(this[r]===n)return r;return-1};var o=Function.prototype;o.bind=o.bind||function(n){function t(){var e=o.concat(i.call(arguments));return r.apply(this instanceof t?this:n,e)}var r=this,o=i.call(arguments,1),e=function(){};return e.prototype=r.prototype,t.prototype=new e,t},t.undefined=void 0}(window); \ No newline at end of file +!function(n){var t=n.Hilo,i=Array.prototype,r=i.slice;i.indexOf=i.indexOf||function(n,t){t=t||0;var i,r=this.length;if(0==r||t>=r)return-1;for(0>t&&(t=r+t),i=t;r>i;i++)if(this[i]===n)return i;return-1};var o=Function.prototype;o.bind=o.bind||function(n){function t(){var e=o.concat(r.call(arguments));return i.apply(this instanceof t?this:n,e)}var i=this,o=r.call(arguments,1),e=function(){};return e.prototype=i.prototype,t.prototype=new e,t},t.undefined=void 0}(window); \ No newline at end of file diff --git a/build/standalone/hilo/view/Bitmap.js b/build/standalone/hilo/view/Bitmap.js index 94fd58f2..bae0d73c 100644 --- a/build/standalone/hilo/view/Bitmap.js +++ b/build/standalone/hilo/view/Bitmap.js @@ -1,5 +1,5 @@ /** - * Hilo 1.0.0 for standalone + * Hilo 1.0.1 for standalone * Copyright 2016 alibaba.com * Licensed under the MIT License */ @@ -8,26 +8,23 @@ var Hilo = window.Hilo; var Class = Hilo.Class; var View = Hilo.View; var Drawable = Hilo.Drawable; -/** - * Hilo - * Copyright 2015 alibaba.com - * Licensed under the MIT License - */ + /** + * @language=en * *
* var bmp = new Hilo.Bitmap({image:imgElem, rect:[0, 0, 100, 100]}); * stage.addChild(bmp); *- * @class Bitmap类表示位图图像类。 + * @class Bitmap * @augments View - * @param {Object} properties 创建对象的属性参数。可包含此类所有可写属性。此外还包括: + * @param {Object} properties the options of create Instance.It can contains all writable property and Moreover: *
* var btn = new Hilo.Button({ * image: buttonImage, @@ -27,24 +24,24 @@ var Drawable = Hilo.Drawable; * disabledState: {rect:[192, 0, 64, 64]} * }); *- * @class Button类表示简单按钮类。它有弹起、经过、按下和不可用等四种状态。 + * @class Button class is a simple button class, contains four kinds of state: 'up', 'over', 'down', 'disabled' * @augments View - * @param {Object} properties 创建对象的属性参数。可包含此类所有可写属性。此外还包括: + * @param {Object} properties create object properties. Contains all writable properties. Also contains: *
* var domView = new Hilo.DOMElement({ * element: Hilo.createElement('div', { @@ -33,11 +30,11 @@ var Drawable = Hilo.Drawable; * }).addTo(stage); ** @name DOMElement - * @class DOMElement是dom元素的包装。 + * @class DOMElement is a wrapper of dom element. * @augments View - * @param {Object} properties 创建对象的属性参数。可包含此类所有可写属性。特殊属性有: + * @param {Object} properties create Objects properties. Contains all writable properties in this class. Special properties include: *
var path = 'M250 150 L150 350 L350 350 Z';
*var shape = new Hilo.Graphics({width:500, height:500});
*shape.drawSVGPath(path).beginFill('#0ff').endFill();
- * @param {String} pathData 要绘制的SVG路径数据。 - * @returns {Graphics} Graphics对象本身。 + * @param {String} pathData The SVG path data to draw. + * @returns {Graphics} The Graphics Object. */ drawSVGPath: function(pathData){ var me = this, addAction = me._addAction, @@ -353,7 +368,8 @@ return Class.create(/** @lends Graphics.prototype */{ }, /** - * 执行全部绘制动作。内部私有方法。 + * @language=en + * Apply all draw actions. private function. * @private */ _draw: function(context){ @@ -371,7 +387,8 @@ return Class.create(/** @lends Graphics.prototype */{ }, /** - * 重写渲染实现。 + * @language=en + * Overwrite render function. * @private */ render: function(renderer, delta){ @@ -385,8 +402,9 @@ return Class.create(/** @lends Graphics.prototype */{ }, /** - * 清除所有绘制动作并复原所有初始状态。 - * @returns {Graphics} Graphics对象本身。 + * @language=en + * Clear all draw actions and reset to the initial state. + * @returns {Graphics} The Graphics Object. */ clear: function(){ var me = this; @@ -408,7 +426,8 @@ return Class.create(/** @lends Graphics.prototype */{ }, /** - * 添加一个绘制动作。内部私有方法。 + * @language=en + * Add a draw action, this is a private function. * @private */ _addAction: function(action){ @@ -420,5 +439,6 @@ return Class.create(/** @lends Graphics.prototype */{ }); })(); + Hilo.Graphics = Graphics; })(window); \ No newline at end of file diff --git a/build/standalone/hilo/view/Graphics.min.js b/build/standalone/hilo/view/Graphics.min.js index 909a38d5..6d92bda4 100644 --- a/build/standalone/hilo/view/Graphics.min.js +++ b/build/standalone/hilo/view/Graphics.min.js @@ -1,5 +1,5 @@ /** - * Hilo 1.0.0 for standalone + * Hilo 1.0.1 for standalone * Copyright 2016 alibaba.com * Licensed under the MIT License */ diff --git a/build/standalone/hilo/view/Sprite.js b/build/standalone/hilo/view/Sprite.js index fff11110..d4ef47ce 100644 --- a/build/standalone/hilo/view/Sprite.js +++ b/build/standalone/hilo/view/Sprite.js @@ -1,5 +1,5 @@ /** - * Hilo 1.0.0 for standalone + * Hilo 1.0.1 for standalone * Copyright 2016 alibaba.com * Licensed under the MIT License */ @@ -8,31 +8,28 @@ var Hilo = window.Hilo; var Class = Hilo.Class; var View = Hilo.View; var Drawable = Hilo.Drawable; -/** - * Hilo - * Copyright 2015 alibaba.com - * Licensed under the MIT License - */ + /** + * @language=en * ** var stage = new Hilo.Stage({ * renderType:'canvas', @@ -26,16 +23,16 @@ var WebGLRenderer = Hilo.WebGLRenderer; * height: 480 * }); *- * @class 舞台是可视对象树的根,可视对象只有添加到舞台或其子对象后才会被渲染出来。创建一个hilo应用一般都是从创建一个stage开始的。 + * @class Stage is the root of all visual object tree, any visual object will be render only after being added to Stage or any children elements of Stage. Normally, every hilo application start with an stage instance. * @augments Container - * @param {Object} properties 创建对象的属性参数。可包含此类所有可写属性。主要有: + * @param {Object} properties Properties parameters for the object. Includes all writable properties of this class. Some important like: *
* var Bird = Hilo.Class.create({ * Extends: Animal, @@ -28,21 +28,21 @@ * swallow.fly(); * Bird.isBird(swallow); *- * @namespace Class Class is created to provide aid. + * @namespace Class Class is created to aid the developer. * @static * @module hilo/core/Class */ var Class = (function(){ /** - * - * Create a class based on the specified properties, parameters and methods. - * @param {Object} properties Properties and methods to create the class. They are: + * @language=en + * Create a class based on the parameters, properties and methods specified. + * @param {Object} properties Properties and methods to create the class. *
var path = 'M250 150 L150 350 L350 350 Z';
@@ -362,7 +362,7 @@ return Class.create(/** @lends Graphics.prototype */{ }, /** - * + * @language=en * Apply all draw actions. private function. * @private */ @@ -381,7 +381,7 @@ return Class.create(/** @lends Graphics.prototype */{ }, /** - * + * @language=en * Overwrite render function. * @private */ @@ -396,7 +396,7 @@ return Class.create(/** @lends Graphics.prototype */{ }, /** - * + * @language=en * Clear all draw actions and reset to the initial state. * @returns {Graphics} The Graphics Object. */ @@ -420,7 +420,7 @@ return Class.create(/** @lends Graphics.prototype */{ }, /** - * + * @language=en * Add a draw action, this is a private function. * @private */ diff --git a/docs/api-en/code/view/Sprite.js b/docs/api-en/code/view/Sprite.js index 39d1b437..f1dfb1fa 100644 --- a/docs/api-en/code/view/Sprite.js +++ b/docs/api-en/code/view/Sprite.js @@ -5,7 +5,7 @@ */ /** - * + * @language=en * ** var stage = new Hilo.Stage({ @@ -61,7 +61,7 @@ var Stage = Class.create(/** @lends Stage.prototype */{ viewport: null, /** - * + * @language=en * @private */ _initRenderer: function(properties){ @@ -108,7 +108,7 @@ var Stage = Class.create(/** @lends Stage.prototype */{ }, /** - * + * @language=en * Add Stage canvas to DOM container. Note: this function overwrite View.addTo function. * @param {HTMLElement} domElement An dom element. * @returns {Stage} The Stage Object, chained call supported. @@ -122,7 +122,7 @@ var Stage = Class.create(/** @lends Stage.prototype */{ }, /** - * + * @language=en * Invoke tick function and Stage will update and render. Developer may not need to use this funciton. * @param {Number} delta The time had pass between this tick invoke and last tick invoke. */ @@ -133,7 +133,7 @@ var Stage = Class.create(/** @lends Stage.prototype */{ }, /** - * + * @language=en * Turn on/off Stage response to DOM event. To make visual objects on the Stage interactive, use this function to turn on Stage's responses to events. * @param {String|Array} type The event name or array that need to turn on/off. * @param {Boolean} enabled Whether turn on or off the response method of stage DOM event. If not provided, default value is true. @@ -160,7 +160,7 @@ var Stage = Class.create(/** @lends Stage.prototype */{ }, /** - * + * @language=en * DOM events handler function. This funciton will invoke events onto the visual object, which is on the position of the coordinate where the events is invoked. * @private */ @@ -224,7 +224,7 @@ var Stage = Class.create(/** @lends Stage.prototype */{ }, /** - * + * @language=en * Update the viewport (rendering area) which Stage show on the page. Invoke this function to update viewport when Stage canvas changes border, margin or padding properties. * @returns {Object} The visible area of the Stage (the viewport property). */ @@ -237,7 +237,7 @@ var Stage = Class.create(/** @lends Stage.prototype */{ }, /** - * + * @language=en * Resize the Stage. * @param {Number} width The width of the new Stage. * @param {Number} height The height of the new Stage. diff --git a/docs/api-en/code/view/Text.js b/docs/api-en/code/view/Text.js index 71ddac8e..c9ea1a0c 100644 --- a/docs/api-en/code/view/Text.js +++ b/docs/api-en/code/view/Text.js @@ -5,7 +5,7 @@ */ /** - * + * @language=en * *
* @class Text class provide basic text-display function, use DOMElement for complex text-display. @@ -52,7 +52,7 @@ var Text = Class.create(/** @lends Text.prototype */{ textHeight: 0, //read-only /** - * + * @language=en * Set text CSS font style. * @param {String} font Text CSS font style to set. * @returns {Text} the Text object, chained call supported. @@ -68,7 +68,7 @@ var Text = Class.create(/** @lends Text.prototype */{ }, /** - * + * @language=en * Overwrite render function. * @private */ @@ -101,7 +101,7 @@ var Text = Class.create(/** @lends Text.prototype */{ }, /** - * + * @language=en * Draw text under the assigned render context. * @private */ @@ -194,7 +194,7 @@ var Text = Class.create(/** @lends Text.prototype */{ }, /** - * + * @language=en * Draw a line of text under the assigned render context. * @private */ @@ -217,7 +217,7 @@ var Text = Class.create(/** @lends Text.prototype */{ Statics: /** @lends Text */{ /** - * + * @language=en * Measure the line height of the assigned text font style. * @param {String} font Font style to measure. * @return {Number} Return line height of the assigned font style. diff --git a/docs/api-en/code/view/View.js b/docs/api-en/code/view/View.js index f618c864..7f9ca348 100644 --- a/docs/api-en/code/view/View.js +++ b/docs/api-en/code/view/View.js @@ -5,7 +5,7 @@ */ /** - * + * @language=en * @class View View is the base class of all display objects * @param {Object} properties The properties to create a view object, contains all writeable props of this class * @module hilo/view/View @@ -66,7 +66,7 @@ return Class.create(/** @lends View.prototype */{ depth: -1, /** - * + * @language=en * Get the stage object of the view. If the view doesn't add to any stage, null will be returned. * @returns {Stage} The stage object of the view. */ @@ -80,7 +80,7 @@ return Class.create(/** @lends View.prototype */{ }, /** - * + * @language=en * Get the scaled width of the view. * @returns {Number} scaled width of the view. */ @@ -89,7 +89,7 @@ return Class.create(/** @lends View.prototype */{ }, /** - * + * @language=en * Get the scaled height of the view. * @returns {Number} scaled height of the view. */ @@ -98,7 +98,7 @@ return Class.create(/** @lends View.prototype */{ }, /** - * + * @language=en * Add current view to a Contaner. * @param {Container} container Container object. * @param {Uint} index The index of the view in container. @@ -111,7 +111,7 @@ return Class.create(/** @lends View.prototype */{ }, /** - * + * @language=en * Remove current view from it's parent container * @returns {View} Current view. */ @@ -122,7 +122,7 @@ return Class.create(/** @lends View.prototype */{ }, /** - * + * @language=en * Get the bounds of the view as a circumscribed rectangle and all vertex points relative to the coordinates of the stage. * @returns {Array} The vertex points array, and the array contains the following properties: *
Class | Class Class is created to provide aid. |
Class | Class Class is created to aid the developer. |
Hilo | Hilo The underlying core set of methods. |
@@ -742,7 +734,7 @@ Methods
- set the image。
+
|
@@ -760,7 +752,7 @@ Methods
- Add current view to a Contaner.
+
|
@@ -778,7 +770,7 @@ Methods
- Get the bounds of the view as a circumscribed rectangle and all vertex points relative to the coordinates of the stage.
+
|
@@ -796,7 +788,7 @@ Methods
- Get the scaled height of the view.
+
|
@@ -814,7 +806,7 @@ Methods
- Get the scaled width of the view.
+
|
@@ -832,7 +824,7 @@ Methods
- Get the stage object of the view.
+
|
@@ -850,7 +842,7 @@ Methods
- Determining whether an object is in the circumscribed rectangle of current view.
+
|
@@ -868,7 +860,7 @@ Methods
- Determining whether a point is in the circumscribed rectangle of current view.
+
|
@@ -886,7 +878,7 @@ Methods
- Remove current view from it's parent container
+
|
@@ -904,7 +896,7 @@ Methods
- The render method of current view.
+
|
@@ -922,7 +914,7 @@ Methods
- Get a string representing current view.
+
|
@@ -998,7 +990,7 @@ ConstructorsetImage(Image:Image|String, rect:Array):Bitmap -set the image。
+
diff --git a/docs/api-en/symbols/BitmapText.html b/docs/api-en/symbols/BitmapText.html
index 85d34c2d..801612d3 100644
--- a/docs/api-en/symbols/BitmapText.html
+++ b/docs/api-en/symbols/BitmapText.html
@@ -226,9 +226,6 @@
|
@@ -877,7 +874,7 @@ Methods
- detect whether can display the string by the currently assigned font provided
+
|
@@ -895,7 +892,7 @@ Methods
- set the content of bitmap text
+
|
@@ -913,7 +910,7 @@ Methods
- set the textAlign of text。
+
|
@@ -931,7 +928,7 @@ Methods
static
- easy way to generate a collection of glyphs
+
|
@@ -949,7 +946,7 @@ Methods
- Add child element at the top.
+
|
@@ -967,7 +964,7 @@ Methods
- Add child element at given index.
+
|
@@ -985,7 +982,7 @@ Methods
- Add current view to a Contaner.
+
|
@@ -1003,7 +1000,7 @@ Methods
- Return whether this container contains the parameter described child element.
+
|
@@ -1021,7 +1018,7 @@ Methods
- Get the bounds of the view as a circumscribed rectangle and all vertex points relative to the coordinates of the stage.
+
|
@@ -1039,7 +1036,7 @@ Methods
- Return child element at the given index.
+
|
@@ -1057,7 +1054,7 @@ Methods
- Return child element at the given id.
+
|
@@ -1075,7 +1072,7 @@ Methods
- Return index value of the given child element.
+
|
@@ -1093,7 +1090,7 @@ Methods
- Return the amount of the children elements of the container.
+
|
@@ -1111,7 +1108,7 @@ Methods
- Get the scaled height of the view.
+
|
@@ -1129,7 +1126,7 @@ Methods
- Get the scaled width of the view.
+
|
@@ -1147,7 +1144,7 @@ Methods
- Get the stage object of the view.
+
|
@@ -1165,7 +1162,7 @@ Methods
- Return object at the point positioned by given values on x axis and y axis.
+
|
@@ -1183,7 +1180,7 @@ Methods
- Determining whether an object is in the circumscribed rectangle of current view.
+
|
@@ -1201,7 +1198,7 @@ Methods
- Determining whether a point is in the circumscribed rectangle of current view.
+
|
@@ -1219,7 +1216,7 @@ Methods
- Remove all children elements.
+
|
@@ -1237,7 +1234,7 @@ Methods
- Remove the given child element.
+
|
@@ -1255,7 +1252,7 @@ Methods
- Remove element at the index.
+
|
@@ -1273,7 +1270,7 @@ Methods
- Remove child element by its id.
+
|
@@ -1291,7 +1288,7 @@ Methods
- Remove current view from it's parent container
+
|
@@ -1309,7 +1306,7 @@ Methods
- The render method of current view.
+
|
@@ -1327,7 +1324,7 @@ Methods
- Set the index of child element.
+
|
@@ -1345,7 +1342,7 @@ Methods
- Sort children elements by the given key or function.
+
|
@@ -1363,7 +1360,7 @@ Methods
- Swap index between two child elements.
+
|
@@ -1381,7 +1378,7 @@ Methods
- Swap two children elements at given indexes.
+
|
@@ -1399,7 +1396,7 @@ Methods
- Get a string representing current view.
+
|
@@ -1553,7 +1550,7 @@ Constructor[Static] createGlyphs(text:String, image:Image, col:Number, row:Number):BitmapText -easy way to generate a collection of glyphs
+
@@ -1605,7 +1602,7 @@ ConstructorhasGlyphs(str:String):Boolean -detect whether can display the string by the currently assigned font provided
+
@@ -1642,7 +1639,7 @@ ConstructorsetText(text:String):BitmapText -set the content of bitmap text
+
@@ -1679,7 +1676,7 @@ ConstructorsetTextAlign(textAlign):BitmapText -set the textAlign of text。
+
diff --git a/docs/api-en/symbols/Button.html b/docs/api-en/symbols/Button.html
index db727995..ac0ef816 100644
--- a/docs/api-en/symbols/Button.html
+++ b/docs/api-en/symbols/Button.html
@@ -226,19 +226,6 @@
|
@@ -438,7 +425,7 @@ Properties
static
- Statics value of Button's 'disabled' state.
+
|
@@ -460,7 +447,7 @@ Properties
static
- Statics value of Button's 'down' state.
+
|
@@ -482,7 +469,7 @@ Properties
static
- Statics value of Button's 'up' state.
+
|
@@ -682,7 +669,7 @@ Properties
- This method will call while the view need update(usually caused by ticker update).
+
|
@@ -975,7 +962,7 @@ Methods
- Set whether the button is enabled.
+
|
@@ -993,7 +980,7 @@ Methods
- Set the state of the button.
+
|
@@ -1011,7 +998,7 @@ Methods
- Add current view to a Contaner.
+
|
@@ -1029,7 +1016,7 @@ Methods
- Get the bounds of the view as a circumscribed rectangle and all vertex points relative to the coordinates of the stage.
+
|
@@ -1047,7 +1034,7 @@ Methods
- Get the scaled height of the view.
+
|
@@ -1065,7 +1052,7 @@ Methods
- Get the scaled width of the view.
+
|
@@ -1083,7 +1070,7 @@ Methods
- Get the stage object of the view.
+
|
@@ -1101,7 +1088,7 @@ Methods
- Determining whether an object is in the circumscribed rectangle of current view.
+
|
@@ -1119,7 +1106,7 @@ Methods
- Determining whether a point is in the circumscribed rectangle of current view.
+
|
@@ -1137,7 +1124,7 @@ Methods
- Remove current view from it's parent container
+
|
@@ -1155,7 +1142,7 @@ Methods
- The render method of current view.
+
|
@@ -1173,7 +1160,7 @@ Methods
- Get a string representing current view.
+
|
@@ -1217,7 +1204,7 @@ Property Detail
- Statics value of Button's 'disabled' state.
+
@@ -1255,7 +1242,7 @@ Property Detail
- Statics value of Button's 'down' state.
+
@@ -1312,7 +1299,7 @@ Property Detail
- Statics value of Button's 'over' state.
+
@@ -1369,7 +1356,7 @@ Property Detail
- Statics value of Button's 'up' state.
+
@@ -1463,7 +1450,7 @@ ConstructorsetEnabled(enabled:Boolean):Button -Set whether the button is enabled.
+
@@ -1500,7 +1487,7 @@ ConstructorsetState(state:String):Button -Set the state of the button. Invoke inside the Button and may not be used.
+
diff --git a/docs/api-en/symbols/CacheMixin.html b/docs/api-en/symbols/CacheMixin.html
index 62eb7f69..ae4dc31d 100644
--- a/docs/api-en/symbols/CacheMixin.html
+++ b/docs/api-en/symbols/CacheMixin.html
@@ -257,7 +257,7 @@ Methods
static
- Cache the view.
+
|
@@ -275,7 +275,7 @@ Methods
static
- Update the cache.
+
|
@@ -293,7 +293,7 @@ Methods
static
- set the cache state diry.
+
|
@@ -340,7 +340,7 @@ Methods[Static] cache(forceUpdate:Boolean) -Cache the view.
+
@@ -370,7 +370,7 @@ Methods[Static] setCacheDirty(dirty) -set the cache state diry.
+
@@ -400,7 +400,7 @@ Methods[Static] updateCache() -Update the cache.
+
diff --git a/docs/api-en/symbols/Camera.html b/docs/api-en/symbols/Camera.html
index 537538ae..843766d4 100644
--- a/docs/api-en/symbols/Camera.html
+++ b/docs/api-en/symbols/Camera.html
@@ -425,7 +425,7 @@ Methods
- Follow the target.
+
|
@@ -443,7 +443,7 @@ Methods
- update.
+
|
@@ -635,7 +635,7 @@ Constructorfollow(target:Object, deadzone:Array) -Follow the target.
+
@@ -670,7 +670,7 @@ Constructortick(deltaTime:Number) -update.
+
diff --git a/docs/api-en/symbols/Camera3d.html b/docs/api-en/symbols/Camera3d.html
index cf8352bf..87f622db 100644
--- a/docs/api-en/symbols/Camera3d.html
+++ b/docs/api-en/symbols/Camera3d.html
@@ -505,7 +505,7 @@ Methods
- Project the 3d point to 2d point.
+
|
@@ -523,7 +523,7 @@ Methods
- Rotate by the x axis.
+
|
@@ -541,7 +541,7 @@ Methods
- Rotate by the y axis.
+
|
@@ -559,7 +559,7 @@ Methods
- Rotate by the z axis.
+
|
@@ -577,7 +577,7 @@ Methods
- Sort by z axis.
+
|
@@ -595,7 +595,7 @@ Methods
- Used for the ticker.
+
|
@@ -613,7 +613,7 @@ Methods
- Translate the camera,used for Zoomin/out feature.
+
|
@@ -871,7 +871,7 @@ Constructorproject(vector3D:object, view:View):Object -Project the 3d point to 2d point.
+
@@ -913,7 +913,7 @@ ConstructorrotateX(angle:Number) -Rotate by the x axis.
+
@@ -943,7 +943,7 @@ ConstructorrotateY(angle:Number) -Rotate by the y axis.
+
@@ -973,7 +973,7 @@ ConstructorrotateZ(angle:Number) -Rotate by the z axis.
+
@@ -1003,7 +1003,7 @@ ConstructorsortZ() -Sort by z axis.
+
@@ -1023,7 +1023,7 @@ Constructortick() -Used for the ticker.
+
@@ -1043,7 +1043,7 @@ Constructortranslate(x:Number, y:Number, z:Number) -Translate the camera,used for Zoomin/out feature.
+
diff --git a/docs/api-en/symbols/CanvasRenderer.html b/docs/api-en/symbols/CanvasRenderer.html
index 7b0e80f9..54130928 100644
--- a/docs/api-en/symbols/CanvasRenderer.html
+++ b/docs/api-en/symbols/CanvasRenderer.html
@@ -394,7 +394,7 @@ Methods
- Clear the given region of canvas.
+
|
@@ -412,7 +412,7 @@ Methods
- Draw the visual object.
+
|
@@ -430,7 +430,7 @@ Methods
- The handling method after draw the visual object.
+
|
@@ -448,7 +448,7 @@ Methods
- Hide the visual object.
+
|
@@ -466,7 +466,7 @@ Methods
- Remove the visual object from canvas.
+
|
@@ -484,7 +484,7 @@ Methods
- Resize the renderer's canvas.
+
|
@@ -502,7 +502,7 @@ Methods
- Prepare for draw visual object.
+
|
@@ -520,7 +520,7 @@ Methods
- Transfrom the visual object.
+
|
diff --git a/docs/api-en/symbols/Class.html b/docs/api-en/symbols/Class.html
index 0c18e88e..cb42970f 100644
--- a/docs/api-en/symbols/Class.html
+++ b/docs/api-en/symbols/Class.html
@@ -214,30 +214,7 @@
|
@@ -293,7 +270,7 @@ Methods
static
- Mixed property or method.
+
|
@@ -340,7 +317,7 @@ Methods[Static] create(properties:Object):Object -Create a class based on the specified properties, parameters and methods.
+
@@ -350,12 +327,12 @@ Methods
Methods[Static] mix(target:Object, source:Object):Object -Mixed property or method.
+
diff --git a/docs/api-en/symbols/Container.html b/docs/api-en/symbols/Container.html
index 8eb25cf0..ea647779 100644
--- a/docs/api-en/symbols/Container.html
+++ b/docs/api-en/symbols/Container.html
@@ -501,7 +501,7 @@ Properties
- This method will call while the view need update(usually caused by ticker update).
+
|
@@ -794,7 +794,7 @@ Methods
- Add child element at the top.
+
|
@@ -812,7 +812,7 @@ Methods
- Add child element at given index.
+
|
@@ -830,7 +830,7 @@ Methods
- Return whether this container contains the parameter described child element.
+
|
@@ -848,7 +848,7 @@ Methods
- Return child element at the given index.
+
|
@@ -866,7 +866,7 @@ Methods
- Return child element at the given id.
+
|
@@ -884,7 +884,7 @@ Methods
- Return index value of the given child element.
+
|
@@ -902,7 +902,7 @@ Methods
- Return the amount of the children elements of the container.
+
|
@@ -920,7 +920,7 @@ Methods
- Return object at the point positioned by given values on x axis and y axis.
+
|
@@ -938,7 +938,7 @@ Methods
- Remove all children elements.
+
|
@@ -956,7 +956,7 @@ Methods
- Remove the given child element.
+
|
@@ -974,7 +974,7 @@ Methods
- Remove element at the index.
+
|
@@ -992,7 +992,7 @@ Methods
- Remove child element by its id.
+
|
@@ -1010,7 +1010,7 @@ Methods
- Set the index of child element.
+
|
@@ -1028,7 +1028,7 @@ Methods
- Sort children elements by the given key or function.
+
|
@@ -1046,7 +1046,7 @@ Methods
- Swap index between two child elements.
+
|
@@ -1064,7 +1064,7 @@ Methods
- Swap two children elements at given indexes.
+
|
@@ -1082,7 +1082,7 @@ Methods
- Add current view to a Contaner.
+
|
@@ -1100,7 +1100,7 @@ Methods
- Get the bounds of the view as a circumscribed rectangle and all vertex points relative to the coordinates of the stage.
+
|
@@ -1118,7 +1118,7 @@ Methods
- Get the scaled height of the view.
+
|
@@ -1136,7 +1136,7 @@ Methods
- Get the scaled width of the view.
+
|
@@ -1154,7 +1154,7 @@ Methods
- Get the stage object of the view.
+
|
@@ -1172,7 +1172,7 @@ Methods
- Determining whether an object is in the circumscribed rectangle of current view.
+
|
@@ -1190,7 +1190,7 @@ Methods
- Determining whether a point is in the circumscribed rectangle of current view.
+
|
@@ -1208,7 +1208,7 @@ Methods
- Remove current view from it's parent container
+
|
@@ -1226,7 +1226,7 @@ Methods
- The render method of current view.
+
|
@@ -1244,7 +1244,7 @@ Methods
- Get a string representing current view.
+
|
@@ -1379,7 +1379,7 @@ ConstructoraddChild(child:View) -Add child element at the top.
+
@@ -1409,7 +1409,7 @@ ConstructoraddChildAt(child:View, index:Number) -Add child element at given index.
+
@@ -1444,7 +1444,7 @@ Constructorcontains(child:View) -Return whether this container contains the parameter described child element.
+
@@ -1474,7 +1474,7 @@ ConstructorgetChildAt(index:Number) -Return child element at the given index.
+
@@ -1504,7 +1504,7 @@ ConstructorgetChildById(id:String) -Return child element at the given id.
+
@@ -1534,7 +1534,7 @@ ConstructorgetChildIndex(child:View) -Return index value of the given child element.
+
@@ -1564,7 +1564,7 @@ ConstructorgetNumChildren():Uint -Return the amount of the children elements of the container.
+
@@ -1591,7 +1591,7 @@ ConstructorgetViewAtPoint(x:Number, y:Number, usePolyCollision:Boolean, global:Boolean, eventMode:Boolean) -Return object at the point positioned by given values on x axis and y axis.
+
@@ -1641,7 +1641,7 @@ ConstructorremoveAllChildren():Container -Remove all children elements.
+
@@ -1668,7 +1668,7 @@ ConstructorremoveChild(child:View):View -Remove the given child element.
+
@@ -1705,7 +1705,7 @@ ConstructorremoveChildAt(index:Int):View -Remove element at the index.
+
@@ -1742,7 +1742,7 @@ ConstructorremoveChildById(id:String):View -Remove child element by its id.
+
@@ -1779,7 +1779,7 @@ ConstructorsetChildIndex(child:View, index:Number) -Set the index of child element.
+
@@ -1814,7 +1814,7 @@ ConstructorsortChildren(keyOrFunction:Object) -Sort children elements by the given key or function.
+
@@ -1844,7 +1844,7 @@ ConstructorswapChildren(child1:View, child2:View) -Swap index between two child elements.
+
@@ -1879,7 +1879,7 @@ ConstructorswapChildrenAt(index1:Number, index2:Number) -Swap two children elements at given indexes.
+
diff --git a/docs/api-en/symbols/DOMElement.html b/docs/api-en/symbols/DOMElement.html
index b4232d3e..774bc9ed 100644
--- a/docs/api-en/symbols/DOMElement.html
+++ b/docs/api-en/symbols/DOMElement.html
@@ -226,24 +226,6 @@
|
@@ -752,7 +734,7 @@ Methods
- Add current view to a Contaner.
+
|
@@ -770,7 +752,7 @@ Methods
- Get the bounds of the view as a circumscribed rectangle and all vertex points relative to the coordinates of the stage.
+
|
@@ -788,7 +770,7 @@ Methods
- Get the scaled height of the view.
+
|
@@ -806,7 +788,7 @@ Methods
- Get the scaled width of the view.
+
|
@@ -824,7 +806,7 @@ Methods
- Get the stage object of the view.
+
|
@@ -842,7 +824,7 @@ Methods
- Determining whether an object is in the circumscribed rectangle of current view.
+
|
@@ -860,7 +842,7 @@ Methods
- Determining whether a point is in the circumscribed rectangle of current view.
+
|
@@ -878,7 +860,7 @@ Methods
- Remove current view from it's parent container
+
|
@@ -896,7 +878,7 @@ Methods
- The render method of current view.
+
|
@@ -914,7 +896,7 @@ Methods
- Get a string representing current view.
+
|
diff --git a/docs/api-en/symbols/DOMRenderer.html b/docs/api-en/symbols/DOMRenderer.html
index c330bfd4..0c2e4f9b 100644
--- a/docs/api-en/symbols/DOMRenderer.html
+++ b/docs/api-en/symbols/DOMRenderer.html
@@ -374,7 +374,7 @@ Methods
- Clear the given region of canvas.
+
|
@@ -392,7 +392,7 @@ Methods
- Draw the visual object.
+
|
@@ -410,7 +410,7 @@ Methods
- The handling method after draw the visual object.
+
|
@@ -428,7 +428,7 @@ Methods
- Hide the visual object.
+
|
@@ -446,7 +446,7 @@ Methods
- Remove the visual object from canvas.
+
|
@@ -464,7 +464,7 @@ Methods
- Resize the renderer's canvas.
+
|
@@ -482,7 +482,7 @@ Methods
- Prepare for draw visual object.
+
|
@@ -500,7 +500,7 @@ Methods
- Transfrom the visual object.
+
|
diff --git a/docs/api-en/symbols/Drawable.html b/docs/api-en/symbols/Drawable.html
index 9d61abc1..bdbae3da 100644
--- a/docs/api-en/symbols/Drawable.html
+++ b/docs/api-en/symbols/Drawable.html
@@ -345,7 +345,7 @@ Methods
- Initialize drawable elements.
+
|
@@ -363,7 +363,7 @@ Methods
static
- Check whether the given 'elem' and be wrapped into Drawable object.
+
|
@@ -479,7 +479,7 @@ Constructorinit(properties:Object) -Initialize drawable elements.
+
@@ -509,7 +509,7 @@ Constructor[Static] isDrawable(elem:Object):Boolean -Check whether the given 'elem' and be wrapped into Drawable object.
+
diff --git a/docs/api-en/symbols/Ease.html b/docs/api-en/symbols/Ease.html
index b97fbdbd..ee30d3eb 100644
--- a/docs/api-en/symbols/Ease.html
+++ b/docs/api-en/symbols/Ease.html
@@ -249,7 +249,7 @@ Properties
- Back easing function.Include EaseIn, EaseOut, EaseInOut.
+
|
@@ -269,7 +269,7 @@ Properties
- Bounce easing function.Include EaseIn, EaseOut, EaseInOut.
+
|
@@ -289,7 +289,7 @@ Properties
- Circ easing function.Include EaseIn, EaseOut, EaseInOut.
+
|
@@ -309,7 +309,7 @@ Properties
- Cubic easing function.Include EaseIn, EaseOut, EaseInOut.
+
|
@@ -329,7 +329,7 @@ Properties
- Elastic easing function.Include EaseIn, EaseOut, EaseInOut.
+
|
@@ -349,7 +349,7 @@ Properties
- Expo easing function.Include EaseIn, EaseOut, EaseInOut.
+
|
@@ -369,7 +369,7 @@ Properties
- Linear easing function.Include EaseNone.
+
|
@@ -389,7 +389,7 @@ Properties
- Quad easing function.Include EaseIn, EaseOut, EaseInOut.
+
|
@@ -409,7 +409,7 @@ Properties
- Quart easing function.Include EaseIn, EaseOut, EaseInOut.
+
|
@@ -429,7 +429,7 @@ Properties
- Quint easing function.Include EaseIn, EaseOut, EaseInOut.
+
|
@@ -449,7 +449,7 @@ Properties
- Sine easing function.Include EaseIn, EaseOut, EaseInOut.
+
|
@@ -496,7 +496,7 @@ Property Detail
- Back easing function.Include EaseIn, EaseOut, EaseInOut.
+
@@ -515,7 +515,7 @@ Property Detail
- Bounce easing function.Include EaseIn, EaseOut, EaseInOut.
+
@@ -534,7 +534,7 @@ Property Detail
- Circ easing function.Include EaseIn, EaseOut, EaseInOut.
+
@@ -553,7 +553,7 @@ Property Detail
- Cubic easing function.Include EaseIn, EaseOut, EaseInOut.
+
@@ -572,7 +572,7 @@ Property Detail
- Elastic easing function.Include EaseIn, EaseOut, EaseInOut.
+
@@ -591,7 +591,7 @@ Property Detail
- Expo easing function.Include EaseIn, EaseOut, EaseInOut.
+
@@ -610,7 +610,7 @@ Property Detail
- Linear easing function.Include EaseNone.
+
@@ -629,7 +629,7 @@ Property Detail
- Quad easing function.Include EaseIn, EaseOut, EaseInOut.
+
@@ -648,7 +648,7 @@ Property Detail
- Quart easing function.Include EaseIn, EaseOut, EaseInOut.
+
@@ -667,7 +667,7 @@ Property Detail
- Quint easing function.Include EaseIn, EaseOut, EaseInOut.
+
@@ -686,7 +686,7 @@ Property Detail
- Sine easing function.Include EaseIn, EaseOut, EaseInOut.
+
diff --git a/docs/api-en/symbols/EventMixin.html b/docs/api-en/symbols/EventMixin.html
index a87c8060..5bcc0e09 100644
--- a/docs/api-en/symbols/EventMixin.html
+++ b/docs/api-en/symbols/EventMixin.html
@@ -257,7 +257,7 @@ Methods
static
- Add an event listenser.
+
|
@@ -275,7 +275,7 @@ Methods
static
- Remove one event listener.
+
|
@@ -293,7 +293,7 @@ Methods
static
- Send events.
+
|
@@ -340,7 +340,7 @@ Methods[Static] fire(type:String, detail:Object):Boolean -Send events. If the first parameter is an Object, take it as an Event Object.
+
@@ -382,7 +382,7 @@ Methods[Static] off(type:String, listener:Function):Object -Remove one event listener. Remove all event listeners if no parameter provided, and remove all event listeners on one type which is provided as the only parameter.
+
@@ -424,7 +424,7 @@ Methods[Static] on(type:String, listener:Function, once:Boolean):Object -Add an event listenser.
+
diff --git a/docs/api-en/symbols/Graphics.html b/docs/api-en/symbols/Graphics.html
index 2538a78e..b5a53013 100644
--- a/docs/api-en/symbols/Graphics.html
+++ b/docs/api-en/symbols/Graphics.html
@@ -226,9 +226,6 @@
|
@@ -897,7 +894,7 @@ Methods
- Begin an image filling pattern.
+
|
@@ -915,7 +912,7 @@ Methods
- Set how to fill shapes and the transparency.
+
|
@@ -933,7 +930,7 @@ Methods
- Set linear gradient filling style to draw shapes.
+
|
@@ -951,7 +948,7 @@ Methods
- Begin a new path.
+
|
@@ -969,7 +966,7 @@ Methods
- Set radial gradient filling style to draw shapes.
+
|
@@ -987,7 +984,7 @@ Methods
- Draw a Bézier curve from current point to the point on coordinate (x, y).
+
|
@@ -1005,7 +1002,7 @@ Methods
- Clear all draw actions and reset to the initial state.
+
|
@@ -1023,7 +1020,7 @@ Methods
- Close current path.
+
|
@@ -1041,7 +1038,7 @@ Methods
- Draw a circle.
+
|
@@ -1059,7 +1056,7 @@ Methods
- Draw an ellipse.
+
|
@@ -1077,7 +1074,7 @@ Methods
- Draw a rectangle.
+
|
@@ -1095,7 +1092,7 @@ Methods
- Draw a rounded rectangle.
+
|
@@ -1113,7 +1110,7 @@ Methods
- Draw a complex rounded rectangle.
+
|
@@ -1131,7 +1128,7 @@ Methods
- Draw a path from the SVG data given by parameters.
+
|
@@ -1149,7 +1146,7 @@ Methods
- Apply and end lines-drawing and shapes-filling.
+
|
@@ -1167,7 +1164,7 @@ Methods
- Set the lines style for drawing shapes.
+
|
@@ -1185,7 +1182,7 @@ Methods
- Draw a line from current point to the point on the coordinate value (x, y).
+
|
@@ -1203,7 +1200,7 @@ Methods
- Move current drawing point to a new point on coordinate values (x, y).
+
|
@@ -1221,7 +1218,7 @@ Methods
- Draw a quadratic Bézier curve from current point to the point on coordinate (x, y).
+
|
@@ -1239,7 +1236,7 @@ Methods
- Add current view to a Contaner.
+
|
@@ -1257,7 +1254,7 @@ Methods
- Get the bounds of the view as a circumscribed rectangle and all vertex points relative to the coordinates of the stage.
+
|
@@ -1275,7 +1272,7 @@ Methods
- Get the scaled height of the view.
+
|
@@ -1293,7 +1290,7 @@ Methods
- Get the scaled width of the view.
+
|
@@ -1311,7 +1308,7 @@ Methods
- Get the stage object of the view.
+
|
@@ -1329,7 +1326,7 @@ Methods
- Determining whether an object is in the circumscribed rectangle of current view.
+
|
@@ -1347,7 +1344,7 @@ Methods
- Determining whether a point is in the circumscribed rectangle of current view.
+
|
@@ -1365,7 +1362,7 @@ Methods
- Remove current view from it's parent container
+
|
@@ -1383,7 +1380,7 @@ Methods
- The render method of current view.
+
|
@@ -1401,7 +1398,7 @@ Methods
- Get a string representing current view.
+
|
@@ -1631,7 +1628,7 @@ ConstructorbeginBitmapFill(image:HTMLImageElement, repetition:String):Graphics -Begin an image filling pattern.
+
@@ -1673,7 +1670,7 @@ ConstructorbeginFill(fill:String, alpha:Number):Graphics -Set how to fill shapes and the transparency.
+
@@ -1715,7 +1712,7 @@ ConstructorbeginLinearGradientFill(x0:Number, y0:Number, x1:Number, y1:Number, colors:Array, ratios:Array):Graphics -Set linear gradient filling style to draw shapes.
+
@@ -1777,7 +1774,7 @@ ConstructorbeginPath():Graphics -Begin a new path.
+
@@ -1804,7 +1801,7 @@ ConstructorbeginRadialGradientFill(x0:Number, y0:Number, r0:Number, x1:Number, y1:Number, r1:Number, colors:Array, ratios:Array):Graphics -Set radial gradient filling style to draw shapes.
+
@@ -1876,7 +1873,7 @@ ConstructorbezierCurveTo(cp1x:Number, cp1y:Number, cp2x:Number, cp2y:Number, x:Number, y:Number):Graphics -Draw a Bézier curve from current point to the point on coordinate (x, y).
+
@@ -1938,7 +1935,7 @@ Constructorclear():Graphics -Clear all draw actions and reset to the initial state.
+
@@ -1965,7 +1962,7 @@ ConstructorclosePath():Graphics -Close current path.
+
@@ -1992,7 +1989,7 @@ ConstructordrawCircle(x:Number, y:Number, radius:Number):Graphics -Draw a circle.
+
@@ -2039,7 +2036,7 @@ ConstructordrawEllipse(x:Number, y:Number, width:Number, height:Number):Graphics -Draw an ellipse.
+
@@ -2091,7 +2088,7 @@ ConstructordrawRect(x:Number, y:Number, width:Number, height:Number):Graphics -Draw a rectangle.
+
@@ -2143,7 +2140,7 @@ ConstructordrawRoundRect(x:Number, y:Number, width:Number, height:Number, cornerSize:Number):Graphics -Draw a rounded rectangle.
+
@@ -2200,7 +2197,7 @@ ConstructordrawRoundRectComplex(x:Number, y:Number, width:Number, height:Number, cornerTL:Number, cornerTR:Number, cornerBR:Number, cornerBL:Number):Graphics -Draw a complex rounded rectangle.
+
@@ -2272,11 +2269,7 @@ ConstructordrawSVGPath(pathData:String):Graphics -Draw a path from the SVG data given by parameters.
-Demo:
-
+
@@ -2313,7 +2306,7 @@ var path = 'M250 150 L150 350 L350 350 Z'; -var shape = new Hilo.Graphics({width:500, height:500}); -shape.drawSVGPath(path).beginFill('#0ff').endFill(); ConstructorendFill():Graphics -Apply and end lines-drawing and shapes-filling.
+
@@ -2340,7 +2333,7 @@ ConstructorlineStyle(thickness:Number, lineColor:String, lineAlpha:Number, lineCap:String, lineJoin:String, miterLimit:Number):Graphics -Set the lines style for drawing shapes.
+
@@ -2402,7 +2395,7 @@ ConstructorlineTo(x:Number, y:Number):Graphics -Draw a line from current point to the point on the coordinate value (x, y).
+
@@ -2444,7 +2437,7 @@ ConstructormoveTo(x:Number, y:Number):Graphics -Move current drawing point to a new point on coordinate values (x, y).
+
@@ -2486,7 +2479,7 @@ ConstructorquadraticCurveTo(cpx:Number, cpy:Number, x:Number, y:Number):Graphics -Draw a quadratic Bézier curve from current point to the point on coordinate (x, y).
+
diff --git a/docs/api-en/symbols/HTMLAudio.html b/docs/api-en/symbols/HTMLAudio.html
index 981acfbe..f2d3cedd 100644
--- a/docs/api-en/symbols/HTMLAudio.html
+++ b/docs/api-en/symbols/HTMLAudio.html
@@ -417,7 +417,7 @@ Properties
static
- Does the browser supports HTMLAudio.
+
|
@@ -488,7 +488,7 @@ Methods
- Load audio file.
+
|
@@ -506,7 +506,7 @@ Methods
- Pause (halt) the currently playing audio.
+
|
@@ -524,7 +524,7 @@ Methods
- Start playing the audio.
+
|
@@ -542,7 +542,7 @@ Methods
- Continue to play the audio.
+
|
@@ -560,7 +560,7 @@ Methods
- Set mute mode.
+
|
@@ -578,7 +578,7 @@ Methods
- Set the volume.
+
|
@@ -596,7 +596,7 @@ Methods
- Stop playing the audio.
+
|
@@ -678,7 +678,7 @@ Property Detail
- Does the browser supports HTMLAudio.
+
@@ -845,7 +845,7 @@ Constructorload() -Load audio file.
+
@@ -865,7 +865,7 @@ Constructorpause() -Pause (halt) the currently playing audio.
+
@@ -885,8 +885,7 @@ Constructorplay() -Start playing the audio. And play the audio from the beginning if the audio is already playing.
-Note: To prevent failing to play at the first time, play when the audio is loaded.
+
@@ -906,7 +905,7 @@ Constructorresume() -Continue to play the audio.
+
@@ -926,7 +925,7 @@ ConstructorsetMute(muted) -Set mute mode. Note: iOS devices cannot set mute mode.
+
@@ -956,7 +955,7 @@ ConstructorsetVolume(volume) -Set the volume. Note: iOS devices cannot set volume.
+
@@ -986,7 +985,7 @@ Constructorstop() -Stop playing the audio.
+
diff --git a/docs/api-en/symbols/Hilo.html b/docs/api-en/symbols/Hilo.html
index aa35f2d1..21bebd3e 100644
--- a/docs/api-en/symbols/Hilo.html
+++ b/docs/api-en/symbols/Hilo.html
@@ -251,9 +251,7 @@ Properties
static
- Browser feature set includes:
-
|
@@ -275,9 +273,7 @@ Properties
static
- Event enumeration objects include:
-
|
@@ -299,9 +295,7 @@ Properties
static
- Visual object alinment enumeration objects include:
-
|
@@ -361,7 +355,7 @@ Methods
static
- Get DOM element content in the page display area.
+
|
@@ -379,7 +373,7 @@ Methods
static
- Create a DOM element.
+
|
@@ -397,7 +391,7 @@ Methods
static
- Generates a string representation that contains a path to the specified visual object.
+
|
@@ -415,7 +409,7 @@ Methods
static
- Gets a globally unique id.
+
|
@@ -433,7 +427,7 @@ Methods
static
- Gets a DOM element according to the parameter id.
+
|
@@ -451,7 +445,7 @@ Methods
static
- Simple shallow copy objects.
+
|
@@ -469,7 +463,7 @@ Methods
static
- Generated visual object CSS style transformation.
+
|
@@ -513,18 +507,7 @@ Property Detail
- Visual object alinment enumeration objects include:
-
@@ -543,16 +526,7 @@
Property Detail
- Browser feature set includes:
-
@@ -571,12 +545,7 @@
Property Detail
- Event enumeration objects include:
-
@@ -604,7 +573,7 @@
Property Detail[Static] copy(target:Object, source:Object, strict:Boolean):Object -Simple shallow copy objects.
+
@@ -651,7 +620,7 @@ Property Detail[Static] createElement(type:String, properties:Object):HTMLElement -Create a DOM element. You can specify properties and styles.
+
@@ -693,7 +662,7 @@ Property Detail[Static] getElement(id:String):HTMLElement -Gets a DOM element according to the parameter id. This method is equivalent to document.getElementById(id).
+
@@ -730,7 +699,7 @@ Property Detail[Static] getElementRect(elem:HTMLElement):Object -Get DOM element content in the page display area.
+
@@ -767,7 +736,7 @@ Property Detail[Static] getTransformCSS(obj:View):String -Generated visual object CSS style transformation.
+
@@ -804,7 +773,7 @@ Property Detail[Static] getUid(prefix:String):String -Gets a globally unique id. Such as Stage1, Bitmap2 etc.
+
@@ -841,7 +810,7 @@ Property Detail[Static] viewToString(view:View):String -Generates a string representation that contains a path to the specified visual object. Such as Stage1.Container2.Bitmap3.
+
diff --git a/docs/api-en/symbols/LoadQueue.html b/docs/api-en/symbols/LoadQueue.html
index 43d3627e..83e74dea 100644
--- a/docs/api-en/symbols/LoadQueue.html
+++ b/docs/api-en/symbols/LoadQueue.html
@@ -325,7 +325,7 @@ Methods
- Add desired resource,could be a single object or array resource.
+
|
@@ -343,7 +343,7 @@ Methods
- get resource object by id or src
+
|
@@ -361,7 +361,7 @@ Methods
- get resource object content by id or src
+
|
@@ -379,7 +379,7 @@ Methods
- get loaded resource count
+
|
@@ -397,7 +397,7 @@ Methods
- get resource size, loaded or all.
+
|
@@ -415,7 +415,7 @@ Methods
- get all resource count
+
|
@@ -433,7 +433,7 @@ Methods
- start loading
+
|
@@ -530,7 +530,7 @@ Constructoradd(source:Object|Array):LoadQueue -Add desired resource,could be a single object or array resource.
+
@@ -575,7 +575,7 @@ Constructorget(specified:String):Object -get resource object by id or src
+
@@ -612,7 +612,7 @@ ConstructorgetContent(specified:String):Object -get resource object content by id or src
+
@@ -649,7 +649,7 @@ ConstructorgetLoaded():Uint -get loaded resource count
+
@@ -676,7 +676,7 @@ ConstructorgetSize(identify:Boolean):Number -get resource size, loaded or all.
+
@@ -713,7 +713,7 @@ ConstructorgetTotal():Uint -get all resource count
+
@@ -740,7 +740,7 @@ Constructorstart():LoadQueue -start loading
+
diff --git a/docs/api-en/symbols/Matrix.html b/docs/api-en/symbols/Matrix.html
index 60d4bf9a..0f7bca30 100644
--- a/docs/api-en/symbols/Matrix.html
+++ b/docs/api-en/symbols/Matrix.html
@@ -268,7 +268,7 @@ Methods
- Link a Matrix to current Matrix, in order to make geometry effects on these two composed more effective.
+
|
@@ -286,7 +286,7 @@ Methods
- Set each Matrix property a value to trigger null transform.
+
|
@@ -304,7 +304,7 @@ Methods
- Apply an invert transformation of original Matrix.
+
|
@@ -322,7 +322,7 @@ Methods
- Rotate the Matrix Object.
+
|
@@ -340,7 +340,7 @@ Methods
- Scale the Matrix.
+
|
@@ -358,7 +358,7 @@ Methods
- Return the result after apply a Matrix displaying transform on the point.
+
|
@@ -376,7 +376,7 @@ Methods
- Translate the Matrix alongside x axis and y axis by dx and dy.
+
|
@@ -473,7 +473,7 @@ Constructorconcat(mtx:Matrix):Matrix -Link a Matrix to current Matrix, in order to make geometry effects on these two composed more effective.
+
@@ -510,7 +510,7 @@ Constructoridentity():Matrix -Set each Matrix property a value to trigger null transform. The Matrix after applying identity matrix transformation will be exactly the same as original.
+
@@ -537,7 +537,7 @@ Constructorinvert():Matrix -Apply an invert transformation of original Matrix. Using this invert transformation, you can reset a Matrix to a state before it had been apply some Matrix.
+
@@ -564,7 +564,7 @@ Constructorrotate(angle:Number):Matrix -Rotate the Matrix Object.
+
@@ -601,7 +601,7 @@ Constructorscale(sx:Number, sy:Number):Matrix -Scale the Matrix.
+
@@ -643,7 +643,7 @@ ConstructortransformPoint(point:Object, round:Boolean, returnNew:Boolean):Object -Return the result after apply a Matrix displaying transform on the point.
+
@@ -690,7 +690,7 @@ Constructortranslate(dx:Number, dy:Number):Matrix -Translate the Matrix alongside x axis and y axis by dx and dy.
+
diff --git a/docs/api-en/symbols/ParticleSystem.html b/docs/api-en/symbols/ParticleSystem.html
index 89fd7c2e..db2b08c7 100644
--- a/docs/api-en/symbols/ParticleSystem.html
+++ b/docs/api-en/symbols/ParticleSystem.html
@@ -221,9 +221,6 @@
|
@@ -506,7 +503,7 @@ Methods
- Reset the properties.
+
|
@@ -524,7 +521,7 @@ Methods
- Start emit particles.
+
|
@@ -542,7 +539,7 @@ Methods
- Stop emit particles.
+
|
@@ -851,7 +848,7 @@ ConstructoronUpdate(dt:Number) -更新
+
@@ -881,7 +878,7 @@ Constructorreset(cfg:Object) -Reset the properties.
+
@@ -911,7 +908,7 @@ Constructorstart() -Start emit particles.
+
@@ -931,7 +928,7 @@ Constructorstop(clear:Boolean) -Stop emit particles.
+
diff --git a/docs/api-en/symbols/Renderer.html b/docs/api-en/symbols/Renderer.html
index f6919efd..1001f23a 100644
--- a/docs/api-en/symbols/Renderer.html
+++ b/docs/api-en/symbols/Renderer.html
@@ -365,7 +365,7 @@ Methods
- Clear the given region of canvas.
+
|
@@ -383,7 +383,7 @@ Methods
- Draw the visual object.
+
|
@@ -401,7 +401,7 @@ Methods
- The handling method after draw the visual object.
+
|
@@ -419,7 +419,7 @@ Methods
- Hide the visual object.
+
|
@@ -437,7 +437,7 @@ Methods
- Remove the visual object from canvas.
+
|
@@ -455,7 +455,7 @@ Methods
- Resize the renderer's canvas.
+
|
@@ -473,7 +473,7 @@ Methods
- Prepare for draw visual object.
+
|
@@ -491,7 +491,7 @@ Methods
- Transfrom the visual object.
+
|
@@ -626,7 +626,7 @@ Constructorclear(x:Number, y:Number, width:Number, height:Number) -Clear the given region of canvas. The subclass need to implement it.
+
@@ -671,7 +671,7 @@ Constructordraw(target:View) -Draw the visual object. The subclass need to implement it.
+
@@ -701,7 +701,7 @@ ConstructorendDraw(target:View) -The handling method after draw the visual object. The subclass need to implement it.
+
@@ -731,7 +731,7 @@ Constructorhide() -Hide the visual object. The subclass need to implement it.
+
@@ -751,7 +751,7 @@ Constructorremove(target:View) -Remove the visual object from canvas. Notice that it dosen't remove the object from stage. The subclass need to implement it.
+
@@ -781,7 +781,7 @@ Constructorresize(width:Number, height:Number) -Resize the renderer's canvas.
+
@@ -816,7 +816,7 @@ ConstructorstartDraw(target:View) -Prepare for draw visual object. The subclass need to implement it.
+
@@ -846,7 +846,7 @@ Constructortransform() -Transfrom the visual object. The subclass need to implement it.
+
diff --git a/docs/api-en/symbols/Sprite.html b/docs/api-en/symbols/Sprite.html
index 1861865f..6a815a87 100644
--- a/docs/api-en/symbols/Sprite.html
+++ b/docs/api-en/symbols/Sprite.html
@@ -226,9 +226,6 @@
|
@@ -564,7 +561,7 @@ Properties
- This method will call while the view need update(usually caused by ticker update).
+
|
@@ -857,7 +854,7 @@ Methods
- Add frame into sprite.
+
|
@@ -875,7 +872,7 @@ Methods
- Get the frame of given parameter from sprite.
+
|
@@ -893,7 +890,7 @@ Methods
- Get frame index from sprite.
+
|
@@ -911,7 +908,7 @@ Methods
- Return the total amount of sprite animation frames.
+
|
@@ -929,7 +926,7 @@ Methods
- Jump to an assigned frame.
+
|
@@ -947,7 +944,7 @@ Methods
- Play sprite.
+
|
@@ -965,7 +962,7 @@ Methods
- Set the frame on the given index.
+
|
@@ -983,7 +980,7 @@ Methods
- Set a callback on an assigned frame.
+
|
@@ -1001,7 +998,7 @@ Methods
- Pause playing sprite.
+
|
@@ -1019,7 +1016,7 @@ Methods
- Add current view to a Contaner.
+
|
@@ -1037,7 +1034,7 @@ Methods
- Get the bounds of the view as a circumscribed rectangle and all vertex points relative to the coordinates of the stage.
+
|
@@ -1055,7 +1052,7 @@ Methods
- Get the scaled height of the view.
+
|
@@ -1073,7 +1070,7 @@ Methods
- Get the scaled width of the view.
+
|
@@ -1091,7 +1088,7 @@ Methods
- Get the stage object of the view.
+
|
@@ -1109,7 +1106,7 @@ Methods
- Determining whether an object is in the circumscribed rectangle of current view.
+
|
@@ -1127,7 +1124,7 @@ Methods
- Determining whether a point is in the circumscribed rectangle of current view.
+
|
@@ -1145,7 +1142,7 @@ Methods
- Remove current view from it's parent container
+
|
@@ -1163,7 +1160,7 @@ Methods
- The render method of current view.
+
|
@@ -1181,7 +1178,7 @@ Methods
- Get a string representing current view.
+
|
@@ -1282,7 +1279,7 @@ Property Detail
- Callback function on when sprite enter a new frame. default value is null. Note: this function is obsolete, use addFrameCallback funciton instead.
+
@@ -1376,7 +1373,7 @@ ConstructoraddFrame(frame:Object, startIndex:Int):Sprite -Add frame into sprite.
+
@@ -1418,7 +1415,7 @@ ConstructorgetFrame(indexOrName:Object):Object -Get the frame of given parameter from sprite.
+
@@ -1455,7 +1452,7 @@ ConstructorgetFrameIndex(frameValue:Object):Object -Get frame index from sprite.
+
@@ -1492,7 +1489,7 @@ ConstructorgetNumFrames():Uint -Return the total amount of sprite animation frames.
+
@@ -1519,7 +1516,7 @@ Constructorgoto(indexOrName:Object, pause:Boolean):Sprite -Jump to an assigned frame.
+
@@ -1561,7 +1558,7 @@ Constructorplay():Sprite -Play sprite.
+
@@ -1588,7 +1585,7 @@ ConstructorsetFrame(frame:Object, index:Int):Sprite -Set the frame on the given index.
+
@@ -1630,7 +1627,7 @@ ConstructorsetFrameCallback(frame:Int|String, callback:Function):Sprite -Set a callback on an assigned frame. Every time assigned frame is played, invoke the callback function. If callback is empty, callback function will be removed.
+
@@ -1672,7 +1669,7 @@ Constructorstop():Sprite -Pause playing sprite.
+
diff --git a/docs/api-en/symbols/Stage.html b/docs/api-en/symbols/Stage.html
index 88af3540..7c40fcff 100644
--- a/docs/api-en/symbols/Stage.html
+++ b/docs/api-en/symbols/Stage.html
@@ -226,16 +226,6 @@
|
@@ -884,7 +874,7 @@ Methods
- Add Stage canvas to DOM container.
+
|
@@ -902,7 +892,7 @@ Methods
- Turn on/off Stage response to DOM event.
+
|
@@ -920,7 +910,7 @@ Methods
- Resize the Stage.
+
|
@@ -938,7 +928,7 @@ Methods
- Invoke tick function and Stage will update and render.
+
|
@@ -956,7 +946,7 @@ Methods
- Update the viewport (rendering area) which Stage show on the page.
+
|
@@ -974,7 +964,7 @@ Methods
- Add child element at the top.
+
|
@@ -992,7 +982,7 @@ Methods
- Add child element at given index.
+
|
@@ -1010,7 +1000,7 @@ Methods
- Return whether this container contains the parameter described child element.
+
|
@@ -1028,7 +1018,7 @@ Methods
- Get the bounds of the view as a circumscribed rectangle and all vertex points relative to the coordinates of the stage.
+
|
@@ -1046,7 +1036,7 @@ Methods
- Return child element at the given index.
+
|
@@ -1064,7 +1054,7 @@ Methods
- Return child element at the given id.
+
|
@@ -1082,7 +1072,7 @@ Methods
- Return index value of the given child element.
+
|
@@ -1100,7 +1090,7 @@ Methods
- Return the amount of the children elements of the container.
+
|
@@ -1118,7 +1108,7 @@ Methods
- Get the scaled height of the view.
+
|
@@ -1136,7 +1126,7 @@ Methods
- Get the scaled width of the view.
+
|
@@ -1154,7 +1144,7 @@ Methods
- Get the stage object of the view.
+
|
@@ -1172,7 +1162,7 @@ Methods
- Return object at the point positioned by given values on x axis and y axis.
+
|
@@ -1190,7 +1180,7 @@ Methods
- Determining whether an object is in the circumscribed rectangle of current view.
+
|
@@ -1208,7 +1198,7 @@ Methods
- Determining whether a point is in the circumscribed rectangle of current view.
+
|
@@ -1226,7 +1216,7 @@ Methods
- Remove all children elements.
+
|
@@ -1244,7 +1234,7 @@ Methods
- Remove the given child element.
+
|
@@ -1262,7 +1252,7 @@ Methods
- Remove element at the index.
+
|
@@ -1280,7 +1270,7 @@ Methods
- Remove child element by its id.
+
|
@@ -1298,7 +1288,7 @@ Methods
- Remove current view from it's parent container
+
|
@@ -1316,7 +1306,7 @@ Methods
- The render method of current view.
+
|
@@ -1334,7 +1324,7 @@ Methods
- Set the index of child element.
+
|
@@ -1352,7 +1342,7 @@ Methods
- Sort children elements by the given key or function.
+
|
@@ -1370,7 +1360,7 @@ Methods
- Swap index between two child elements.
+
|
@@ -1388,7 +1378,7 @@ Methods
- Swap two children elements at given indexes.
+
|
@@ -1406,7 +1396,7 @@ Methods
- Get a string representing current view.
+
|
@@ -1568,7 +1558,7 @@ ConstructoraddTo(domElement:HTMLElement):Stage -Add Stage canvas to DOM container. Note: this function overwrite View.addTo function.
+
@@ -1605,7 +1595,7 @@ ConstructorenableDOMEvent(type:String|Array, enabled:Boolean):Stage -Turn on/off Stage response to DOM event. To make visual objects on the Stage interactive, use this function to turn on Stage's responses to events.
+
@@ -1647,7 +1637,7 @@ Constructorresize(width:Number, height:Number, forceResize:Boolean) -Resize the Stage.
+
@@ -1687,7 +1677,7 @@ Constructortick(delta:Number) -Invoke tick function and Stage will update and render. Developer may not need to use this funciton.
+
@@ -1717,7 +1707,7 @@ ConstructorupdateViewport():Object -Update the viewport (rendering area) which Stage show on the page. Invoke this function to update viewport when Stage canvas changes border, margin or padding properties.
+
diff --git a/docs/api-en/symbols/Text.html b/docs/api-en/symbols/Text.html
index b48b194d..b9393958 100644
--- a/docs/api-en/symbols/Text.html
+++ b/docs/api-en/symbols/Text.html
@@ -226,9 +226,6 @@
|
@@ -937,7 +934,7 @@ Methods
- Set text CSS font style.
+
|
@@ -955,7 +952,7 @@ Methods
static
- Measure the line height of the assigned text font style.
+
|
@@ -973,7 +970,7 @@ Methods
- Add current view to a Contaner.
+
|
@@ -991,7 +988,7 @@ Methods
- Get the bounds of the view as a circumscribed rectangle and all vertex points relative to the coordinates of the stage.
+
|
@@ -1009,7 +1006,7 @@ Methods
- Get the scaled height of the view.
+
|
@@ -1027,7 +1024,7 @@ Methods
- Get the scaled width of the view.
+
|
@@ -1045,7 +1042,7 @@ Methods
- Get the stage object of the view.
+
|
@@ -1063,7 +1060,7 @@ Methods
- Determining whether an object is in the circumscribed rectangle of current view.
+
|
@@ -1081,7 +1078,7 @@ Methods
- Determining whether a point is in the circumscribed rectangle of current view.
+
|
@@ -1099,7 +1096,7 @@ Methods
- Remove current view from it's parent container
+
|
@@ -1117,7 +1114,7 @@ Methods
- The render method of current view.
+
|
@@ -1135,7 +1132,7 @@ Methods
- Get a string representing current view.
+
|
@@ -1403,7 +1400,7 @@ Constructor[Static] measureFontHeight(font:String):Number -Measure the line height of the assigned text font style.
+
@@ -1440,7 +1437,7 @@ ConstructorsetFont(font:String):Text -Set text CSS font style.
+
diff --git a/docs/api-en/symbols/TextureAtlas.html b/docs/api-en/symbols/TextureAtlas.html
index 8a3a19c5..0a329d63 100644
--- a/docs/api-en/symbols/TextureAtlas.html
+++ b/docs/api-en/symbols/TextureAtlas.html
@@ -268,7 +268,7 @@ Methods
- 获取指定索引位置index的帧数据。
+
|
@@ -286,7 +286,7 @@ Methods
- 获取指定id的精灵数据。
+
|
@@ -304,7 +304,7 @@ Methods
static
- Shorthand method to create spirte frames
+
|
@@ -394,7 +394,7 @@ Constructor[Static] createSpriteFrames(name:String|Array, frames:String, w:Number, h:Number, loop:Bollean, duration:Number, duration) -Shorthand method to create spirte frames
+
@@ -464,7 +464,7 @@ ConstructorgetFrame(index:Int):Object -获取指定索引位置index的帧数据。
+
@@ -501,7 +501,7 @@ ConstructorgetSprite(id:String):Object -获取指定id的精灵数据。
+
diff --git a/docs/api-en/symbols/Ticker.html b/docs/api-en/symbols/Ticker.html
index d113b1f4..908bb31c 100644
--- a/docs/api-en/symbols/Ticker.html
+++ b/docs/api-en/symbols/Ticker.html
@@ -268,7 +268,7 @@ Methods
- Add tickObject.
+
|
@@ -286,7 +286,7 @@ Methods
- Get the fps.
+
|
@@ -304,7 +304,7 @@ Methods
- Pause the ticker.
+
|
@@ -322,7 +322,7 @@ Methods
- Remove the tickObject
+
|
@@ -340,7 +340,7 @@ Methods
- Resume the ticker.
+
|
@@ -358,7 +358,7 @@ Methods
- Start the ticker.
+
|
@@ -376,7 +376,7 @@ Methods
- Stop the ticker.
+
|
@@ -448,7 +448,7 @@ ConstructoraddTick(tickObject:Object) -Add tickObject. The tickObject must implement the tick method.
+
@@ -478,7 +478,7 @@ ConstructorgetMeasuredFPS() -Get the fps.
+
@@ -498,7 +498,7 @@ Constructorpause() -Pause the ticker.
+
@@ -518,7 +518,7 @@ ConstructorremoveTick(tickObject:Object) -Remove the tickObject
+
@@ -548,7 +548,7 @@ Constructorresume() -Resume the ticker.
+
@@ -568,7 +568,7 @@ Constructorstart(userRAF:Boolean) -Start the ticker.
+
@@ -598,7 +598,7 @@ Constructorstop() -Stop the ticker.
+
diff --git a/docs/api-en/symbols/Tween.html b/docs/api-en/symbols/Tween.html
index 942fbcea..45635463 100644
--- a/docs/api-en/symbols/Tween.html
+++ b/docs/api-en/symbols/Tween.html
@@ -221,27 +221,6 @@
|
@@ -604,7 +583,7 @@ Methods
- Pause the tweening.
+
|
@@ -622,7 +601,7 @@ Methods
- Continue to play the tweening.
+
|
@@ -640,7 +619,7 @@ Methods
- Tween jumps to some point.
+
|
@@ -658,7 +637,7 @@ Methods
- Set beginning properties and ending properties of tweening object.
+
|
@@ -676,7 +655,7 @@ Methods
- Starting the tweening.
+
|
@@ -694,7 +673,7 @@ Methods
- Stop the tweening.
+
|
@@ -712,7 +691,7 @@ Methods
static
- Update all Tween instances.
+
|
@@ -730,7 +709,7 @@ Methods
static
- Add a Tween instance.
+
|
@@ -748,7 +727,7 @@ Methods
static
- Remove one Tween target.
+
|
@@ -766,7 +745,7 @@ Methods
static
- Remove all Tween instances.
+
|
@@ -784,7 +763,7 @@ Methods
static
- Create a tween, make target object easing from beginning properties to ending properties.
+
|
@@ -802,7 +781,7 @@ Methods
static
- Create a tween, make target object easing from current properties to ending properties.
+
|
@@ -820,7 +799,7 @@ Methods
static
- Create a tween, make target object easing from beginning properties to current properties.
+
|
@@ -1160,7 +1139,7 @@ Constructor[Static] add(tween:Tween):Object -Add a Tween instance.
+
@@ -1197,7 +1176,7 @@ Constructor[Static] from(target:Object|Array, fromProps, params):Tween|Array -Create a tween, make target object easing from beginning properties to current properties.
+
@@ -1244,7 +1223,7 @@ Constructor[Static] fromTo(target:Object|Array, fromProps, toProps, params):Tween|Array -Create a tween, make target object easing from beginning properties to ending properties.
+
@@ -1296,7 +1275,7 @@ Constructorlink(tween:Tween):Tween -Link next Tween. The beginning time of next Tween depends on the delay value. If delay is a string that begins with '+' or '-', next Tween will begin at (delay) ms after or before the current tween is ended. If delay is out of previous situation, next Tween will begin at (delay) ms after the beginning point of current Tween.
+
@@ -1333,7 +1312,7 @@ Constructorpause():Tween -Pause the tweening.
+
@@ -1360,7 +1339,7 @@ Constructor[Static] remove(tweenOrTarget:Tween|Object|Array):Object -Remove one Tween target.
+
@@ -1397,7 +1376,7 @@ Constructor[Static] removeAll():Object -Remove all Tween instances.
+
@@ -1424,7 +1403,7 @@ Constructorresume():Tween -Continue to play the tweening.
+
@@ -1451,7 +1430,7 @@ Constructorseek(time:Number, pause:Boolean):Tween -Tween jumps to some point.
+
@@ -1493,7 +1472,7 @@ ConstructorsetProps(fromProps:Object, toProps:Object):Tween -Set beginning properties and ending properties of tweening object.
+
@@ -1535,7 +1514,7 @@ Constructorstart():Tween -Starting the tweening.
+
@@ -1562,7 +1541,7 @@ Constructorstop():Tween -Stop the tweening.
+
@@ -1589,7 +1568,7 @@ Constructor[Static] tick():Object -Update all Tween instances.
+
@@ -1616,7 +1595,7 @@ Constructor[Static] to(target:Object|Array, toProps, params):Tween|Array -Create a tween, make target object easing from current properties to ending properties.
+
diff --git a/docs/api-en/symbols/View.html b/docs/api-en/symbols/View.html
index c4025781..b4c9f1fe 100644
--- a/docs/api-en/symbols/View.html
+++ b/docs/api-en/symbols/View.html
@@ -434,7 +434,7 @@ Properties
- This method will call while the view need update(usually caused by ticker update).
+
|
@@ -725,7 +725,7 @@ Methods
- Add current view to a Contaner.
+
|
@@ -743,7 +743,7 @@ Methods
- Get the bounds of the view as a circumscribed rectangle and all vertex points relative to the coordinates of the stage.
+
|
@@ -761,7 +761,7 @@ Methods
- Get the scaled height of the view.
+
|
@@ -779,7 +779,7 @@ Methods
- Get the scaled width of the view.
+
|
@@ -797,7 +797,7 @@ Methods
- Get the stage object of the view.
+
|
@@ -815,7 +815,7 @@ Methods
- Determining whether an object is in the circumscribed rectangle of current view.
+
|
@@ -833,7 +833,7 @@ Methods
- Determining whether a point is in the circumscribed rectangle of current view.
+
|
@@ -851,7 +851,7 @@ Methods
- Remove current view from it's parent container
+
|
@@ -869,7 +869,7 @@ Methods
- The render method of current view.
+
|
@@ -887,7 +887,7 @@ Methods
- Get a string representing current view.
+
|
@@ -1102,8 +1102,7 @@ Property Detail
- This method will call while the view need update(usually caused by ticker update). This method can return a Boolean value, if return false, the view will not be drawn.
-Limit: If you change the index in it's parent, it will not be drawn correct in current frame but next frame is correct.
+
@@ -1372,7 +1371,7 @@ ConstructoraddTo(container:Container, index:Uint):View -Add current view to a Contaner.
+
@@ -1414,7 +1413,7 @@ ConstructorgetBounds():Array -Get the bounds of the view as a circumscribed rectangle and all vertex points relative to the coordinates of the stage.
+
@@ -1447,7 +1446,7 @@ ConstructorgetScaledHeight():Number -Get the scaled height of the view.
+
@@ -1474,7 +1473,7 @@ ConstructorgetScaledWidth():Number -Get the scaled width of the view.
+
@@ -1501,7 +1500,7 @@ ConstructorgetStage():Stage -Get the stage object of the view. If the view doesn't add to any stage, null will be returned.
+
@@ -1528,7 +1527,7 @@ ConstructorhitTestObject(object:View, usePolyCollision:Boolean) -Determining whether an object is in the circumscribed rectangle of current view.
+
@@ -1563,7 +1562,7 @@ ConstructorhitTestPoint(x:Number, y:Number, usePolyCollision:Boolean):Boolean -Determining whether a point is in the circumscribed rectangle of current view.
+
@@ -1610,7 +1609,7 @@ ConstructorremoveFromParent():View -Remove current view from it's parent container
+
@@ -1637,7 +1636,7 @@ Constructorrender(renderer:Renderer, delta:Number) -The render method of current view. The subclass can implement it's own render logic by rewrite this function.
+
@@ -1672,7 +1671,7 @@ ConstructortoString():String -Get a string representing current view.
+
diff --git a/docs/api-en/symbols/WebAudio.html b/docs/api-en/symbols/WebAudio.html
index b7542d62..25b19515 100644
--- a/docs/api-en/symbols/WebAudio.html
+++ b/docs/api-en/symbols/WebAudio.html
@@ -417,7 +417,7 @@ Properties
static
- Does the browser support WebAudio.
+
|
@@ -439,7 +439,7 @@ Properties
static
- Does browser activate WebAudio already.
+
|
@@ -510,7 +510,7 @@ Methods
- Load audio file.
+
|
@@ -528,7 +528,7 @@ Methods
- Pause (halt) playing the audio.
+
|
@@ -546,7 +546,7 @@ Methods
- Play the audio.
+
|
@@ -564,7 +564,7 @@ Methods
- Continue to play the audio.
+
|
@@ -582,7 +582,7 @@ Methods
- Set mute mode.
+
|
@@ -600,7 +600,7 @@ Methods
- Set the volume.
+
|
@@ -618,7 +618,7 @@ Methods
- Stop playing the audio.
+
|
@@ -636,7 +636,7 @@ Methods
static
- Activate WebAudio.
+
|
@@ -718,7 +718,7 @@ Property Detail
- Does browser activate WebAudio already.
+
@@ -737,7 +737,7 @@ Property Detail
- Does the browser support WebAudio.
+
@@ -904,7 +904,7 @@ Constructor[Static] enable() -Activate WebAudio. Note: Require user action events to activate. Once activated, can play audio without user action events.
+
@@ -924,7 +924,7 @@ Constructorload() -Load audio file. Note: use XMLHttpRequest to load the audio, should pay attention to cross-origin problem.
+
@@ -944,7 +944,7 @@ Constructorpause() -Pause (halt) playing the audio.
+
@@ -964,7 +964,7 @@ Constructorplay() -Play the audio. Restart playing the audio from the beginning if already playing.
+
@@ -984,7 +984,7 @@ Constructorresume() -Continue to play the audio.
+
@@ -1004,7 +1004,7 @@ ConstructorsetMute(muted) -Set mute mode.
+
@@ -1034,7 +1034,7 @@ ConstructorsetVolume(volume) -Set the volume.
+
@@ -1064,7 +1064,7 @@ Constructorstop() -Stop playing the audio.
+
diff --git a/docs/api-en/symbols/WebGLRenderer.html b/docs/api-en/symbols/WebGLRenderer.html
index 2cb50b56..f53e753f 100644
--- a/docs/api-en/symbols/WebGLRenderer.html
+++ b/docs/api-en/symbols/WebGLRenderer.html
@@ -283,7 +283,7 @@ Properties
static
- is WebGL supported, readonly.
+
|
@@ -305,7 +305,7 @@ Properties
static
- The max num of batch draw, default is 2000.
+
|
@@ -327,7 +327,7 @@ Properties
static
- The num of vertex attributes, readonly.
+
|
@@ -460,7 +460,7 @@ Methods
- Clear the given region of canvas.
+
|
@@ -478,7 +478,7 @@ Methods
- Draw the visual object.
+
|
@@ -496,7 +496,7 @@ Methods
- The handling method after draw the visual object.
+
|
@@ -514,7 +514,7 @@ Methods
- Hide the visual object.
+
|
@@ -532,7 +532,7 @@ Methods
- Remove the visual object from canvas.
+
|
@@ -550,7 +550,7 @@ Methods
- Resize the renderer's canvas.
+
|
@@ -568,7 +568,7 @@ Methods
- Prepare for draw visual object.
+
|
@@ -586,7 +586,7 @@ Methods
- Transfrom the visual object.
+
|
@@ -630,7 +630,7 @@ Property Detail
- The num of vertex attributes, readonly.
+
@@ -668,7 +668,7 @@ Property Detail
- is WebGL supported, readonly.
+
@@ -687,7 +687,7 @@ Property Detail
- The max num of batch draw, default is 2000.
+
diff --git a/docs/api-en/symbols/WebSound.html b/docs/api-en/symbols/WebSound.html
index ab046754..cb88419a 100644
--- a/docs/api-en/symbols/WebSound.html
+++ b/docs/api-en/symbols/WebSound.html
@@ -221,21 +221,6 @@
|
@@ -290,7 +275,7 @@ Methods
static
- Get audio element.
+
|
@@ -308,7 +293,7 @@ Methods
static
- Remove audio element.
+
|
@@ -355,7 +340,7 @@ Methods[Static] enableAudio() -Activate audio function. Note: Require user action events to activate. Currently support WebAudio.
+
@@ -375,7 +360,7 @@ Methods[Static] getAudio(source:String|Object):WebAudio|HTMLAudio -Get audio element. Use WebAudio if supported.
+
@@ -412,7 +397,7 @@ Methods[Static] removeAudio(source:String|Object) -Remove audio element.
+
diff --git a/docs/api-en/symbols/drag.html b/docs/api-en/symbols/drag.html
index abae48b4..37d6d526 100644
--- a/docs/api-en/symbols/drag.html
+++ b/docs/api-en/symbols/drag.html
@@ -221,15 +221,6 @@
|
@@ -284,7 +275,7 @@ Methods
static
- stop drag.
+
|
@@ -331,7 +322,7 @@ Methods[Static] startDrag(bounds:Array) -start drag.
+
@@ -361,7 +352,7 @@ Methods[Static] stopDrag() -stop drag.
+
diff --git a/docs/api-en/symbols/src/docs_api-en_code_core_Class.js.html b/docs/api-en/symbols/src/docs_api-en_code_core_Class.js.html
index 2c187051..d05f79e4 100644
--- a/docs/api-en/symbols/src/docs_api-en_code_core_Class.js.html
+++ b/docs/api-en/symbols/src/docs_api-en_code_core_Class.js.html
@@ -12,8 +12,8 @@
5 */
6
7 /**
- 8 *
- 9 * Create class example:
+ 8 * @language=en
+ 9 * Create Example Class:
10 * <pre>
11 * var Bird = Hilo.Class.create({
12 * Extends: Animal,
@@ -35,21 +35,21 @@
28 * swallow.fly();
29 * Bird.isBird(swallow);
30 * </pre>
- 31 * @namespace Class Class is created to provide aid.
+ 31 * @namespace Class Class is created to aid the developer.
32 * @static
33 * @module hilo/core/Class
34 */
35 var Class = (function(){
36
37 /**
- 38 *
- 39 * Create a class based on the specified properties, parameters and methods.
- 40 * @param {Object} properties Properties and methods to create the class. They are:
+ 38 * @language=en
+ 39 * Create a class based on the parameters, properties and methods specified.
+ 40 * @param {Object} properties Properties and methods to create the class.
41 * <ul>
- 42 * <li><b>Extends</b> - Designated to inherit the parent class.</li>
+ 42 * <li><b>Extends</b> - Designed to inherit the parent class.</li>
43 * <li><b>Mixes</b> - Specifies mixed member collection object.</li>
- 44 * <li><b>Statics</b> - Static property or method of specified class.</li>
- 45 * <li><b>constructor</b> - The constructor of the specified class.</li>
+ 44 * <li><b>Statics</b> - Static property or method specified class.</li>
+ 45 * <li><b>constructor</b> - The constructor of specified class.</li>
46 * <li>Other members of the property or method to create the class.</li>
47 * </ul>
48 * @returns {Object} Create classes.
@@ -62,119 +62,121 @@
55 }
56
57 /**
- 58 * @private
- 59 */
- 60 var implement = function(properties){
- 61 var proto = {}, key, value;
- 62 for(key in properties){
- 63 value = properties[key];
- 64 if(classMutators.hasOwnProperty(key)){
- 65 classMutators[key].call(this, value);
- 66 }else{
- 67 proto[key] = value;
- 68 }
- 69 }
- 70
- 71 mix(this.prototype, proto);
- 72 };
- 73
- 74 var classMutators = /** @ignore */{
- 75 Extends: function(parent){
- 76 var existed = this.prototype, proto = createProto(parent.prototype);
- 77 //inherit static properites
- 78 mix(this, parent);
- 79 //keep existed properties
- 80 mix(proto, existed);
- 81 //correct constructor
- 82 proto.constructor = this;
- 83 //prototype chaining
- 84 this.prototype = proto;
- 85 //shortcut to parent's prototype
- 86 this.superclass = parent.prototype;
- 87 },
- 88
- 89 Mixes: function(items){
- 90 items instanceof Array || (items = [items]);
- 91 var proto = this.prototype, item;
- 92
- 93 while(item = items.shift()){
- 94 mix(proto, item.prototype || item);
- 95 }
- 96 },
- 97
- 98 Statics: function(properties){
- 99 mix(this, properties);
-100 }
-101 };
-102
-103 /**
-104 * @private
-105 */
-106 var createProto = (function(){
-107 if(Object.__proto__){
-108 return function(proto){
-109 return {__proto__: proto};
-110 }
-111 }else{
-112 var Ctor = function(){};
-113 return function(proto){
-114 Ctor.prototype = proto;
-115 return new Ctor();
-116 }
-117 }
-118 })();
-119
-120 /**
-121 *
-122 * Mixed property or method.
-123 * @param {Object} target Mixed audiences.
-124 * @param {Object} source The source whose methods and properties are to be mixed. It can support multiple source parameters.
-125 * @returns {Object} Mixed audiences.
-126 */
-127 var mix = function(target){
-128 for(var i = 1, len = arguments.length; i < len; i++){
-129 var source = arguments[i], defineProps;
-130 for(var key in source){
-131 var prop = source[key];
-132 if(prop && typeof prop === 'object'){
-133 if(prop.value !== undefined || typeof prop.get === 'function' || typeof prop.set === 'function'){
-134 defineProps = defineProps || {};
-135 defineProps[key] = prop;
-136 continue;
-137 }
-138 }
-139 target[key] = prop;
-140 }
-141 if(defineProps) defineProperties(target, defineProps);
-142 }
-143
-144 return target;
-145 };
-146
-147 try{
-148 var defineProperty = Object.defineProperty,
-149 defineProperties = Object.defineProperties;
-150 defineProperty({}, '$', {value:0});
-151 }catch(e){
-152 if('__defineGetter__' in Object){
-153 defineProperty = function(obj, prop, desc){
-154 if('value' in desc) obj[prop] = desc.value;
-155 if('get' in desc) obj.__defineGetter__(prop, desc.get);
-156 if('set' in desc) obj.__defineSetter__(prop, desc.set);
-157 return obj;
-158 };
-159 defineProperties = function(obj, props){
-160 for(var prop in props){
-161 if(props.hasOwnProperty(prop)){
-162 defineProperty(obj, prop, props[prop]);
-163 }
-164 }
-165 return obj;
-166 };
-167 }
-168 }
-169
-170 return {create:create, mix:mix};
+ 58 * @language=en
+ 59 * @private
+ 60 */
+ 61 var implement = function(properties){
+ 62 var proto = {}, key, value;
+ 63 for(key in properties){
+ 64 value = properties[key];
+ 65 if(classMutators.hasOwnProperty(key)){
+ 66 classMutators[key].call(this, value);
+ 67 }else{
+ 68 proto[key] = value;
+ 69 }
+ 70 }
+ 71
+ 72 mix(this.prototype, proto);
+ 73 };
+ 74
+ 75 var classMutators = /** @ignore */{
+ 76 Extends: function(parent){
+ 77 var existed = this.prototype, proto = createProto(parent.prototype);
+ 78 //inherit static properites
+ 79 mix(this, parent);
+ 80 //keep existed properties
+ 81 mix(proto, existed);
+ 82 //correct constructor
+ 83 proto.constructor = this;
+ 84 //prototype chaining
+ 85 this.prototype = proto;
+ 86 //shortcut to parent's prototype
+ 87 this.superclass = parent.prototype;
+ 88 },
+ 89
+ 90 Mixes: function(items){
+ 91 items instanceof Array || (items = [items]);
+ 92 var proto = this.prototype, item;
+ 93
+ 94 while(item = items.shift()){
+ 95 mix(proto, item.prototype || item);
+ 96 }
+ 97 },
+ 98
+ 99 Statics: function(properties){
+100 mix(this, properties);
+101 }
+102 };
+103
+104 /**
+105 * @language=en
+106 * @private
+107 */
+108 var createProto = (function(){
+109 if(Object.__proto__){
+110 return function(proto){
+111 return {__proto__: proto};
+112 }
+113 }else{
+114 var Ctor = function(){};
+115 return function(proto){
+116 Ctor.prototype = proto;
+117 return new Ctor();
+118 }
+119 }
+120 })();
+121
+122 /**
+123 * @language=en
+124 * Mixed property or method.
+125 * @param {Object} target Mixed audiences.
+126 * @param {Object} source The source whose methods and properties are to be mixed. It can support multiple source parameters.
+127 * @returns {Object} Mixed audiences.
+128 */
+129 var mix = function(target){
+130 for(var i = 1, len = arguments.length; i < len; i++){
+131 var source = arguments[i], defineProps;
+132 for(var key in source){
+133 var prop = source[key];
+134 if(prop && typeof prop === 'object'){
+135 if(prop.value !== undefined || typeof prop.get === 'function' || typeof prop.set === 'function'){
+136 defineProps = defineProps || {};
+137 defineProps[key] = prop;
+138 continue;
+139 }
+140 }
+141 target[key] = prop;
+142 }
+143 if(defineProps) defineProperties(target, defineProps);
+144 }
+145
+146 return target;
+147 };
+148
+149 try{
+150 var defineProperty = Object.defineProperty,
+151 defineProperties = Object.defineProperties;
+152 defineProperty({}, '$', {value:0});
+153 }catch(e){
+154 if('__defineGetter__' in Object){
+155 defineProperty = function(obj, prop, desc){
+156 if('value' in desc) obj[prop] = desc.value;
+157 if('get' in desc) obj.__defineGetter__(prop, desc.get);
+158 if('set' in desc) obj.__defineSetter__(prop, desc.set);
+159 return obj;
+160 };
+161 defineProperties = function(obj, props){
+162 for(var prop in props){
+163 if(props.hasOwnProperty(prop)){
+164 defineProperty(obj, prop, props[prop]);
+165 }
+166 }
+167 return obj;
+168 };
+169 }
+170 }
171
-172 })();
-173 |