-
Notifications
You must be signed in to change notification settings - Fork 97
Home
#pragma mark The 5 Steps To Adding An Animation
#pragma mark 1 Pick Kind of Animation
// POPBasicAnimation
// POPSpringAnimation
// POPDecayAnimation
/* POPBasicAnimation *basicAniamtion = [POPBasicAnimation animation]; basicAniamtion.duration=3; */
/*
POPSpringAnimation *springAnimation = [POPSpringAnimation animation]; springAnimation.velocity=@(1000); // change of value units per second springAnimation.springBounciness=14; // value between 0-20 default at 4 springAnimation.springSpeed=3; // value between 0-20 default at 4
*/
/*
POPDecayAnimation *decayAnimation=[POPDecayAnimation animation]; decayAnimation.velocity=@(233); //change of value units per second decayAnimation.deceleration=.833; //range of 0 to 1 */
#pragma mark 2 Animatable View properties
// Alpha - kPOPViewAlpha
// Color - kPOPViewBackgroundColor
// Size - kPOPViewBounds
// Center - kPOPViewCenter
// Location & Size - kPOPViewFrame
// Size - kPOPViewScaleXY
// Size(Scale) - kPOPViewSize
/* POPBasicAnimation*basicAniamtion = [POPBasicAnimation animation]; basicAniamtion.property = [POPAnimatableProperty propertyWithName:kPOPViewAlpha]; basicAniamtion.toValue= @(0); [self.view1 pop_addAnimation:basicAniamtion forKey:@"WhatEverNameYouWant"]; */
// kPOPViewBackgroundColor color /* POPBasicAnimation*basicAniamtion = [POPBasicAnimation animation]; basicAniamtion.property = [POPAnimatableProperty propertyWithName:kPOPViewBackgroundColor]; basicAniamtion.toValue= [UIColor redColor]; [self.view1 pop_addAnimation:basicAniamtion forKey:@"WhatEverNameYouWant"]; */
// kPOPViewBounds Size /* POPBasicAnimation*basicAniamtion = [POPBasicAnimation animation]; basicAniamtion.property = [POPAnimatableProperty propertyWithName:kPOPViewBounds]; basicAniamtion.toValue=[NSValue valueWithCGRect:CGRectMake(0, 0, 90, 190)]; //first 2 values dont matter [self.view1 pop_addAnimation:basicAniamtion forKey:@"WhatEverNameYouWant"]; */
// kPOPViewCenter Center /* POPBasicAnimation*basicAniamtion = [POPBasicAnimation animation]; basicAniamtion.property = [POPAnimatableProperty propertyWithName:kPOPViewCenter]; basicAniamtion.toValue=[NSValue valueWithCGPoint:CGPointMake(200, 200)];
[self.view1 pop_addAnimation:basicAniamtion forKey:@"WhatEverNameYouWant"];
*/
// kPOPViewFrame Frame - Location & Size /* POPBasicAnimation*basicAniamtion = [POPBasicAnimation animation]; basicAniamtion.property = [POPAnimatableProperty propertyWithName:kPOPViewFrame]; basicAniamtion.toValue=[NSValue valueWithCGRect:CGRectMake(140, 140, 140, 140)]; [self.view1 pop_addAnimation:basicAniamtion forKey:@"WhatEverNameYouWant"]; */
// kPOPViewBackgroundColor Size - scale /* POPBasicAnimation*basicAniamtion = [POPBasicAnimation animation]; basicAniamtion.property = [POPAnimatableProperty propertyWithName:kPOPViewScaleXY]; basicAniamtion.toValue=[NSValue valueWithCGSize:CGSizeMake(3, 2)]; [self.view1 pop_addAnimation:basicAniamtion forKey:@"WhatEverNameYouWant"]; */
// kPOPViewBackgroundColor Size /* POPBasicAnimation*basicAniamtion = [POPBasicAnimation animation]; basicAniamtion.property = [POPAnimatableProperty propertyWithName:kPOPViewSize]; basicAniamtion.toValue=[NSValue valueWithCGSize:CGSizeMake(30, 200)]; [self.view1 pop_addAnimation:basicAniamtion forKey:@"WhatEverNameYouWant"]; */
#pragma mark 2 Layer Property Changes
// Color - kPOPLayerBackgroundColor
// Size - kPOPLayerBounds
// Size - kPOPLayerScaleXY
// Size - kPOPLayerSize
// Opacity - kPOPLayerOpacity
// Position - kPOPLayerPosition
// X Position - kPOPLayerPositionX
// Y Position - kPOPLayerPositionY
// Rotation - kPOPLayerRotation
// Color - kPOPLayerBackgroundColor
/* POPSpringAnimation*basicAniamtion = [POPSpringAnimation animation]; basicAniamtion.property = [POPAnimatableProperty propertyWithName: kPOPLayerBackgroundColor]; basicAniamtion.toValue= [UIColor redColor]; [self.view1.layer pop_addAnimation:basicAniamtion forKey:@"WhatEverNameYouWant"]; */
// kPOPLayerBounds Size /* POPSpringAnimation*basicAniamtion = [POPSpringAnimation animation]; basicAniamtion.property = [POPAnimatableProperty propertyWithName: kPOPLayerBounds]; basicAniamtion.toValue= [NSValue valueWithCGRect:CGRectMake(0, 0, 90, 90)]; //first 2 values dont matter [self.view1.layer pop_addAnimation:basicAniamtion forKey:@"WhatEverNameYouWant"]; */
// POPLayerScaleXY Size /* POPBasicAnimation*basicAniamtion = [POPBasicAnimation animation]; basicAniamtion.property = [POPAnimatableProperty propertyWithName: kPOPLayerScaleXY]; basicAniamtion.toValue= [NSValue valueWithCGSize:CGSizeMake(2, 1)];//increases width and height scales [self.view1.layer pop_addAnimation:basicAniamtion forKey:@"WhatEverNameYouWant"];
*/
// kPOPLayerSize Size /* POPBasicAnimation*basicAniamtion = [POPBasicAnimation animation]; basicAniamtion.property = [POPAnimatableProperty propertyWithName:kPOPLayerSize]; basicAniamtion.toValue= [NSValue valueWithCGSize:CGSizeMake(200, 200)]; [self.view1.layer pop_addAnimation:basicAniamtion forKey:@"WhatEverNameYouWant"];
*/
// kPOPLayerPositionX Opacity /* POPSpringAnimation*basicAniamtion = [POPSpringAnimation animation]; basicAniamtion.property = [POPAnimatableProperty propertyWithName: kPOPLayerOpacity]; basicAniamtion.toValue = @(0); [self.view1.layer pop_addAnimation:basicAniamtion forKey:@"WhatEverNameYouWant"];
*/
// kPOPLayerPosition Position /* POPSpringAnimation*basicAniamtion = [POPSpringAnimation animation]; basicAniamtion.property = [POPAnimatableProperty propertyWithName: kPOPLayerPosition]; basicAniamtion.toValue= [NSValue valueWithCGRect:CGRectMake(130, 130, 0, 0)];//last 2 values dont matter [self.view1.layer pop_addAnimation:basicAniamtion forKey:@"WhatEverNameYouWant"]; */
// kPOPLayerPositionX X Position /* POPSpringAnimation*basicAniamtion = [POPSpringAnimation animation]; basicAniamtion.property = [POPAnimatableProperty propertyWithName: kPOPLayerPositionX]; basicAniamtion.toValue= @(240); [self.view1.layer pop_addAnimation:basicAniamtion forKey:@"WhatEverNameYouWant"]; */
// kPOPLayerPositionX Y Position /* POPSpringAnimation *anim = [POPSpringAnimation animation]; anim.property=[POPAnimatableProperty propertyWithName:kPOPLayerPositionY]; anim.toValue = @(320); [self.view1 pop_addAnimation:anim forKey:@"WhatEverNameYouWant"];
*/
// kPOPLayerRotation Rotation /* POPSpringAnimation*basicAniamtion = [POPSpringAnimation animation]; basicAniamtion.property = [POPAnimatableProperty propertyWithName: kPOPLayerRotation]; basicAniamtion.toValue= @(M_PI/4); //2 M_PI is an entire rotation [self.view1.layer pop_addAnimation:basicAniamtion forKey:@"WhatEverNameYouWant"];
*/
#pragma mark 3 Figure out which way to set values
// anim.toValue = @(1.0);
// anim.toValue = [NSValue valueWithCGRect:CGRectMake(0, 0, 400, 400)];
// anim.toValue = [NSValue valueWithCGSize:CGSizeMake(40, 40)];
#pragma mark 4. Create Name For Animation
// basicAniamtion.name=@"hiiidd";
#pragma mark 5. Create Name For Animation. Add animation to View or Layer, we picked View so self.tableView and not layer which would have been self.tableView.layer
//[self.tableView pop_addAnimation:basicAniamtion forKey:@"WhatEverNameYouWant"];