Share via


SCNGeometry.AddAnimation 方法

定义

重载

AddAnimation(CAAnimation, NSString)

添加由指定键编制索引的指定动画。

AddAnimation(SCNAnimationPlayer, NSString)

AddAnimation(CAAnimation, NSString)

添加由指定键编制索引的指定动画。

[Foundation.Export("addAnimation:forKey:")]
[ObjCRuntime.Introduced(ObjCRuntime.PlatformName.WatchOS, 3, 0, ObjCRuntime.PlatformArchitecture.All, null)]
[ObjCRuntime.Introduced(ObjCRuntime.PlatformName.iOS, 8, 0, ObjCRuntime.PlatformArchitecture.All, null)]
[ObjCRuntime.Unavailable(ObjCRuntime.PlatformName.WatchOS, ObjCRuntime.PlatformArchitecture.All, null)]
public virtual void AddAnimation (CoreAnimation.CAAnimation animation, Foundation.NSString key);
[Foundation.Export("addAnimation:forKey:")]
[ObjCRuntime.Introduced(ObjCRuntime.PlatformName.WatchOS, 3, 0, ObjCRuntime.PlatformArchitecture.All, null)]
[ObjCRuntime.Introduced(ObjCRuntime.PlatformName.iOS, 8, 0, ObjCRuntime.PlatformArchitecture.All, null)]
[ObjCRuntime.Unavailable(ObjCRuntime.PlatformName.WatchOS, ObjCRuntime.PlatformArchitecture.All, null)]
[ObjCRuntime.Introduced(ObjCRuntime.PlatformName.MacOSX, 10, 8, ObjCRuntime.PlatformArchitecture.All, null)]
public virtual void AddAnimation (CoreAnimation.CAAnimation animation, Foundation.NSString key);
abstract member AddAnimation : CoreAnimation.CAAnimation * Foundation.NSString -> unit
override this.AddAnimation : CoreAnimation.CAAnimation * Foundation.NSString -> unit

参数

animation
CAAnimation
key
NSString

实现

属性

注解

以下示例演示如何将旋转动画添加到 SCNGeometry 对象:

var animation = new CABasicAnimation();
animation.KeyPath = "rotation";
var v = new SCNVector4 (1.0F, 1.0F, 0.0F, (float) (Math.PI * 2.0));
animation.To = NSValue.FromVector (v);
animation.Duration = 5.0f;
animation.RepeatCount = float.MaxValue; //repeat forever
boxNode.AddAnimation(animation,new NSString("rotation"));

适用于

AddAnimation(SCNAnimationPlayer, NSString)

[Foundation.Export("addAnimationPlayer:forKey:")]
[ObjCRuntime.Introduced(ObjCRuntime.PlatformName.iOS, 11, 0, ObjCRuntime.PlatformArchitecture.All, null)]
[ObjCRuntime.Introduced(ObjCRuntime.PlatformName.TvOS, 11, 0, ObjCRuntime.PlatformArchitecture.All, null)]
[ObjCRuntime.Introduced(ObjCRuntime.PlatformName.WatchOS, 4, 0, ObjCRuntime.PlatformArchitecture.All, null)]
[ObjCRuntime.Introduced(ObjCRuntime.PlatformName.MacOSX, 10, 13, ObjCRuntime.PlatformArchitecture.Arch64, null)]
[ObjCRuntime.Introduced(ObjCRuntime.PlatformName.WatchOS, 3, 0, ObjCRuntime.PlatformArchitecture.All, null)]
[ObjCRuntime.Introduced(ObjCRuntime.PlatformName.iOS, 8, 0, ObjCRuntime.PlatformArchitecture.All, null)]
public virtual void AddAnimation (SceneKit.SCNAnimationPlayer player, Foundation.NSString key);
[Foundation.Export("addAnimationPlayer:forKey:")]
[ObjCRuntime.Introduced(ObjCRuntime.PlatformName.iOS, 11, 0, ObjCRuntime.PlatformArchitecture.All, null)]
[ObjCRuntime.Introduced(ObjCRuntime.PlatformName.TvOS, 11, 0, ObjCRuntime.PlatformArchitecture.All, null)]
[ObjCRuntime.Introduced(ObjCRuntime.PlatformName.WatchOS, 4, 0, ObjCRuntime.PlatformArchitecture.All, null)]
[ObjCRuntime.Introduced(ObjCRuntime.PlatformName.MacOSX, 10, 13, ObjCRuntime.PlatformArchitecture.Arch64, null)]
[ObjCRuntime.Introduced(ObjCRuntime.PlatformName.WatchOS, 3, 0, ObjCRuntime.PlatformArchitecture.All, null)]
[ObjCRuntime.Introduced(ObjCRuntime.PlatformName.iOS, 8, 0, ObjCRuntime.PlatformArchitecture.All, null)]
[ObjCRuntime.Introduced(ObjCRuntime.PlatformName.MacOSX, 10, 8, ObjCRuntime.PlatformArchitecture.All, null)]
public virtual void AddAnimation (SceneKit.SCNAnimationPlayer player, Foundation.NSString key);
abstract member AddAnimation : SceneKit.SCNAnimationPlayer * Foundation.NSString -> unit
override this.AddAnimation : SceneKit.SCNAnimationPlayer * Foundation.NSString -> unit

参数

key
NSString
属性

适用于