SAnimation
في هذا الصنفGetState
| دالة | GetState | Returns the SAnimationState for the default animation clip. |
| دالة | Blend | Blends the animation named animation towards targetWeight over the next time seconds. |
| دالة | CrossFade | Fades the animation with name animation in over a period of time seconds and fades other animations out. |
| دالة | CrossFadeQueued | Returns a duplicated SAnimationState. |
| دالة | GetClipCount | Get the number of clips currently assigned to this animation. |
| دالة | IsPlaying | Is the animation named name playing? |
| دالة | Play | Plays an animation without any blending. |
| دالة | PlayQueued | Returns a duplicated SAnimationState. |
| دالة | Rewind | Rewinds the animation named name. |
| دالة | Sample | Samples animations at the current state. |
| دالة | Stop | Stops all playing animations that were started with this Animation. |
| خاصية | Enabled | Whether this component is enabled or not. |
| خاصية | States | Returns a table of SAnimationState names and references |
| خاصية | GameObject | Returns a reference to the GameObject of this component. |
الدوال
GetState
Returns the SAnimationState for the default animation clip.
المعاملات
| الاسم | النوع | القيمة الافتراضية |
|---|---|---|
| state | string | – |
القيم المرجعة
SAnimationState
مثال
State = Space.Host.ExecutingObject.Animation.GetState()
State = Space.Host.ExecutingObject.Animation.GetState("statename")
Blend
Blends the animation named animation towards targetWeight over the next time seconds. Playback of other animations will not be affected.
المعاملات
| الاسم | النوع | القيمة الافتراضية |
|---|---|---|
| animation | string | – |
| targetWeight | float | 1.0F |
| fadeLength | float | 0.3F |
القيم المرجعة
void
مثال
Space.Host.ExecutingObject.Animation.Blend("animationname",1.0,0.3)
CrossFade
Fades the animation with name animation in over a period of time seconds and fades other animations out.
If mode is PlayMode.StopSameLayer, animations in the same layer as animation will be faded out while animation is faded in. if mode is PlayMode.StopAll, all animations will be faded out while animation is faded in.
If the animation is not set to be looping it will be stopped and rewound after playing.
المعاملات
| الاسم | النوع | القيمة الافتراضية |
|---|---|---|
| animation | string | – |
| fadeLength | float | 0.3F |
القيم المرجعة
void
مثال
Space.Host.ExecutingObject.Animation.CrossFade("animationname", 0.3)
CrossFadeQueued
Returns a duplicated SAnimationState. This duplicate will self-destruct after it is finished playing. Referencing it after it has completed will result in an error.
المعاملات
| الاسم | النوع | القيمة الافتراضية |
|---|---|---|
| animation | string | – |
| fadeLength | float | 0.3F |
| playNow | bool | false |
القيم المرجعة
SAnimationState
مثال
NewSAnimationState = Space.Host.ExecutingObject.Animation.CrossFadeQueued("animationname", 0.3, false)
GetClipCount
Get the number of clips currently assigned to this animation.
القيم المرجعة
int
مثال
NumberOfClips = Space.Host.ExecutingObject.Animation.GetClipCount()
IsPlaying
Is the animation named name playing?
المعاملات
| الاسم | النوع | القيمة الافتراضية |
|---|---|---|
| animation | string | – |
القيم المرجعة
bool
مثال
IsPlaying = Space.Host.ExecutingObject.Animation.IsPlaying("animationname")
Play
Plays an animation without any blending.
If no name is supplied then the default animation will be played. In cases where the animation can't be played (ie, there is no default animation or no animation with the specified name), the function will return false.
The optional playMode lets you choose how this animation will affect others already playing.
If the specified animation is already playing then other animations will be stopped but the animation will not rewind to the beginning.
When the end of the animation is reached it will automatically be stopped and rewound to the start unless the PlayMode is set to Loop.
Note that if you call Animation.Play on an object during a frame update where the object is also deactivated then the call will effectively be cancelled; the animation will not start playing when the object is later reactivated. However, if you make the call on a subsequent frame (ie, while the object is still inactive) then the animation will start playing after reactivation.
المعاملات
| الاسم | النوع | القيمة الافتراضية |
|---|---|---|
| animation | string | – |
القيم المرجعة
bool
مثال
Space.Host.ExecutingObject.Animation.Play()
Space.Host.ExecutingObject.Animation.Play("animationname")
PlayQueued
Returns a duplicated SAnimationState. This duplicate will self-destruct after it is finished playing. Referencing it after it has completed will result in an error.
المعاملات
| الاسم | النوع | القيمة الافتراضية |
|---|---|---|
| animation | string | – |
| playNow | bool | false |
القيم المرجعة
SAnimationState
مثال
Space.Host.ExecutingObject.Animation.PlayQueued("animationname","false")
Rewind
Rewinds the animation named name.
المعاملات
| الاسم | النوع | القيمة الافتراضية |
|---|---|---|
| animation | string | – |
القيم المرجعة
void
مثال
Space.Host.ExecutingObject.Animation.Rewind()
Sample
Samples animations at the current state.
This is useful when you explicitly want to set up some animation state, and sample it once.
القيم المرجعة
void
مثال
Space.Host.ExecutingObject.Animation.Sample()
Stop
Stops all playing animations that were started with this Animation.
Stopping an animation also Rewinds it to the Start.
المعاملات
| الاسم | النوع | القيمة الافتراضية |
|---|---|---|
| animation | string | – |
القيم المرجعة
void
مثال
Space.Host.ExecutingObject.Animation.Stop()
Space.Host.ExecutingObject.Animation.Stop("animationname")
الخصائص
Enabled
Whether this component is enabled or not.
مثال
Space.Host.ExecutingObject.Animation.Enabled = false
--clicking this object will Enable/Disable it's Animation component
thisGameObject = Space.Host.ExecutingObject
animation = thisGameObject.Animation
OnClick = function()
animation.Enabled = not animation.Enabled
end
thisGameObject.AddClickable()
thisGameObject.Clickable.OnClick(OnClick)
Statesللقراءة فقط
Returns a table of SAnimationState names and references
مثال
States = Space.Host.ExecutingObject.Animation.States
GameObjectللقراءة فقط
Returns a reference to the GameObject of this component.
مثال
theGameObject = Space.Host.ExecutingObject.Animation.GameObject



