共用方式為


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
屬性

適用於