ios动画图像从一个圆圈内扩展

时间:2015-09-07 07:51:48

标签: ios animation

我的应用中有一个页面,其中有一个用户的个人资料图片在一个圆圈中,就像它在Twitter个人资料页面中一样。

我必须添加一项功能,以便在点击它时,图像应该展开。需要添加动画,以便从较小圆圈的中心缓慢显示新的较大圆圈并到达屏幕中心。

关于如何实施这一点的任何想法?

3 个答案:

答案 0 :(得分:0)

尝试UIView Animation阻止更改更大圆的位置,大小,alpha和角半径(如果需要)。

将较大的圆圈(最初较小的尺寸)放在较小的圆圈顶部并隐藏它。然后在动画之前,使用像这样的块取消隐藏和动画:

[UIView animateWithDuration:1.0 animations:^{
        // set bigger circle destination position i.e. centre of screen
        // set bigger circle final size
        // set other properties like alpha, corner radius etc
    } completion:nil];

答案 1 :(得分:0)

使用CATransform3DScale转换和UIView Animation

CATransform3D avatarTransform = CATransform3DIdentity;
avatarTransform = CATransform3DScale(avatarTransform, avatarScaleFactor,avatarScaleFactor, 0);


[UIView animateWithDuration:1.0 animations:^{
    //Change the frame to reach the center of screen
    self.avatar.layer.transform = headerTransform
} completion:nil]

答案 2 :(得分:0)

您可以简单地使用CGAffineTransformScale并在UIView的animateWithDuration块中缩放ImageView。

imgV.transform = CGAffineTransformScale(CGAffineTransformIdentity, 0.0, 0.0);

[UIView animateWithDuration:0.5 delay:0 options:UIViewAnimationOptionCurveEaseInOut
                 animations:^{
                     imgV.transform = CGAffineTransformScale(CGAffineTransformIdentity, 1.0, 1.0);

                 }
                 completion:^(BOOL finished) {
                    NSLog(@"done");
                 }];

如需进一步参考,您可以查看以下Stackoverflow问题:

  1. Animate a UIImageView
  2. iOS View Transform Animation
相关问题