]> git.r.bdr.sh - rbdr/sumo/blobdiff - lib/systems/render_winner.js
Colorize the winner renderer
[rbdr/sumo] / lib / systems / render_winner.js
index 53f3602865cef0db744d4bd8227a6232fff3a7a4..ecda168742f275a904e46ad6ff589ca0c2f6f05a 100644 (file)
@@ -1,5 +1,6 @@
 import { System } from '@serpentity/serpentity';
 import { Text } from 'pixi.js';
+import Tinycolor from 'tinycolor2';
 
 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) {
+      const color = Tinycolor(internals.winnerText.tint.toString(16));
+      internals.winnerText.tint = parseInt(color.spin(2).toString().substring(1,7), 16);
       return;
     }
 
@@ -97,11 +100,14 @@ export default class RenderWinnerSystem extends System {
         const message = `${winner} has won`;
         internals.winnerText = new Text(message, {
           fontFamily: 'Arial',
-          fontSize: 96,
+          fontSize: 96 * 8,
           fontWeight: 'bold',
           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.position.y = Config.verticalResolution / 2;
         internals.winnerText.anchor.set(0.5);