任何人都知道为什么我不能让这个简单的动画工作?它只是不玩。
self.scene = [SCNScene scene];
SCNNode *sun = [SCNNode nodeWithGeometry:[SCNSphere sphereWithRadius:5.0]];
SCNNode *moon = [SCNNode nodeWithGeometry:[SCNSphere sphereWithRadius:2.0]];
moon.position = SCNVector3Make(7.0, 7.0, 7.0);
moon.pivot = CATransform3DMakeTranslation(-7.0, -7.0, -7.0);
CABasicAnimation *startAnim = [CABasicAnimation animationWithKeyPath:@"rotation"];
startAnim.duration = 5;
startAnim.repeatCount = MAXFLOAT;
startAnim.toValue =[NSValue valueWithSCNVector4:SCNVector4Make(0.0, 0.0, 0.0,1.0)];
startAnim.timingFunction =[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
[moon addAnimation:startAnim forKey:@"rotate"];
[sun addChildNode:moon];
[[self.scene rootNode] addChildNode:sun];
我认为问题是...
startAnim.toValue =[NSValue valueWithSCNVector4:SCNVector4Make(0.0, 0.0, 0.0,1.0)];
干杯