Mat*_*oal 3 core-animation core-image calayer ios
我想使用过滤器添加过滤器CABasicAnimation.我想为这个过滤器的一些属性设置动画.我从文档中读到该filters属性是可动画的,但在相同的文档中,似乎很难找到一种方法来做到这一点!
那么,我如何使用animationWithKeyPath从CABasicAnimation引用单个过滤器属性?
[CABasicAnimation animationWithKeyPath:@"filters._FILTER_._PROPERTY_"];
Run Code Online (Sandbox Code Playgroud)
这是一个完整的例子,只是为了告诉你我是如何让它工作的:
//Define the filter
CIFilter *filterOne = [CIFilter filterWithName:@"CISepiaTone"];
[filterOne setDefaults];
//Attach it to the Layer
self.layer.filters = [NSArray arrayWithObject:filterOne];
//HERE THE PROBLEM ---------------------------------------
CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"filters.???????.inputIntensity"];
//EOF HERE THE PROBLEM -----------------------------------
//Define the Animation settings
animation.delegate = self;
animation.fromValue = [NSNumber numberWithInt:0];
animation.toValue = [NSNumber numberWithInt:1];
animation.duration = 0.3;
...etcetc...
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2388 次 |
| 最近记录: |