Skip to content

Instantly share code, notes, and snippets.

@skypanther
Created March 7, 2014 16:58
Show Gist options
  • Save skypanther/08a0334f674afb394445 to your computer and use it in GitHub Desktop.
Save skypanther/08a0334f674afb394445 to your computer and use it in GitHub Desktop.
exports.rotateIn = function(view, _speed) {
var speed = _speed || 300,
t = Ti.UI.create2DMatrix();
t = t.rotate(0);
var a = Titanium.UI.createAnimation({
curve : Ti.UI.ANIMATION_CURVE_EASE_IN,
opacity: 0.85
});
a.transform = t;
a.duration = speed;
// set new anchorPoint on animation for Android
a.anchorPoint = {x:0, y:0};
// set new anchorPoint on view for iOS
view.anchorPoint = {x:0, y:0};
view.animate(a);
};
exports.rotateOut = function(view, _speed) {
var speed = _speed || 400,
t = Ti.UI.create2DMatrix();
t = t.rotate(90);
var a = Titanium.UI.createAnimation({
curve : Ti.UI.ANIMATION_CURVE_EASE_OUT,
opacity: 0
});
a.transform = t;
a.duration = speed;
// set new anchorPoint on animation for Android
a.anchorPoint = {x:0, y:0};
// set new anchorPoint on view for iOS
view.anchorPoint = {x:0, y:0};
view.animate(a);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment