MotionHandle
登録済みTweenの時刻、速度、寿命を操作します。シーケンスに追加した子をシークするときは親のハンドルを使います。
public struct MotionHandle : IEquatable<MotionHandle>MotionHandle.cs · L5シークして現在位置で止める
using MeatMotion; を追加します。1秒のTweenを0.75秒にシークすると値は6になります。Cancel後はworldを進めても値は6のままです。
float value = 0f;
using var world = new MotionWorld();
var handle = MMotion.Create(0f, 8f, 1f)
.WithScheduler(world)
.Bind(v => value = v);
handle.Time = 0.75;
handle.Cancel();
world.Tick(0.1);
メンバー
- StorageId
- Index
- Version
- None
- ToString
- Equals
- GetHashCode
- operator ==
- operator !=
- IsActive
- IsPlaying
- TotalDuration
- Duration
- Delay
- Loops
- CompletedLoops
- PlaybackSpeed
- Preserve
- Time
- Complete
- Cancel
- TryComplete
- TryCancel
StorageId
ハンドルが属するストレージの識別子です。
public int StorageId;Index
ストレージ内のスロット番号です。識別にはStorageIdとVersionも使用します。
public int Index;Version
同じスロットが別のTweenに再利用されたときに識別する世代番号です。
public int Version;None
どのTweenも参照しない既定のハンドルです。
public static readonly MotionHandle None;ToString
値の文字列表現を返します。
Equals
同じ値を表すか比較します。
public readonly bool Equals(MotionHandle other)引数と戻り値
otherMotionHandle等値比較の対象。- 戻り値
bool
public override readonly bool Equals(object obj)引数と戻り値
objobject等値比較の対象。- 戻り値
bool
GetHashCode
等値比較に対応するハッシュコードを返します。
operator ==
同じハンドルか比較します。
public static bool operator ==(MotionHandle a, MotionHandle b)引数と戻り値
aMotionHandle等値比較の対象。bMotionHandle等値比較の対象。- 戻り値
bool
operator !=
異なるハンドルか比較します。
public static bool operator !=(MotionHandle a, MotionHandle b)引数と戻り値
aMotionHandle等値比較の対象。bMotionHandle等値比較の対象。- 戻り値
bool
IsActive
ハンドルに対応するTweenが有効か返します。保持したTweenは終端に到達した後も有効な場合があります。
IsPlaying
有効で終端に達していないTweenならtrueを返します。PlaybackSpeedが0でもこの条件で判定します。
TotalDuration
遅延・ループを含めた全体の再生秒数です。無限ループでは正の無限大になります。
public readonly double TotalDuration { get; }Duration
構成した補間区間の長さを秒で取得します。
public readonly float Duration { get; }Delay
ビルダーで設定した遅延秒数を返します。
public readonly float Delay { get; }Loops
設定されているループ数を返します。
public readonly int Loops { get; }CompletedLoops
既に通過したループ数をルートハンドルから読み取ります。
public readonly int CompletedLoops { get; }PlaybackSpeed
1は通常速度、0は停止、負の値は逆方向です。NaNや無限大の設定は例外になります。
public float PlaybackSpeed { get; set; }Preserve
完了後もハンドルから再シークできるようにルートTweenを保持します。
Time
経過秒数を読み取ります。有限の時刻を書き込むとルートTweenをシークし、対応する位置の値を反映します。
public double Time { get; set; }Complete
有限のルートTweenを終端まで進めて完了させます。無限ループやシーケンスが所有する子には使用できません。
public void Complete()Cancel
現在の値でルートTweenを停止し、キャンセル通知を発行します。
public void Cancel()TryComplete
再生中の有限のルートなら完了してtrueを返します。
TryCancel
キャンセル可能なルートなら停止してtrueを返します。無効なハンドルや親が所有する子ではfalseになります。
MeatMotion