Created
May 14, 2014 10:48
-
-
Save Gaia-Murata/050197883653eb728039 to your computer and use it in GitHub Desktop.
SpringAnimation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
POPBasicAnimation *anim = [POPBasicAnimation animationWithPropertyNamed:kPOPViewAlpha]; | |
anim.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; | |
anim.duration = 3.0f; | |
anim.fromValue = @(0.0); | |
anim.toValue = @(1.0); | |
[_basicSampleView pop_addAnimation:anim forKey:@"fade"]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
POPAnimatableProperty *countProperty = [POPAnimatableProperty propertyWithName:@"countUp" initializer:^(POPMutableAnimatableProperty *prop){ | |
prop.readBlock = ^(UILabel *label, CGFloat values[]) { | |
//どの値を利用するか | |
values[0] = [label.text intValue]; | |
}; | |
prop.writeBlock = ^(UILabel *label, const CGFloat values[]) { | |
//変更した値をどこに更新するか | |
label.text = [[NSString alloc] initWithFormat:@"%d", (int)values[0]]; | |
}; | |
}]; | |
POPBasicAnimation *countAnimation = [POPBasicAnimation new]; | |
//自作プロパティをセット | |
countAnimation.property = countProperty; | |
countAnimation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; | |
countAnimation.duration = 10.0f; | |
countAnimation.fromValue = @(100); | |
countAnimation.toValue = @(2000); | |
[_countLabel pop_addAnimation:countAnimation forKey:@"constantAnimation"]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
POPDecayAnimation *animX = [POPDecayAnimation animationWithPropertyNamed:kPOPLayerPositionX]; | |
animX.velocity = @(100.0f); | |
[_decaySampleView.layer pop_addAnimation:animX forKey:@"slideX"]; | |
POPDecayAnimation *animY = [POPDecayAnimation animationWithPropertyNamed:kPOPLayerPositionY]; | |
animY.velocity = @(100.0f); | |
[_decaySampleView.layer pop_addAnimation:animY forKey:@"slideY"]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
_sampleView.springBounciness = 24.0f; | |
_sampleView.springSpeed = 5.0f; | |
_sampleView.spring.bounds= CGRectMake(0, 0, 200, 200); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[NSObject animate:^{ | |
_mcAnimateSampleView.springBounciness = 24.0f; | |
_mcAnimateSampleView.springSpeed = 10.0f; | |
_mcAnimateSampleView.spring.pop_scaleXY = CGPointMake(2.f, 2.f); | |
} completion:^(BOOL finished) { | |
//ScaleAnimation実行後にX軸で回転を加える | |
_mcAnimateSampleView.layer.pop_duration = 4; | |
_mcAnimateSampleView.layer.easeInEaseOut.pop_rotationX = 60.0f; | |
}]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
POPSpringAnimation *anim = [POPSpringAnimation animationWithPropertyNamed:kPOPLayerBounds]; | |
anim.toValue = [NSValue valueWithCGRect:CGRectMake(0, 0, 200, 200)]; | |
anim.springSpeed = 5.0f; | |
anim.springBounciness = 24.0f; | |
[_sampleView pop_addAnimation:anim forKey:@"size"]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
POPSpringAnimation *anim = [POPSpringAnimation animationWithPropertyNamed:kPOPLayerBounds]; | |
anim.toValue = [NSValue valueWithCGRect:CGRectMake(0, 0, 200, 200)]; | |
anim.springSpeed = 5.0f; | |
anim.springBounciness = 24.0f; | |
[_sampleView pop_addAnimation:anim forKey:@"size"]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment