Skip to content

Commit

Permalink
Adding Animation.reverse()
Browse files Browse the repository at this point in the history
  • Loading branch information
Koen Bok committed Feb 16, 2013
1 parent 57f3631 commit 27f5914
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 10 deletions.
27 changes: 24 additions & 3 deletions build/framer.js
Expand Up @@ -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() { View.prototype.removeFromSuperview = function() {
return this.superView = null; return this.superView = null;
}; };
Expand Down Expand Up @@ -2949,6 +2960,7 @@ require.define("/src/animation.coffee",function(require,module,exports,__dirname
} }
this.modifiers = args.modifiers || {}; this.modifiers = args.modifiers || {};
this.endProperties = args.properties; this.endProperties = args.properties;
this.originalProperties = this.view.properties;
} }


Animation.prototype.start = function(callback) { Animation.prototype.start = function(callback) {
Expand Down Expand Up @@ -3052,9 +3064,18 @@ require.define("/src/animation.coffee",function(require,module,exports,__dirname
return _results; return _results;
}; };


Animation.prototype.pause = function() {}; Animation.prototype.reverse = function() {

var options, p, _i, _len;
Animation.prototype.revert = function() {}; 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; return Animation;


Expand Down
14 changes: 10 additions & 4 deletions src/animation.coffee
Expand Up @@ -28,6 +28,7 @@ class exports.Animation extends EventEmitter


@modifiers = args.modifiers or {} @modifiers = args.modifiers or {}
@endProperties = args.properties @endProperties = args.properties
@originalProperties = @view.properties


start: (callback) => start: (callback) =>


Expand Down Expand Up @@ -142,8 +143,13 @@ class exports.Animation extends EventEmitter
for k, v of properties for k, v of properties
if k in ["rotation", "opacity", "scale", "x", "y", "z", "width", "height"] if k in ["rotation", "opacity", "scale", "x", "y", "z", "width", "height"]
@view[k] = properties[k] @view[k] = properties[k]


pause: ->


revert: -> reverse: ->
options =
view: @view
properties: @originalProperties

for p in PROPERTIES
options[p] = @[p]

return new Animation options
27 changes: 24 additions & 3 deletions template/framer.js
Expand Up @@ -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() { View.prototype.removeFromSuperview = function() {
return this.superView = null; return this.superView = null;
}; };
Expand Down Expand Up @@ -2949,6 +2960,7 @@ require.define("/src/animation.coffee",function(require,module,exports,__dirname
} }
this.modifiers = args.modifiers || {}; this.modifiers = args.modifiers || {};
this.endProperties = args.properties; this.endProperties = args.properties;
this.originalProperties = this.view.properties;
} }


Animation.prototype.start = function(callback) { Animation.prototype.start = function(callback) {
Expand Down Expand Up @@ -3052,9 +3064,18 @@ require.define("/src/animation.coffee",function(require,module,exports,__dirname
return _results; return _results;
}; };


Animation.prototype.pause = function() {}; Animation.prototype.reverse = function() {

var options, p, _i, _len;
Animation.prototype.revert = function() {}; 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; return Animation;


Expand Down

0 comments on commit 27f5914

Please sign in to comment.