摘要:
动画类API
一、API 使用
1. 1 d3.ease
1.2 d3.timer
Start a custom animation timer, invoking the specified function repeatedly until it returns true. There is no way to cancel the timer after it starts, so make sure your timer function returns true when done!
动画开始动作,知道方法返回true 才会停止。 动画开始后不能手动停止,只能方法返回true 才会停止。
An optional numeric delay in milliseconds may be specified when the given function should only be invoked after a delay. The delay is relative to the specified time in milliseconds since UNIX epoch; if time is not specified, it defaults to Date.now.
可以设置动画延迟时间,延时单位为毫秒。延迟是和指定的时间相关,如果没制定时间,默认为当前时间。
You may use delay and time to specify relative and absolute moments in time when the function should start being invoked. For example, a calendar notification might be coded as:
可以使用延迟和时间指定动画开始的确切时间。例如,日历提醒可以如下编码:
d3.timer(notify, -4 * 1000 * 60 * 60, +new Date(2012, 09, 29)); // four hours before midnight October 29 (months are zero-based)
Note that if d3.timer is called within the callback of another timer, the new timer will be invoked immediately at the end of the current frame (if active as determined by the specified delay and time), rather than waiting until the next frame.
可以看到d3.timer 是在另一时刻被调用,新计时器将立刻被触发 (如果指定动作的延迟和时间),而不是等待下一帧。
1.3 d3.interpolate