]> git.r.bdr.sh - rbdr/sumo/commitdiff
Colorize the winner renderer
authorBen Beltran <redacted>
Tue, 29 May 2018 08:03:41 +0000 (03:03 -0500)
committerBen Beltran <redacted>
Tue, 26 Jun 2018 21:58:18 +0000 (16:58 -0500)
lib/systems/render_winner.js
package.json

index 73f948b37be5df1d00eabbfc12c5af1abbfa5c2c..ecda168742f275a904e46ad6ff589ca0c2f6f05a 100644 (file)
@@ -1,5 +1,6 @@
 import { System } from '@serpentity/serpentity';
 import { Text } from 'pixi.js';
 import { System } from '@serpentity/serpentity';
 import { Text } from 'pixi.js';
+import Tinycolor from 'tinycolor2';
 
 import Config from '../config';
 import WinnerNode from '../nodes/winner';
 
 import Config from '../config';
 import WinnerNode from '../nodes/winner';
@@ -88,6 +89,8 @@ export default class RenderWinnerSystem extends System {
     // Right now this is final, once a winner is rendered you would need
     // to restart the whole system.
     if (internals.winnerText) {
     // Right now this is final, once a winner is rendered you would need
     // to restart the whole system.
     if (internals.winnerText) {
+      const color = Tinycolor(internals.winnerText.tint.toString(16));
+      internals.winnerText.tint = parseInt(color.spin(2).toString().substring(1,7), 16);
       return;
     }
 
       return;
     }
 
@@ -102,6 +105,7 @@ export default class RenderWinnerSystem extends System {
           fill: 0xffffff,
           align: 'center'
         });
           fill: 0xffffff,
           align: 'center'
         });
+        internals.winnerText.tint = 0xffbbff;
         internals.winnerText.scale.x = 0.125;
         internals.winnerText.scale.y = 0.125;
         internals.winnerText.position.x = Config.horizontalResolution / 2;
         internals.winnerText.scale.x = 0.125;
         internals.winnerText.scale.y = 0.125;
         internals.winnerText.position.x = Config.horizontalResolution / 2;
index 1795ee1b09098c8a92945e4a762ee37f9a4aa2c2..f8611a28f968c3c1abcc4d5932e155dc23dcfa10 100644 (file)
   },
   "homepage": "https://github.com/rbdr/sumo#readme",
   "dependencies": {
   },
   "homepage": "https://github.com/rbdr/sumo#readme",
   "dependencies": {
-    "babel-polyfill": "^6.26.0",
     "@serpentity/components.debug": "^2.0.0",
     "@serpentity/components.position": "^2.0.0",
     "@serpentity/serpentity": "^2.1.0",
     "@serpentity/components.debug": "^2.0.0",
     "@serpentity/components.position": "^2.0.0",
     "@serpentity/serpentity": "^2.1.0",
+    "babel-polyfill": "^6.26.0",
     "matter-js": "^0.14.1",
     "matter-js": "^0.14.1",
-    "pixi.js": "^4.7.3"
+    "pixi.js": "^4.7.3",
+    "tinycolor2": "^1.4.1"
   },
   "browserslist": "last 2 versions",
   "devDependencies": {
   },
   "browserslist": "last 2 versions",
   "devDependencies": {