Dra*_*kic 3 animation morphing ios
我在Facebook Paper应用程序中看到了这个动画/变形,当你点击它时,它们会将菜单按钮变形为X,然后返回X. 我记录它是因为我不知道如何以任何其他方式显示它.
https://www.youtube.com/watch?v=y6j_mVgv-NM
有人可以向我解释这是如何完成的吗?我想为我的应用程序.
那太棒了,之前没见过.
创建了一个快速的要点:
https://gist.github.com/mnmaraes/9458421
编辑:所以它不仅仅是一个链接,关键概念是两种方法:
-(void)morphToX
{
CGFloat angle = M_PI_4;
CGPoint center = CGPointMake(120., 120.);
__weak TUIViewController *weakSelf = self;
[UIView animateWithDuration:0.8 delay:0.0 usingSpringWithDamping:0.6 initialSpringVelocity:2.0 options:UIViewAnimationOptionCurveEaseOut animations:^{
TUIViewController *strongSelf = weakSelf;
strongSelf.topLineView.transform = CGAffineTransformMakeRotation(-angle*5);
strongSelf.topLineView.center = center;
strongSelf.bottomLineView.transform = CGAffineTransformMakeRotation(angle*5);
strongSelf.bottomLineView.center = center;
strongSelf.centerLineView.transform = CGAffineTransformMakeScale(0., 1.0);
} completion:^(BOOL finished) {
}];
}
Run Code Online (Sandbox Code Playgroud)
和:
-(void)morphToLine
{
__weak TUIViewController *weakSelf = self;
[UIView animateWithDuration:0.8 delay:0.0 usingSpringWithDamping:0.6 initialSpringVelocity:2.0 options:UIViewAnimationOptionCurveEaseOut animations:^{
TUIViewController *strongSelf = weakSelf;
strongSelf.topLineView.transform = CGAffineTransformIdentity;
strongSelf.topLineView.center = CGPointMake(120., 2.);
strongSelf.bottomLineView.transform = CGAffineTransformIdentity;
strongSelf.bottomLineView.center = CGPointMake(120., 238.);
strongSelf.centerLineView.transform = CGAffineTransformIdentity;
} completion:^(BOOL finished) {
}];
}
Run Code Online (Sandbox Code Playgroud)
第一个从平行线动画到X,第二个从X到线.玩动画的数字和选项应该给你不同的感觉.
玩得开心!
| 归档时间: |
|
| 查看次数: |
2388 次 |
| 最近记录: |