@@ -1917,6 +1917,58 @@ export const tests = {
1917
1917
1918
1918
test . done ( )
1919
1919
} ,
1920
+
1921
+ 'Test TWEEN.Easing.generatePow(1) equals Linear' ( test : Test ) : void {
1922
+ const ease1 = TWEEN . Easing . generatePow ( 1 )
1923
+ const easeMinus = TWEEN . Easing . generatePow ( - 1 )
1924
+
1925
+ const compareWithLinear = ( ease : EasingFunctionGroup , amount : number ) => {
1926
+ const linearResult = TWEEN . Easing . Linear . None ( amount )
1927
+ test . equal ( linearResult , ease . In ( amount ) )
1928
+ test . equal ( linearResult , ease . Out ( amount ) )
1929
+ test . equal ( linearResult , ease . InOut ( amount ) )
1930
+ }
1931
+ compareWithLinear ( ease1 , 0 )
1932
+ compareWithLinear ( easeMinus , 0 )
1933
+ compareWithLinear ( ease1 , 0.25 )
1934
+ compareWithLinear ( easeMinus , 0.25 )
1935
+ compareWithLinear ( ease1 , 0.5 )
1936
+ compareWithLinear ( easeMinus , 0.5 )
1937
+ compareWithLinear ( ease1 , 0.75 )
1938
+ compareWithLinear ( easeMinus , 0.75 )
1939
+ compareWithLinear ( ease1 , 1 )
1940
+ compareWithLinear ( easeMinus , 1 )
1941
+
1942
+ compareWithLinear ( ease1 , - 1 )
1943
+ compareWithLinear ( easeMinus , - 1 )
1944
+ compareWithLinear ( ease1 , Infinity )
1945
+ compareWithLinear ( easeMinus , Infinity )
1946
+
1947
+ test . done ( )
1948
+ } ,
1949
+
1950
+ 'Test TWEEN.Easing.generatePow(n) should pass 0.0, 0.5, 1.0' ( test : Test ) : void {
1951
+ const checkEdgeValue = ( ease : EasingFunctionGroup ) => {
1952
+ test . equal ( ease . InOut ( 0.0 ) , 0.0 )
1953
+ test . equal ( ease . In ( 0.0 ) , 0.0 )
1954
+ test . equal ( ease . Out ( 0.0 ) , 0.0 )
1955
+
1956
+ test . equal ( ease . InOut ( 0.5 ) , 0.5 )
1957
+
1958
+ test . equal ( ease . InOut ( 1.0 ) , 1.0 )
1959
+ test . equal ( ease . In ( 1.0 ) , 1.0 )
1960
+ test . equal ( ease . Out ( 1.0 ) , 1.0 )
1961
+ }
1962
+ checkEdgeValue ( TWEEN . Easing . generatePow ( Number . NEGATIVE_INFINITY ) )
1963
+ checkEdgeValue ( TWEEN . Easing . generatePow ( 1 ) )
1964
+ checkEdgeValue ( TWEEN . Easing . generatePow ( Math . LOG2E ) )
1965
+ checkEdgeValue ( TWEEN . Easing . generatePow ( Math . PI ) )
1966
+ checkEdgeValue ( TWEEN . Easing . generatePow ( ) )
1967
+ checkEdgeValue ( TWEEN . Easing . generatePow ( 6 ) )
1968
+ checkEdgeValue ( TWEEN . Easing . generatePow ( Number . POSITIVE_INFINITY ) )
1969
+
1970
+ test . done ( )
1971
+ } ,
1920
1972
}
1921
1973
1922
1974
type Test = {
@@ -1926,3 +1978,9 @@ type Test = {
1926
1978
expect ( n : number ) : void
1927
1979
done ( ) : void
1928
1980
}
1981
+
1982
+ type EasingFunctionGroup = {
1983
+ In ( amount : number ) : number
1984
+ Out ( amount : number ) : number
1985
+ InOut ( amount : number ) : number
1986
+ }
0 commit comments