我正在尝试在 spritekit 中使用涟漪效应。在这里,我为波纹编写了代码
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
CATransition *animation=[CATransition animation];
[animation setDelegate:self];
[animation setDuration:1.75];
[animation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]];
[animation setType:@"rippleEffect"];
[animation setFillMode:kCAFillModeRemoved];
animation.endProgress=0.99;
[animation setRemovedOnCompletion:YES];
[self.view.layer addAnimation:animation forKey:nil];
}
当我触摸屏幕上的任何地方时,通过使用此代码会产生一波波纹。但我想专门在一个节点上产生涟漪效应。就像屏幕上的触摸点周围有 10 个半径的圆圈。
请帮忙。提前致谢。