I know it's possible to create custom animatable properties in Core Animation, but what about in OS X 10.8's SceneKit framework? SCNAnimatable
doesn't seem to expose the same APIs that CALayer
does for making properties animatable.
In my application, I've got a SCNNode
subclass called Starfield
, which I've ported from an old OpenGL application by using a SCNNodeRendererDelegate
. Starfields expose a GLfloat
property called warpFactor
:
@interface Starfield : SCNNode<SCNNodeRendererDelegate> {
// other stuff that's not really important for this question
GLfloat warpFactor;
}
@property(nonatomic) GLfloat warpFactor;
@end
But when I try to add an animation to it, like so:
CABasicAnimation *warp = [CABasicAnimation animationWithKeyPath:@"warpFactor"];
warp.toValue = @1.0;
warp.duration = 5.0;
[starfield addAnimation:warp forKey:@"warp"];
I get the following in the console:
[SCNKit ERROR] warpFactor is not an animatable path (from <unnamed SCNNode 0x1016473c0, no children>)
I know SceneKit is brand new, but does anyone happen to know how to make this work?
A workaround/hack:
presentationNode
)This solution is ugly, but it allows you to synchronize the animation of the custom property with other animations via SCNTransaction or CAAnimationGroup
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With