From 90099cd319ec6fc2abce727fdc619af672e37106 Mon Sep 17 00:00:00 2001 From: Frank Cizmich Date: Sat, 28 Dec 2019 18:46:27 -0300 Subject: [PATCH] distance to center fix in star warp fixed star distance to center calculation. bug only noticeable when you add many stars --- examples/js/demos-advanced/star-warp.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/js/demos-advanced/star-warp.js b/examples/js/demos-advanced/star-warp.js index af7379c4..5e28d777 100644 --- a/examples/js/demos-advanced/star-warp.js +++ b/examples/js/demos-advanced/star-warp.js @@ -62,7 +62,7 @@ app.ticker.add((delta) => { // Calculate star scale & rotation. const dxCenter = star.sprite.x - app.renderer.screen.width / 2; const dyCenter = star.sprite.y - app.renderer.screen.height / 2; - const distanceCenter = Math.sqrt(dxCenter * dxCenter + dyCenter + dyCenter); + const distanceCenter = Math.sqrt(dxCenter * dxCenter + dyCenter * dyCenter); const distanceScale = Math.max(0, (2000 - z) / 2000); star.sprite.scale.x = distanceScale * starBaseSize; // Star is looking towards center so that y axis is towards center.