public void Get(out Vector2 value, float time) { int index = AfterEffectsUtil.FindLargestLessEqual(_times, time); if (index < 0) { value = _values[0]; } else if (index >= (_times.Length - 1)) { value = _values[_times.Length - 1]; } else // 補間するよ { float t0 = (float)(_times[index]); float t1 = (float)(_times[index + 1]); float v0x = _values[index].x; float v1x = _values[index + 1].x; float v0y = _values[index].y; float v1y = _values[index + 1].y; float t = (time - t0) / (t1 - t0); //[0, 1] value.x = ((v1x - v0x) * t) + v0x; value.y = ((v1y - v0y) * t) + v0y; } }
private IEnumerable <T> EnumerateFiredNotLooped(float prevTime, float currentTime) { Debug.Assert(initialized); // 全く進んでいなければ発火させない if (currentTime - prevTime <= 0f) { yield break; } // 始点を取得 int index = AfterEffectsUtil.FindSmallestGreaterEqual(_times, prevTime); if (index < 0) // まだ発火せず { yield break; } else if (index >= _times.Length) // すでに発火しきっている { yield break; } else { while ((index < _times.Length) && (_times[index] < currentTime)) // 範囲内で、キー時刻を過ぎていれば発火させる { yield return(_values[index]); index++; } } }
public bool Get(float time) { int index = AfterEffectsUtil.FindLargestLessEqual(_times, time); bool ret; if (index < 0) { ret = _values[0]; } else { ret = _values[index]; } return(ret); }
public float Get(float time) { int index = AfterEffectsUtil.FindLargestLessEqual(_times, time); float ret; if (index < 0) { ret = _values[0]; } else if (index >= (_times.Length - 1)) { ret = _values[_times.Length - 1]; } else // 補間するよ { float t0 = (float)(_times[index]); float t1 = (float)(_times[index + 1]); float v0 = _values[index]; float v1 = _values[index + 1]; float t = (time - t0) / (t1 - t0); //[0, 1] ret = ((v1 - v0) * t) + v0; } return(ret); }
public bool GetLooped(float time) { time = AfterEffectsUtil.Fmod(time, (float)_times[_times.Length - 1]); return(Get(time)); }
public void GetLooped(out Vector2 value, float time) { time = AfterEffectsUtil.Fmod(time, (float)_times[_times.Length - 1]); Get(out value, time); }