【发布时间】:2018-09-18 01:40:02
【问题描述】:
我是 EaselJs 的新手。 我正在旋转一个带有 9x 数字和 3 (0x) 的轮子,总共 12 个数字。我可以通过调用函数来旋转轮子,但我想在轮子的预定义特定点/编号上停止它。
var _oContainer;
this._init = function(iXPos,iYPos){
_oWheel = s_oSpriteLibrary.getSprite("wheel_circle");
_oContainer = new createjs.Container;
_oContainer.x = CANVAS_WIDTH - 200;
_oContainer.y = CANVAS_HEIGHT - 350;
s_oStage.addChild(_oContainer);
img = createBitmap(_oWheel);
img.regX = _oWheel.width / 2;
img.regY = _oWheel.height / 2;
_oContainer.addChild(img);
}
this.spin = function(b, a){
//var h = new createjs.Bitmap(s_oSpriteLibrary.getSprite('wheel_circle'));
createjs.Tween.get(_oContainer).to({
rotation: _oContainer.rotation + a
}, 2600, createjs.Ease.quartOut).call(function() {
_oContainer.rotation %= 360;
})
}
每次单击按钮时,我都将 spin 函数称为 this.spin(5, 1131.7511808994204);。
现在它会在每次点击按钮时随机旋转和停止。如何将其停在车轮上的特定数字/位置?
我应该在rotation: 中给出什么值?
【问题讨论】:
标签: javascript createjs easeljs