Skip to main content

Featured

Build docker image from multiple build contexts

Build docker image from multiple build contexts Building a docker image requires specifying a source of truth to include in the image from a local directory or a remote git repository. In the previous version, the docker BuildKit allows users to specify the build context from a single source of truth only. However, the engineers may need to have the context from different locations based on the type of files. For instance, icons, images or other resources that are not included in the same package, including the resource from other docker images. Fortunately, the Docker Buildx toolkit supports multiple build context flag for Docker 1.4. Let's learn how to use this new feature. The following list is a shortcut for jumping into a specific topic handy. What version of Docker is this tutorial targeting? How to specify the version of Dockerfile frontend? Ho

[Unity]AnimationState

參考資料:AnimationState
Unity版本:3.5.6f4

        一般在控制AnimationClip播放時,都會使用Animation類別來控制。但如果想要控制播放速度時,確沒有介面可以控制。所以如果要變更播放各個AnimationClip的播放速度的話,就需要直接操作Animation內所儲存的AnimationStates。底下就針對AnimationState的各個屬性與操作介面來進行測試。

I.屬性:
1.enabled:(bool)
        此屬性是用來控制目前所對應的AnimationClip能不能進行播放。所以在Animation Clip播放時,將AnimationState.enabled設為false時,時間軸就會停止在當下的時間。之後再把AnimationState.enabled設為true時,時間軸就會從目前停止的時間繼續往下播放。

2.weight:(float)
        目前文件寫的看不懂,所以先跳過。

3.wrapMode:(WrapMode)
        AnimationClip的播放模式,可以參考[Unity]Animation WarpMode

4.time:(float)
        動畫的播放時間軸,一般是從0到無限大。可以透過強制指定時間軸來讓動畫的時間軸移動到指定的時間,但此時動畫物件本身並不會到達指定時間的狀態,也就是動畫物件會停留在上次停止的位置。當開始播放動畫的時候,就會從指定的時間開始播放。

5.normalizedTime:(float)
        normalize的動畫時間。此屬性為0到1。0.5代表動畫的時間的中點。

6.speed:(float)
        動畫播放速度,此屬性等於1時,就是正常播放。如要反向播放的話,就只要給定負值就好。為了達到反向播放的效果,也要注意到WrapMode的問題,可以參考[Unity]Animation WarpMode

7.normalizedSpeed:(float)
        normalize的播放速度,一般是做為在兩個動畫間做同步播放使用。根據官方的說法,此屬性會比Animation.SyncLayer()易於使用。

8.length:(float)
        Animation Clip的總播放時間,單位為秒。

9.layer:(int)
        此屬性用來設定AnimationClip播放時的層級,層級會影響到計算動畫播放時的權重值。越高層級的AnimationClip在計算最後繪製權重時,比較可以優先得到自已所預期需要的權重值。而低層級的AnimationClip僅能使用高層級所不需用到的權重值,換句話說,也就是低層級的僅能撿高層級剩下的來用。

10.clip:(AnimationClip)
        要用來播放的AnimationClip。

11.name:(String)
        AnimationClip的名稱。

12.blendMode:(AnimationBlendMode)
        動畫的繪製模式。可參考     。

II.操作介面:
1.AddMixingTransform(Transform mix, bool recursive = true):
        把要有相同的動畫效果的GameObject.transform加到AnimationState內,這樣就可以使用同一個動畫效果套用到不同的GameObject上。這樣可以減少AnimationClip的製作數量。

        recursive設為true時,代表所有混合的transform的子物件都將會被以同樣的方式播放動畫。
(目前未測試成功)

2.RemoveMixingTransform(Transform mix):
        把加到AnimationState內的GameObject.transform移除。

Comments

Popular Posts