import phaserJuice from "./path/to/phaserJuice.min.js";`
const juice = new phaserJuice(this);
const sprite = this.add.sprite(x, y, 'sprite');
// shake the sprite
juice.shake(sprite);
// oh no, the sprite is taking damage!
juice.add(sprite)
.shake()
.flash();
It would be cool if you could chain the effects or have timeline controls for rudimentary animations. Something like this (I know, the API is different):
Update:
I have converted the class to a phaser plugin so now it can be installed once and used in any scene.
import phaserJuice from ".path/to/phaserJuicePlugin.min.js";
const config = {
type: Phaser.AUTO,
width: 480,
height: 400,
parent: "gameCanvas",
plugins: {
scene: [
{ key: 'phaserJuice', plugin: phaserJuice, mapping: 'juice' }
]
},
scene: basicScene,
};
const game = new Phaser.Game(config);
// you can now access the plugin in any scene using
this.juice
amazing love how in the demo u show the line of code required to use when the animation is played. You should add a rotate clockwise and rotate anti-clockwise. Would also love to have a way to change the intensity.