This is my very humble change/contribution to the 12th step of the
project. Just an very simple change to add a bit more of fun to the JS
based animations in the phone-detail view.
The leaving picture could move up or left and the coming picture could move
down or right, or just the other way around.
Comments/suggestions are welcome, :)
var phonecatAnimations = angular.module('phonecatAnimations',
['ngAnimate']);
phonecatAnimations.animation('.phone', [function() {
//The object appears/leaves from/to Up or Left
var animateRandomUpOrLeft = function(element, className, done) {
if(className != 'active') {
return;
}
var randomValue = Math.floor((Math.random()*10)+1);
//up
if(randomValue%2==0){
element.css({
position: 'absolute',
top: -500,
left: 0,
display: 'block'
});
jQuery(element).animate({
top: 0
}, done);
//left
}else{
element.css({
position: 'absolute',
top: 0,
left: -500,
display: 'block'
});
jQuery(element).animate({
left: 0
}, done);
}
return function(cancel) {
if(cancel) {
element.stop();
}
};
}
//The object appears/leaves from/to Down or Right
var animateRandomDownOrRight = function(element, className, done) {
if(className != 'active') {
return;
}
var randomValue = Math.floor((Math.random()*10)+1);
//down
if(randomValue%2==0){
element.css({
position: 'absolute',
left: 0,
top: 0
});
jQuery(element).animate({
top: 500
}, done);
//right
}else{
element.css({
position: 'absolute',
left: 0,
top: 0
});
jQuery(element).animate({
left: 500
}, done);
}
return function(cancel) {
if(cancel) {
element.stop();
}
};
}
return {
addClass: animateRandomUpOrLeft,
removeClass: animateRandomDownOrRight
};
}]);
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.