简体   繁体   English

如何在iOS中实现此动画?

[英]how to implement this animation in iOS?

I am not sure about how to present this question because I don't know the animation term that I should use. 我不确定如何提出这个问题,因为我不知道应该使用动画术语。

I need to know about this tree presentation animation. 我需要了解这个树演示动画。 As it is appearing form root to top. 从根到顶部出现。

Please take a look on attached .gif file and let me know if anyone know about this animation or if you can guide me with example. 请查看附加的.gif文件,并让我知道是否有人对此动画有所了解,或者是否可以通过示例指导我。

I will really appreciate. 我会很感激。

Thanks for your time. 谢谢你的时间。

在此处输入图片说明

The best option for you is to split up the gif into multiple images and then do the following: 最好的选择是将gif分成多个图像,然后执行以下操作:

NSArray *gifImagesArray = [NSArray arrayWithObjects:imageOne, imageTwo, imageThree, nil];
imageView.animationImages      = animateImagesArray;
imageView.animationRepeatCount = 1;
imageView.animationDuration    = 1.0f;
[imageView startAnimating];

Edit following comments: 编辑以下评论:

If you can't use multiple images you have to write the animation yourself. 如果不能使用多个图像,则必须自己编写动画。

One suggestion is to add a circular mask to the UIImage and animate it's removal. 一种建议是向UIImage添加圆形蒙版,并对其进行动画处理。 This link explains how to draw a circular CALayer: Circular Progress Bars in IOS 此链接说明了如何绘制圆形CALayer: IOS中的圆形进度条

This one here will show you how to create a mask on a UIImage: Simply mask a UIView with a rectangle 这里的这一节将向您展示如何在UIImage上创建蒙版: 只需用矩形蒙版UIView

now all you have to do is a simple animation. 现在您要做的只是一个简单的动画。

I have a solution that will work for this problem. 我有一个解决此问题的方法。 We can use gif image and convert it into UIImage object. 我们可以使用gif图像并将其转换为UIImage对象。 So image object will work same as animation. 因此,图像对象将与动画相同。

Thanks all for your answers. 谢谢大家的回答。

In my opinion, I will separate this animation to 4 parts: 我认为该动画分为四个部分:

  1. animation to show full black tree from center. 动画从中心显示全黑树。
  2. animation to show Texts 显示文字的动画
  3. animation to show blue leafs. 动画以显示蓝色的树叶。
  4. animation to show 2 buttons at bottom. 动画以在底部显示2个按钮。

You can use this framework https://github.com/facebook/pop to operate all animations step by step or even Core Animation. 您可以使用此框架https://github.com/facebook/pop逐步操作所有动画,甚至可以操作Core Animation。 Please do more research... I think you will success to make one. 请做更多的研究...我想你会成功的。

You can achieve this animation using simple UIImageView, that can load multiple images using animationImages property of UIImageView. 您可以使用简单的UIImageView实现此动画,该UIImageView可以使用UIImageView的animationImages属性加载多个图像。

First, create one NSMutablerArray of images. 首先,创建一个NSMutablerArray图片。 then asssign that images to imageView, and animationDuration for that images. 然后将该图像分配给imageView和该图像的animationDuration。

UIImageView *animationImageView = [[UIImageView alloc]  initWithFrame:CGRectMake(60, 95, 86, 193)];
animationImageView.animationImages = images;
animationImageView.animationDuration = 0.5;

add the imageview to view. 添加imageview进行查看。

[self.view addSubview:animationImageView];
[animationImageView startAnimating];

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM