[英]How do I get the current rotation angle with jCanvas animation?
我無法弄清楚如何在jCanvas中獲得弓的當前旋轉角度。 當我真的想改變它的行為時, layer.rotate
似乎只為我提供了原來的旋轉設置。
我在jsfiddle上有一個示例設置來演示該問題。
任何見識將不勝感激。
您是否在尋找這個值$('#rot')。val()
while (i < 1000) {
setTimeout(function() { rotate() }, 1000);
alert( $('#rot').val());
i += 1;
}
animateLayer()
和animateLayerGroup()
方法支持與jQuery的animate()
方法相同的備用語法,該語法允許進行step
回調:
// Cache canvas element
var $canvas = $("canvas");
// Draw and animate
$canvas.drawArc({
layer: true,
name: 'arcy',
fillStyle: "#000",
x: 100, y: 100,
radius: 50,
start: 135, end: 45
});
$canvas.animateLayer('arcy', {
rotate: 360
}, {
// Use the step callback to run a function on every frame
step: function(now, fx, layer) {
console.log(layer.rotate);
}
});
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.