JSFiddle - React, Tailwind, and code Playground
HTML
<script src="//cdnjs.cloudflare.com/ajax/libs/phaser/2.2.1/phaser.js"></script>
JavaScript
var Scene = {
preload: function(game){
game.load.crossOrigin = 'Anonymous';
game.load.image('spin1', 'http://examples.phaser.io/assets/sprites/spinObj_01.png');
game.load.image('spin2', 'http://examples.phaser.io/assets/sprites/spinObj_02.png');
},
create: function(game){
this.renderGroup = game.add.group()
this.someAsset = game.make.sprite(0, 0, 'spin1');
this.someAsset.scale.set(1.2,1.2)
this.renderGroup.add(this.someAsset);
//this.someOtherAsset = game.make.sprite(0, 50, 'spin2');
//this.renderGroup.add(this.someOtherAsset);
this.mirrorTexture = game.make.renderTexture(game.width, game.height/2);
// Add a sprite to the world that uses this mirrorTexture
this.mirror = game.add.sprite(0, 0, this.mirrorTexture);
this.mirror.alpha = 0.2
this.mirror.anchor.set(0.5,0.5);
this.mirror.position.set(150,150 + 75);
this.mirror.scale.y = -1
},
update: function(game){
this.someAsset.x = Math.sin(game.time.now/180*Math.PI/4) * 100 + 150
var target = this.renderGroup
//var target = game.stage
this.mirrorTexture.renderXY(target, 0, 0, true);
}}
var game = new Phaser.Game(300, 300, Phaser.WEBGL, 'phaser-stage')
game.state.add('game', Scene)
game.state.start('game');