JSFiddle - React, Tailwind, and code Playground

by espace3d

HTML

<script src="https://cdnjs.cloudflare.com/ajax/libs/phaser/2.6.1/phaser.min.js"></script>

JavaScript

var game = new Phaser.Game(800, 600, Phaser.AUTO, 'phaser-example', { create: create, update: update, render: render });
var tween = null
var lastDuration = null
function create() {
    
//when i click on the graphics after a certain delay do some stuff
    var graphics = game.add.graphics(0, 0);
    graphics.beginFill(0xFF0000, 1);
    graphics.drawCircle(300, 300, 100);
    graphics.pivot.x=290
    graphics.pivot.y=290
    graphics.inputEnabled = true;
    tween = game.add.tween(graphics.scale).to( { x:2, y:2 }, 200, "Linear", true, 0, -1,true);
}

function update() {
if (game.input.activePointer.duration > 500) { 
              tween.resume()
          } else {
              tween.pause()
  				}
}

function render() {
}