Permalink
Browse files

Fix animation events add querySelector

  • Loading branch information...
koenbok committed Sep 25, 2014
1 parent 9552f44 commit 4686f4fcd68e9eead26a3fd679c6796c174ad707
Showing with 5 additions and 17 deletions.
  1. +4 −14 framer/Animation.coffee
  2. +1 −3 framer/Animator.coffee
@@ -109,17 +109,11 @@ class exports.Animation extends EventEmitter
console.log "Animation.start"
console.log "\t#{k}: #{@_stateA[k]} -> #{@_stateB[k]}" for k, v of @_stateB
# TODO
@_animator.on "start", => @emit "start"
@_animator.on "stop", => @emit "stop"
@_animator.on "end", => @emit "end"
# See if we need to repeat this animation
# Todo: more repeat behaviours:
# 1) add (from end position) 2) reverse (loop between a and b)
if @_repeatCounter > 0
@_animator.on "end", =>
@on "end", =>
for k, v of @_stateA
@_target[k] = v
@_repeatCounter--
@@ -131,13 +125,8 @@ class exports.Animation extends EventEmitter
else
@_start()
stop: ->
@_animator.emit("stop")
@emit("stop")
Framer.Loop.off("update", @_update)
# _runningAnimations = _.without _runningAnimations, @
@@ -159,12 +148,13 @@ class exports.Animation extends EventEmitter
@options.layer.emit(event, @)
_start: =>
@emit("start")
Framer.Loop.on("update", @_update)
_update: (delta) =>
if @_animator.finished()
@_updateValue(1)
@_animator.emit("end")
@emit("end")
@stop()
else
@_updateValue(@_animator.next(delta))
@@ -1,10 +1,8 @@
Utils = require "./Utils"
{Config} = require "./Config"
{EventEmitter} = require "./EventEmitter"
{AnimationLoop} = require "./AnimationLoop"
class exports.Animator extends EventEmitter
class exports.Animator
"""
The animator class is a very simple class that

0 comments on commit 4686f4f

Please sign in to comment.