Skip to content
This repository has been archived by the owner on Jan 16, 2024. It is now read-only.

Commit

Permalink
Merge pull request #85 from frankman123/patch-1
Browse files Browse the repository at this point in the history
distance to center fix in star warp
  • Loading branch information
ivanpopelyshev authored Dec 28, 2019
2 parents 58c8e0b + 90099cd commit 33c93b8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion examples/js/demos-advanced/star-warp.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 33c93b8

Please sign in to comment.