GameObject.SampleAnimation 动画采样

function SampleAnimation (animation : AnimationClip, time : float) : void

Description描述

Samples an animation at a given time for any animated properties.

It is recommended to use the Animation interface instead for performance reasons. This will sample animation at the given time. Any component properties that are animated in the clip will be replaced with the sampled value. Most of the time you want to use Animation.Play instead. SampleAnimation is useful when you need to jump between frames in an unordered way or based on some special input.

参见: Animation

为所有动画属性在某个给定时间为一个动画采样。

除非特殊情况,推荐使用Animation接口.这个函数会在给定的时间点采样动画。在动画剪辑时的任何组件属性将被采样值取代。大部分情况下,你会使用Animation.Play来替代。你想在某种无序的时候操作某些帧或者一些特别的输入的时候,你可以使用SampleAnimation.

using UnityEngine;
using System.Collections;

public class example : MonoBehaviour {
	public AnimationClip clip;
	void Update() {
		gameObject.SampleAnimation(clip, clip.length - Time.time);
	}
}
// 通过每一帧采样来倒播一个动画
var clip : AnimationClip;
function Update() {
	gameObject.SampleAnimation(clip, clip.length - Time.time);
}
Page last updated: 2011-5-19