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.CANVAS, 'phaser-example', { preload: preload,create: create, update: update, render: render });
var tween = null
var lastDuration = null

function preload() {
   game.load.image('hello', 'https://s13.postimg.org/xjhlzmiev/disc_png.png');
}


function create() { 
//when i click on the graphics after a certain delay do some stuff
    var graphics = game.add.sprite(400, 300, 'hello');
    graphics.anchor.x=.5
    graphics.anchor.y=.5
    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() {
}