0
我真正的新畫布,和我目前使用的oCanvas插件,以實現一個類似的在這裏的影響:http://www.meetgraham.com.au/view-graham動畫效果的X和Y帆布的參數形狀
到目前爲止,這是怎麼回事好。不過,我需要動畫橢圓變大,並在畫布第一次點擊時移動到鼠標位置。我已經通過使用jQuery .animate();
爲形狀的radius
設置動畫,從而按照預期增加了橢圓。但是,它似乎沒有與x
和y
參數一起工作 - 有誰知道我可以如何爲那些移動到當前鼠標位置設置動畫?
這裏是我的代碼:
var ellipseStroke = canvas.display.ellipse({
x: 10,
y: 10,
radius: 50,
stroke: "10px #fff"
});
var ellipse = canvas.display.ellipse({
x: 10,
y: 10,
radius: 50,
fill: "white",
composition:"destination-atop"
});
// Add circle to the canvas
canvas.addChild(ellipseStroke);
canvas.addChild(ellipse);
//Define the Seymour variable to determine whether the user has clicked the canvas or not.
var seymour = false;
$('#canvas').click(function(){
ellipse.animate({
radius: 150,
x: 200,
y: 200,
},1000);
ellipseStroke.animate({
radius: 150,
x: 200,
y: 200,
},1000);
seymour = true;
});
`