开发者社区 问答 正文

twitter IOS 客户端登录界面是如何实现的

在网上搜索半天无果,后面背景图片放大的动画是如何实现,请路过的大神提点,最好附上demo。

展开
收起
a123456678 2016-07-20 15:17:57 2659 分享 版权
1 条回答
写回答
取消 提交回答
  • 大概看了一下Twitter的动画,动画主要有一下几个步骤:

    渐出
    放大
    渐隐
    使用CoreAnimation很容易就能实现,下面是一些示例代码。

    放大:

    CABasicAnimation* zoom = [CABasicAnimationanimationWithKeyPath:@"transform.scale"];
    zoom.toValue = [NSNumber numberWithDouble:1.1];
    zoom.duration = 1.5;
    zoom.delegate = self;
    [bgImageView.layer addAnimation:zoom forKey:@"zoom"];
    渐出:

    CABasicAnimation *fadein = [CABasicAnimation animationWithKeyPath:@"opacity"];
    fadein.toValue:[NSNumber numberWithFloat:1];
    fadein.duration:.5;
    fadein.fillMode = kCAFillModeForwards;
    fadein.removedOnCompletion = NO;
    [bgImageView.layer addAnimation:fadein forKey:@"alpha"];
    需要注意:

    图片素材如果不够大放大的时候可能会模糊

    2019-07-17 19:58:55
    赞同 展开评论