gpt4 book ai didi

javascript - 为 raphael 对象制作动画

转载 作者:行者123 更新时间:2023-12-03 09:46:50 25 4
gpt4 key购买 nike

我对 raphael.js 很陌生,我正在尝试为 raphael 元素设置动画。例如,我使用 paper.path() 绘制了一个箭头。

var arrow = paper.path("M10,10L100,100");
arrow.attr({
"stroke-width": 5,
"stroke-dasharray": "-.",
"arrow-end": "classic-wide-long"
});

如何使箭头的颜色在绘制时看起来闪烁?

最佳答案

使用.animate()。例如,

arrow.animate({
"25%": {stroke: "pink", easing: "bounce"},
"50%": {stroke: "red", easing: "bounce"},
"75%": {stroke: "pink", easing: "bounce"},
"100%": {stroke: "red", easing: "bounce"}
},2500);

其中百分比是达到指定持续时间(本例中为 2500 毫秒)的帧步长。

关于javascript - 为 raphael 对象制作动画,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30997312/

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