Skip to content

Commit 765cab2

Browse files
committed
Merge pull request phaserjs#1492 from jounii/float-math-fix
Fix floating point inaccuracy in edge cases, behavior not consistent
2 parents e51a37a + 11cf7c4 commit 765cab2

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

src/tween/Easing.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,8 @@ Phaser.Easing = {
247247
*/
248248
In: function ( k ) {
249249

250+
if (k === 0) return 0;
251+
if (k === 1) return 1;
250252
return 1 - Math.cos( k * Math.PI / 2 );
251253

252254
},
@@ -260,6 +262,8 @@ Phaser.Easing = {
260262
*/
261263
Out: function ( k ) {
262264

265+
if (k === 0) return 0;
266+
if (k === 1) return 1;
263267
return Math.sin( k * Math.PI / 2 );
264268

265269
},
@@ -273,6 +277,8 @@ Phaser.Easing = {
273277
*/
274278
InOut: function ( k ) {
275279

280+
if (k === 0) return 0;
281+
if (k === 1) return 1;
276282
return 0.5 * ( 1 - Math.cos( Math.PI * k ) );
277283

278284
}

0 commit comments

Comments
 (0)