public IEnumerator EaseSinusoidalTest() { { var value = 0; ObservableTween.Tween(0, 100, 1.0f, ObservableTween.EaseType.InSinusoidal).Subscribe(x => value = x); yield return(new WaitForSeconds(0.5f)); Assert.GreaterOrEqual(value, 30); Assert.LessOrEqual(value, 35); yield return(new WaitForSeconds(0.6f)); } { var value = 0; ObservableTween.Tween(0, 100, 1.0f, ObservableTween.EaseType.OutSinusoidal).Subscribe(x => value = x); yield return(new WaitForSeconds(0.5f)); Assert.GreaterOrEqual(value, 70); Assert.LessOrEqual(value, 75); yield return(new WaitForSeconds(0.6f)); } { var value = 0; ObservableTween.Tween(0, 100, 1.0f, ObservableTween.EaseType.InOutSinusoidal).Subscribe(x => value = x); yield return(new WaitForSeconds(0.5f)); Assert.GreaterOrEqual(value, 50); Assert.LessOrEqual(value, 51); yield return(new WaitForSeconds(0.6f)); } }
public IEnumerator FloatTest() { var value = 0.0f; ObservableTween.Tween(0.0f, 100.0f, 1.0f, ObservableTween.EaseType.Linear).Subscribe(x => value = x); yield return(new WaitForSeconds(0.5f)); Assert.GreaterOrEqual(value, 40.0f); Assert.LessOrEqual(value, 60.0f); }
public IEnumerator Vector2Test() { var value = Vector2.zero; ObservableTween.Tween(Vector2.zero, Vector2.one, 1.0f, ObservableTween.EaseType.Linear).Subscribe(x => value = x); yield return(new WaitForSeconds(0.5f)); Assert.GreaterOrEqual(value.x, 0.4f); Assert.GreaterOrEqual(value.y, 0.4f); Assert.LessOrEqual(value.x, 0.6f); Assert.LessOrEqual(value.y, 0.6f); }
public IEnumerator EaseBackTest() { { var minValue = 0; var maxValue = 0; ObservableTween .Tween(0, 100, 1.0f, ObservableTween.EaseType.InBack) .Subscribe( x => { if (x < minValue) { minValue = x; } if (x > maxValue) { maxValue = x; } } ); yield return(new WaitForSeconds(1.5f)); Assert.Less(minValue, 0); Assert.AreEqual(maxValue, 100); } { var minValue = 0; var maxValue = 0; ObservableTween .Tween(0, 100, 1.0f, ObservableTween.EaseType.OutBack) .Subscribe( x => { if (x < minValue) { minValue = x; } if (x > maxValue) { maxValue = x; } } ); yield return(new WaitForSeconds(1.5f)); Assert.AreEqual(minValue, 0); Assert.Greater(maxValue, 100); } { var minValue = 0; var maxValue = 0; ObservableTween .Tween(0, 100, 1.0f, ObservableTween.EaseType.InOutBack) .Subscribe( x => { if (x < minValue) { minValue = x; } if (x > maxValue) { maxValue = x; } } ); yield return(new WaitForSeconds(1.5f)); Assert.Less(minValue, 0); Assert.Greater(maxValue, 100); } }