Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Fixed small bug where views stayed animating
- Loading branch information
|
@@ -1568,10 +1568,12 @@ require.define("/animation.coffee",function(require,module,exports,__dirname,__f |
|
|
|
|
|
Animation.prototype.stop = function() { |
|
|
this._stop = true; |
|
|
this._end(); |
|
|
return this.view.style.webkitTransform = this.view.computedStyle.webkitTransform; |
|
|
}; |
|
|
|
|
|
Animation.prototype._end = function(callback) { |
|
|
this.view._animationDuration = 0; |
|
|
this.emit("end", this); |
|
|
utils.remove(this.view._animations, this); |
|
|
return typeof callback === "function" ? callback() : void 0; |
|
|
|
@@ -3,7 +3,7 @@ |
|
|
|
|
|
require "./utils" |
|
|
|
|
|
PROPERTIES = ["view", "curve", "time", "origin"] |
|
|
PROPERTIES = ["view", "curve", "time", "origin", "tolerance"] |
|
|
|
|
|
parseCurve = (a) -> |
|
|
|
|
@@ -45,6 +45,8 @@ class exports.Animation extends EventEmitter |
|
|
# console.log "Animation.stop", @ |
|
|
|
|
|
_end: (callback) => |
|
|
# @view._animated = false |
|
|
@view._animationDuration = 0 |
|
|
@emit "end", @ |
|
|
utils.remove @view._animations, @ |
|
|
callback?() |
|
@@ -74,6 +76,7 @@ class exports.Animation extends EventEmitter |
|
|
friction: values[1] |
|
|
velocity: values[2] |
|
|
speed: 1/60 |
|
|
tolerance: @tolerance or 0.01 |
|
|
|
|
|
@_startSpring options, callback |
|
|
|
|
@@ -102,9 +105,6 @@ class exports.Animation extends EventEmitter |
|
|
|
|
|
value = @spring.next() |
|
|
|
|
|
if @modifiers[k] |
|
|
value = @modifiers[k](value) |
|
|
|
|
|
nextState = {} |
|
|
|
|
|
for k, v of beginState |
|
@@ -116,6 +116,9 @@ class exports.Animation extends EventEmitter |
|
|
# for designers, but you lose some control wit this magic added. |
|
|
# if k in ["x", "y", "z", "width", "height"] |
|
|
# nextState[k] = parseInt nextState[k] |
|
|
|
|
|
if @modifiers[k] |
|
|
nextState[k] = @modifiers[k](nextState[k]) |
|
|
|
|
|
@_animate nextState, "linear", @spring.speed, run |
|
|
|
|
|
|
@@ -90,6 +90,7 @@ class Spring |
|
|
# See if we reached the end state |
|
|
netValueIsLow = Math.abs(netFloat) < @tolerance |
|
|
netVelocityIsLow = Math.abs(net1DVelocity) < @tolerance |
|
|
|
|
|
stopSpring = netValueIsLow and netVelocityIsLow |
|
|
|
|
|
@moving = !stopSpring |
|
|
|
@@ -203,6 +203,7 @@ class View extends Frame |
|
|
|
|
|
# @addClass "animated" if value is true |
|
|
# @removeClass "animated" if value is false |
|
|
|
|
|
@__animated = value |
|
|
|
|
|
# Small hack to go to next event tick and make sure |
|
@@ -248,7 +249,7 @@ class View extends Frame |
|
|
|
|
|
@define "style" |
|
|
get: -> @_element.style |
|
|
set: (value) -> |
|
|
set: (value) -> |
|
|
utils.extend @_element.style, value |
|
|
@emit "change:style" |
|
|
|
|
|
|
@@ -1568,10 +1568,12 @@ require.define("/animation.coffee",function(require,module,exports,__dirname,__f |
|
|
|
|
|
Animation.prototype.stop = function() { |
|
|
this._stop = true; |
|
|
this._end(); |
|
|
return this.view.style.webkitTransform = this.view.computedStyle.webkitTransform; |
|
|
}; |
|
|
|
|
|
Animation.prototype._end = function(callback) { |
|
|
this.view._animationDuration = 0; |
|
|
this.emit("end", this); |
|
|
utils.remove(this.view._animations, this); |
|
|
return typeof callback === "function" ? callback() : void 0; |
|
|