Permalink
Browse files

Adding Animation.reverse()

  • Loading branch information...
Koen Bok
Koen Bok committed Feb 16, 2013
1 parent 57f3631 commit 27f591474eebff99a156b9fc89cb9b344d518235
Showing with 58 additions and 10 deletions.
  1. +24 −3 build/framer.js
  2. +10 −4 src/animation.coffee
  3. +24 −3 template/framer.js
View
@@ -974,6 +974,17 @@ require.define("/src/views/view.coffee",function(require,module,exports,__dirnam
}
});
View.define("rotateX", {
get: function() {
return this._rotateX || 0;
},
set: function(value) {
this._rotateX = value;
this.style["opacity"] = value;
return this.emit("change:opacity");
}
});
View.prototype.removeFromSuperview = function() {
return this.superView = null;
};
@@ -2949,6 +2960,7 @@ require.define("/src/animation.coffee",function(require,module,exports,__dirname
}
this.modifiers = args.modifiers || {};
this.endProperties = args.properties;
this.originalProperties = this.view.properties;
}
Animation.prototype.start = function(callback) {
@@ -3052,9 +3064,18 @@ require.define("/src/animation.coffee",function(require,module,exports,__dirname
return _results;
};
Animation.prototype.pause = function() {};
Animation.prototype.revert = function() {};
Animation.prototype.reverse = function() {
var options, p, _i, _len;
options = {
view: this.view,
properties: this.originalProperties
};
for (_i = 0, _len = PROPERTIES.length; _i < _len; _i++) {
p = PROPERTIES[_i];
options[p] = this[p];
}
return new Animation(options);
};
return Animation;
View
@@ -28,6 +28,7 @@ class exports.Animation extends EventEmitter
@modifiers = args.modifiers or {}
@endProperties = args.properties
@originalProperties = @view.properties
start: (callback) =>
@@ -142,8 +143,13 @@ class exports.Animation extends EventEmitter
for k, v of properties
if k in ["rotation", "opacity", "scale", "x", "y", "z", "width", "height"]
@view[k] = properties[k]
pause: ->
revert: ->
reverse: ->
options =
view: @view
properties: @originalProperties
for p in PROPERTIES
options[p] = @[p]
return new Animation options
View
@@ -974,6 +974,17 @@ require.define("/src/views/view.coffee",function(require,module,exports,__dirnam
}
});
View.define("rotateX", {
get: function() {
return this._rotateX || 0;
},
set: function(value) {
this._rotateX = value;
this.style["opacity"] = value;
return this.emit("change:opacity");
}
});
View.prototype.removeFromSuperview = function() {
return this.superView = null;
};
@@ -2949,6 +2960,7 @@ require.define("/src/animation.coffee",function(require,module,exports,__dirname
}
this.modifiers = args.modifiers || {};
this.endProperties = args.properties;
this.originalProperties = this.view.properties;
}
Animation.prototype.start = function(callback) {
@@ -3052,9 +3064,18 @@ require.define("/src/animation.coffee",function(require,module,exports,__dirname
return _results;
};
Animation.prototype.pause = function() {};
Animation.prototype.revert = function() {};
Animation.prototype.reverse = function() {
var options, p, _i, _len;
options = {
view: this.view,
properties: this.originalProperties
};
for (_i = 0, _len = PROPERTIES.length; _i < _len; _i++) {
p = PROPERTIES[_i];
options[p] = this[p];
}
return new Animation(options);
};
return Animation;

0 comments on commit 27f5914

Please sign in to comment.