简体   繁体   English

UIView表面自定义转换/动画(如'水滴效果')

[英]UIView surface custom transformation/animation (like 'a water drop effect')

What is the way to implement custom transformation (+ animation) on a view surface (similar to the images attached) ( not just the view bounds ). 什么是执行上观看表面 (类似于附图片) 自定义转换 (+动画)( 不仅仅是 视图边界 )的方式。

The question is mainly in what is the general way to do that (not exactly the 'water drop effect', but any examples would be appreciated for sure). 问题主要在于通常的方法是什么(不完全是“水滴效应”,但任何例子肯定会受到赞赏)。 I guess, that's some 'algorythmic' transformation of the layer layout 'grid', but not sure which way to 'dig' that in. 我想,这是层布局'网格'的一些'algorythmic'转换,但不确定以哪种方式“挖掘”它。

(Another thought is that might be achieved with using some frameworks, however, I would still need to understand the core logic). (另一个想法是可能通过使用一些框架来实现,但是,我仍然需要理解核心逻辑)。

UPDATE: 更新:

Pretty good resource for animations lovers recently been found from one of the answers: iPhone Development Wiki . 最近从其中一个答案中找到了动画爱好者非常好的资源: iPhone开发维基

转化样本1转化样本2

Read this excellent blog post by Bartosz Ciechanowski: 阅读Bartosz Ciechanowski撰写的这篇优秀博客文章:

http://ciechanowski.me/blog/2014/05/14/mesh-transforms/ http://ciechanowski.me/blog/2014/05/14/mesh-transforms/

To wrap it up: Apple does this with private API around a class called 'CAMeshTransform'. 总结一下:Apple使用名为“CAMeshTransform”的类围绕私有API执行此操作。

The author proposes an self-written substitute: 作者提出了一个自编的替代品:

https://github.com/Ciechan/BCMeshTransformView https://github.com/Ciechan/BCMeshTransformView

It's pretty amazing actually! 实际上这真是太神奇了!

You can use this: 你可以用这个:

- (void)drawWaterRippleAnimation {
    UIView *view = [[UIView alloc] initWithFrame:CGRectMake(200, 200, 100, 100)];
    view.backgroundColor = [UIColor blueColor];

    CATransition *animation=[CATransition animation];
    [animation setDelegate:self];
    [animation setDuration:1.75];
    [animation setTimingFunction:UIViewAnimationCurveEaseInOut];
    [animation setType:@"rippleEffect"];

    [animation setFillMode:kCAFillModeRemoved];
    animation.endProgress=1;
    [animation setRemovedOnCompletion:NO];
    [self.view.layer addAnimation:animation forKey:nil];
}

Credits goes to here . 积分去了这里

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

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