Skip to content

Commit

Permalink
Fix animation events add querySelector
Browse files Browse the repository at this point in the history
  • Loading branch information
koenbok committed Sep 25, 2014
1 parent 9552f44 commit 4686f4f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 17 deletions.
18 changes: 4 additions & 14 deletions framer/Animation.coffee
Expand Up @@ -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--
Expand All @@ -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, @

Expand All @@ -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))
Expand Down
4 changes: 1 addition & 3 deletions framer/Animator.coffee
@@ -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
Expand Down

0 comments on commit 4686f4f

Please sign in to comment.