【发布时间】:2014-02-04 12:43:23
【问题描述】:
我得到了 int SpriteKit。并且想知道如何在 SKNode 对象上创建运动效果。
对于 UIView,我使用以下方法:
+(void)registerEffectForView:(UIView *)aView
depth:(CGFloat)depth
{
UIInterpolatingMotionEffect *effectX;
UIInterpolatingMotionEffect *effectY;
effectX = [[UIInterpolatingMotionEffect alloc] initWithKeyPath:@"center.x"
type:UIInterpolatingMotionEffectTypeTiltAlongHorizontalAxis];
effectY = [[UIInterpolatingMotionEffect alloc] initWithKeyPath:@"center.y"
type:UIInterpolatingMotionEffectTypeTiltAlongVerticalAxis];
effectX.maximumRelativeValue = @(depth);
effectX.minimumRelativeValue = @(-depth);
effectY.maximumRelativeValue = @(depth);
effectY.minimumRelativeValue = @(-depth);
[aView addMotionEffect:effectX];
[aView addMotionEffect:effectY];
}
我还没有找到任何与 SKNode 类似的东西。所以我的问题是有可能吗?如果没有,那么我该如何实现它。
【问题讨论】:
标签: ios sprite-kit motion-detection sknode