mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
start tick
This commit is contained in:
@@ -4,7 +4,6 @@ import * as util from 'ionic/util/util'
|
||||
import {Collide} from './collide'
|
||||
import {CSS} from './css'
|
||||
import {getEasing} from './easing'
|
||||
import {tick} from './tick'
|
||||
|
||||
const data = Collide.data;
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import {Collide} from './collide'
|
||||
import {animationStart} from './animation-start'
|
||||
import {animationStop} from './animation-stop'
|
||||
import {startTick} from './tick'
|
||||
|
||||
|
||||
export class Animation {
|
||||
@@ -29,7 +30,7 @@ export class Animation {
|
||||
start() {
|
||||
let promise = animationStart(this._elements, this._options, this._properties)
|
||||
|
||||
Collide.startTick();
|
||||
startTick();
|
||||
|
||||
return promise
|
||||
}
|
||||
|
||||
@@ -55,17 +55,6 @@ export let Collide = {
|
||||
/* Set to 1 or 2 (most verbose) to output debug info to console. */
|
||||
debug: false,
|
||||
|
||||
startTick: function() {
|
||||
/* If the animation tick isn't running, start it.
|
||||
Collide shuts it off when there are no active calls to process. */
|
||||
if (Collide.State.isTicking === false) {
|
||||
Collide.State.isTicking = true;
|
||||
|
||||
/* Start the tick loop. */
|
||||
tick();
|
||||
}
|
||||
},
|
||||
|
||||
/* initialize element data */
|
||||
initData: function(element) {
|
||||
element.$collide = {
|
||||
|
||||
@@ -10,8 +10,15 @@ import {completeCall} from './complete-call'
|
||||
Tick
|
||||
************/
|
||||
|
||||
export function startTick() {
|
||||
if (!Collide.State.isTicking && Collide.State.calls && Collide.State.calls.length) {
|
||||
Collide.State.isTicking = true;
|
||||
tick();
|
||||
}
|
||||
}
|
||||
|
||||
/* Note: All calls to Collide are pushed to the Collide.State.calls array, which is fully iterated through upon each tick. */
|
||||
export function tick(timestamp) {
|
||||
function tick(timestamp) {
|
||||
/* An empty timestamp argument indicates that this is the first tick occurence since ticking was turned on.
|
||||
We leverage this metadata to fully ignore the first tick pass since RAF's initial pass is fired whenever
|
||||
the browser's next tick sync time occurs, which results in the first elements subjected to Collide
|
||||
|
||||
Reference in New Issue
Block a user