@@ -111,7 +111,8 @@ public static function EaseInOutExpo(string $time): string
111111 $ firstExp = "pow(2 \\,20*( {$ time })-10)/2 " ;
112112 $ secondExp = "(2-pow(2 \\,-20*( {$ time })+10))/2 " ;
113113
114- return "if(eq(( {$ time }) \\,0) \\,0 \\,(if(eq(( {$ time }) \\,1) \\,1 \\,if(lt(( {$ time }) \\,0.5) \\,pow(2 \\,20*( {$ firstExp })-10)/2) \\,(2-pow(2 \\,-20*( {$ secondExp })+10))/2))) " ;
114+ // We have to set the return value for 0 and 1 explicitly as we lose accuracy at the 4th decimal place.
115+ return "if(eq(( {$ time }) \\,0) \\,0 \\,if(eq(( {$ time }) \\,1) \\,1 \\,if(lt(( {$ time }) \\,0.5) \\, {$ firstExp }\\, {$ secondExp }))) " ;
115116 }
116117
117118 public static function EaseInCirc (string $ time ): string
@@ -134,7 +135,7 @@ public static function EaseInBack(string $time): string
134135 $ c1 = 1.70158 ;
135136 $ c3 = $ c1 + 1 ;
136137
137- return "{$ c1 }*pow(( {$ time }) \\,3)- {$ c3 }*pow(( {$ time }) \\,2) " ;
138+ return "{$ c3 }*pow(( {$ time }) \\,3)- {$ c1 }*pow(( {$ time }) \\,2) " ;
138139 }
139140
140141 public static function EaseOutBack (string $ time ): string
@@ -157,7 +158,7 @@ public static function EaseInElastic(string $time): string
157158 {
158159 $ c4 = (2 * M_PI ) / 3 ;
159160
160- return "if(eq(( {$ time }) \\,0) \\,0 \\,if(eq(( {$ time }) \\,1) \\,1 \\,-pow(2 \\,10*( {$ time })-10)*sin(( {$ time })*10-10.75)* {$ c4 })) " ;
161+ return "if(eq(( {$ time }) \\,0) \\,0 \\,if(eq(( {$ time }) \\,1) \\,1 \\,-pow(2 \\,10*( {$ time })-10)*sin((( {$ time })*10-10.75)* {$ c4 }) )) " ;
161162 }
162163
163164 public static function EaseOutElastic (string $ time ): string
@@ -188,12 +189,12 @@ public static function EaseOutBounce(string $time): string
188189 $ n1 = 7.5625 ;
189190 $ d1 = 2.75 ;
190191 $ firstExpr = "{$ n1 }*pow(( {$ time }) \\,2) " ;
191- $ secondTime = "(( {$ time })-1.5) " ;
192- $ secondExpr = "{$ n1 }*( {$ secondTime }/ { $ d1 } )*( {$ secondTime }) +0.75 " ;
193- $ thirdTime = "(( {$ time })-2.25) " ;
194- $ thirdExpr = "{$ n1 }*( {$ thirdTime }/ { $ d1 } )*( {$ thirdTime }) +0.9375 " ;
195- $ fourthTime = "(( {$ time })-2.65) " ;
196- $ fourthExpr = "{$ n1 }*( {$ fourthTime }/ { $ d1 } )*( {$ fourthTime }) +0.984375 " ;
192+ $ secondTime = "(( {$ time })-1.5/ { $ d1 } ) " ;
193+ $ secondExpr = "{$ n1 }* {$ secondTime }* {$ secondTime }+0.75 " ;
194+ $ thirdTime = "(( {$ time })-2.25/ { $ d1 } ) " ;
195+ $ thirdExpr = "{$ n1 }* {$ thirdTime }* {$ thirdTime }+0.9375 " ;
196+ $ fourthTime = "(( {$ time })-2.65/ { $ d1 } ) " ;
197+ $ fourthExpr = "{$ n1 }* {$ fourthTime }* {$ fourthTime }+0.984375 " ;
197198
198199 return "if(lt(( {$ time }) \\, 1/ {$ d1 }) \\, {$ firstExpr }\\,if(lt(( {$ time }) \\,2/ {$ d1 }) \\, {$ secondExpr }\\,if(lt(( {$ time }) \\,2.5/ {$ d1 }) \\, {$ thirdExpr }\\, {$ fourthExpr }))) " ;
199200 }
@@ -202,9 +203,9 @@ public static function EaseInOutBounce(string $time): string
202203 {
203204 $ x1 = self ::EaseOutBounce ("1-2*( {$ time }) " );
204205 $ x2 = self ::EaseOutBounce ("2*( {$ time })-1 " );
205- $ gtExpr = "(1-( {$ x1 }))/2 " ;
206- $ ltExpr = "(1+( {$ x2 }))/2 " ;
206+ $ ltExpr = "(1-( {$ x1 }))/2 " ;
207+ $ gtExpr = "(1+( {$ x2 }))/2 " ;
207208
208- return "if(lt(( {$ time }) \\,0.5) \\, {$ ltExpr }\\, {$ gtExpr }" ;
209+ return "if(lt(( {$ time }) \\,0.5) \\, {$ ltExpr }\\, {$ gtExpr }) " ;
209210 }
210211}
0 commit comments