Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Convert FrameLoop to TypeScript
  • Loading branch information
jacobrask committed Feb 19, 2019
commit 767d601dbbc8e0abfbf49430c30925d24de110a9
7 changes: 3 additions & 4 deletions src/animated/FrameLoop.js → src/animated/FrameLoop.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import Animated from './Animated'
import Controller from './Controller'
import { now, requestFrame } from './Globals'

let active = false
Expand All @@ -15,7 +16,7 @@ const frameLoop = () => {
configIdx++
) {
let config = controller.configs[configIdx]
let endOfAnimation, lastTime, velocity
let endOfAnimation, lastTime
for (let valIdx = 0; valIdx < config.animatedValues.length; valIdx++) {
let animation = config.animatedValues[valIdx]

Expand Down Expand Up @@ -129,14 +130,12 @@ const frameLoop = () => {
else active = false
}

const start = controller => {
const start = (controller: Controller) => {
if (!controllers.has(controller)) {
controllers.add(controller)
if (!active) requestFrame(frameLoop)
active = true
}
}

const isActive = controller => active && controllers.has(controller)

export { start }