-
Notifications
You must be signed in to change notification settings - Fork 0
Ticker
何波 edited this page Feb 18, 2019
·
13 revisions
帧频,framerate == 1000/interval
createjs.Ticker.framerate = 10指示每次ticks的间隔时间(毫秒)。默认值为50(20 fps)。请注意,根据CPU负载的不同,ticks之间的实际时间可能会超过指定的时间。如果使用RAF计时模式,则忽略此属性。
定Tick事件对象中Delta属性的最大值。这在构建基于时间的动画和系统时很有用,以防止由后台选项卡、系统睡眠、警报对话框或其他阻塞例程造成的大时间间隔引起的问题。预期帧持续时间的两倍通常是一个有效值(例如,当以40fps运行时,maxdelta=50)。
When the ticker is paused, all listeners will still receive a tick event, but the paused property of the event will be true. Also, while paused the runTime will not increase. See tick, getTime, and getEventTime for more info.
createjs.Ticker.addEventListener("tick", handleTick);
createjs.Ticker.addEventListener("tick", handleTick);
createjs.Ticker.paused = true;
function handleTick(event) {
console.log(event.paused)
console.log(createjs.Ticker.getTime(false)) // 增长
console.log(createjs.Ticker.getTime(true)) // 不增长
}