Closed chentangchun closed 5 years ago
Speed is just Distance/Time.
We use Distance to animate line. You can write your own animation function that will calculate. Example:
L.motion.polyline([[50,0], [60,10]], {
color: "transparent"
}, {
auto: true,
duration: 3000,
easing: function(durationRatio, elapsedTime, x, y, durationTime) { return /*here we return passed duration ration (from 0 to 1) from start point based on our needed time animation function*/ durationRation*durationRation; }
})
Here our custom easing function will be called ou each line animation paint and you can handle speed anyway you want.
Speed is just Distance/Time.
We use Distance to animate line. You can write your own animation function that will calculate. Example:
L.motion.polyline([[50,0], [60,10]], { color: "transparent" }, { auto: true, duration: 3000, easing: function(durationRatio, elapsedTime, x, y, durationTime) { return /*here we return passed duration ration (from 0 to 1) from start point based on our needed time animation function*/ durationRation*durationRation; } })
Here our custom easing function will be called ou each line animation paint and you can handle speed anyway you want.
thanks
@chentangchun if it's still applicable, I have extended motionSpeed to work nicely on speed change during animation.
I want to change the speed to take effect in real time. I should how do it?