gpt4 book ai didi

javascript - 带有动态部分的动画 Canvas

转载 作者:行者123 更新时间:2023-11-28 06:04:58 26 4
gpt4 key购买 nike

我正在尝试实现与此相同的想法:http://jsfiddle.net/oskar/Aapn8/但是我正在尝试使用不同大小的部分,而不是

var draw = function(current) {
ctx.putImageData(imd, 0, 0);
ctx.beginPath();
ctx.arc(120, 120, 70, -(quart), ((circ) * current) - quart, false);
ctx.stroke();
}

作为我使用的绘制函数:

var draw = function(current) {
for (i = 0 ; i < degrees.length ; i++) {
color = colors[i];
ctx.fillStyle = colors[i];
ctx.beginPath();
ctx.moveTo(cx,cy);
ctx.arc(cx,cy,radius,start,start+toRad(degrees[i]));
ctx.lineTo(cx,cy);
ctx.closePath();
ctx.fill();
start += toRad(degrees[i]);
}
}

但它不起作用 ( https://jsfiddle.net/py6t8yj0/5/ ) 但确实按需要绘制了圆圈。

我不需要“范围”选择器,但我希望在圆圈到达终点后出现弹跳效果。

如果有人能提供帮助那就太好了 :D。

谢谢

最佳答案

看起来您的 fiddle 中没有包含 Mootools。我收到一个错误:

Uncaught ReferenceError: Fx is not defined

如果单击 Javascript 设置按钮,则可以添加 Mootools 依赖项。这是使用该依赖项更新的 jsfiddle:https://jsfiddle.net/py6t8yj0/1/

关于javascript - 带有动态部分的动画 Canvas ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36510566/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com