phaser4-rex-plugins
Version:
1,212 lines (993 loc) • 34.6 kB
JavaScript
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.rexscaleplugin = factory());
})(this, (function () { 'use strict';
var EventEmitterMethods = {
setEventEmitter(eventEmitter, EventEmitterClass) {
if (EventEmitterClass === undefined) {
EventEmitterClass = Phaser.Events.EventEmitter; // Use built-in EventEmitter class by default
}
this._privateEE = (eventEmitter === true) || (eventEmitter === undefined);
this._eventEmitter = (this._privateEE) ? (new EventEmitterClass()) : eventEmitter;
return this;
},
destroyEventEmitter() {
if (this._eventEmitter && this._privateEE) {
this._eventEmitter.shutdown();
}
return this;
},
getEventEmitter() {
return this._eventEmitter;
},
on() {
if (this._eventEmitter) {
this._eventEmitter.on.apply(this._eventEmitter, arguments);
}
return this;
},
once() {
if (this._eventEmitter) {
this._eventEmitter.once.apply(this._eventEmitter, arguments);
}
return this;
},
off() {
if (this._eventEmitter) {
this._eventEmitter.off.apply(this._eventEmitter, arguments);
}
return this;
},
emit(event) {
if (this._eventEmitter && event) {
this._eventEmitter.emit.apply(this._eventEmitter, arguments);
}
return this;
},
addListener() {
if (this._eventEmitter) {
this._eventEmitter.addListener.apply(this._eventEmitter, arguments);
}
return this;
},
removeListener() {
if (this._eventEmitter) {
this._eventEmitter.removeListener.apply(this._eventEmitter, arguments);
}
return this;
},
removeAllListeners() {
if (this._eventEmitter) {
this._eventEmitter.removeAllListeners.apply(this._eventEmitter, arguments);
}
return this;
},
listenerCount() {
if (this._eventEmitter) {
return this._eventEmitter.listenerCount.apply(this._eventEmitter, arguments);
}
return 0;
},
listeners() {
if (this._eventEmitter) {
return this._eventEmitter.listeners.apply(this._eventEmitter, arguments);
}
return [];
},
eventNames() {
if (this._eventEmitter) {
return this._eventEmitter.eventNames.apply(this._eventEmitter, arguments);
}
return [];
},
};
const SceneClass = Phaser.Scene;
var IsSceneObject = function (object) {
return (object instanceof SceneClass);
};
var GetSceneObject = function (object) {
if ((object == null) || (typeof (object) !== 'object')) {
return null;
} else if (IsSceneObject(object)) { // object = scene
return object;
} else if (object.scene && IsSceneObject(object.scene)) { // object = game object
return object.scene;
} else if (object.parent && object.parent.scene && IsSceneObject(object.parent.scene)) { // parent = bob object
return object.parent.scene;
} else {
return null;
}
};
const GameClass = Phaser.Game;
var IsGame = function (object) {
return (object instanceof GameClass);
};
var GetGame = function (object) {
if ((object == null) || (typeof (object) !== 'object')) {
return null;
} else if (IsGame(object)) {
return object;
} else if (IsGame(object.game)) {
return object.game;
} else if (IsSceneObject(object)) { // object = scene object
return object.sys.game;
} else if (IsSceneObject(object.scene)) { // object = game object
return object.scene.sys.game;
}
};
const GetValue$5 = Phaser.Utils.Objects.GetValue;
class ComponentBase {
constructor(parent, config) {
this.setParent(parent); // gameObject, scene, or game
this.isShutdown = false;
// Event emitter, default is private event emitter
this.setEventEmitter(GetValue$5(config, 'eventEmitter', true));
// Register callback of parent destroy event, also see `shutdown` method
if (this.parent) {
if (this.parent === this.scene) { // parent is a scene
this.scene.sys.events.once('shutdown', this.onEnvDestroy, this);
} else if (this.parent === this.game) { // parent is game
this.game.events.once('shutdown', this.onEnvDestroy, this);
} else if (this.parent.once) { // parent is game object or something else
this.parent.once('destroy', this.onParentDestroy, this);
}
// bob object does not have event emitter
}
}
shutdown(fromScene) {
// Already shutdown
if (this.isShutdown) {
return;
}
// parent might not be shutdown yet
if (this.parent) {
if (this.parent === this.scene) { // parent is a scene
this.scene.sys.events.off('shutdown', this.onEnvDestroy, this);
} else if (this.parent === this.game) { // parent is game
this.game.events.off('shutdown', this.onEnvDestroy, this);
} else if (this.parent.once) { // parent is game object or something else
this.parent.off('destroy', this.onParentDestroy, this);
}
// bob object does not have event emitter
}
this.destroyEventEmitter();
this.parent = undefined;
this.scene = undefined;
this.game = undefined;
this.isShutdown = true;
}
destroy(fromScene) {
this.shutdown(fromScene);
}
onEnvDestroy() {
this.destroy(true);
}
onParentDestroy(parent, fromScene) {
this.destroy(fromScene);
}
setParent(parent) {
this.parent = parent; // gameObject, scene, or game
this.scene = GetSceneObject(parent);
this.game = GetGame(parent);
return this;
}
}
Object.assign(
ComponentBase.prototype,
EventEmitterMethods
);
const GetValue$4 = Phaser.Utils.Objects.GetValue;
class TickTask extends ComponentBase {
constructor(parent, config) {
super(parent, config);
this._isRunning = false;
this.isPaused = false;
this.tickingState = false;
this.setTickingMode(GetValue$4(config, 'tickingMode', 1));
// boot() later
}
// override
boot() {
if ((this.tickingMode === 2) && (!this.tickingState)) {
this.startTicking();
}
}
// override
shutdown(fromScene) {
// Already shutdown
if (this.isShutdown) {
return;
}
this.stop();
if (this.tickingState) {
this.stopTicking();
}
super.shutdown(fromScene);
}
setTickingMode(mode) {
if (typeof (mode) === 'string') {
mode = TICKINGMODE[mode];
}
this.tickingMode = mode;
}
// override
startTicking() {
this.tickingState = true;
}
// override
stopTicking() {
this.tickingState = false;
}
get isRunning() {
return this._isRunning;
}
set isRunning(value) {
if (this._isRunning === value) {
return;
}
this._isRunning = value;
if ((this.tickingMode === 1) && (value != this.tickingState)) {
if (value) {
this.startTicking();
} else {
this.stopTicking();
}
}
}
start() {
this.isPaused = false;
this.isRunning = true;
return this;
}
pause() {
// Only can ba paused in running state
if (this.isRunning) {
this.isPaused = true;
this.isRunning = false;
}
return this;
}
resume() {
// Only can ba resumed in paused state (paused from running state)
if (this.isPaused) {
this.isPaused = false;
this.isRunning = true;
}
return this;
}
stop() {
this.isPaused = false;
this.isRunning = false;
return this;
}
complete() {
this.isPaused = false;
this.isRunning = false;
this.emit('complete', this.parent, this);
}
}
const TICKINGMODE = {
'no': 0,
'lazy': 1,
'always': 2
};
const GetValue$3 = Phaser.Utils.Objects.GetValue;
class SceneUpdateTickTask extends TickTask {
constructor(parent, config) {
super(parent, config);
// scene update : update, preupdate, postupdate, prerender, render
// game update : step, poststep,
// If this.scene is not available, use game's 'step' event
var defaultEventName = (this.scene) ? 'update' : 'step';
this.tickEventName = GetValue$3(config, 'tickEventName', defaultEventName);
this.isSceneTicker = !IsGameUpdateEvent(this.tickEventName);
}
startTicking() {
super.startTicking();
if (this.isSceneTicker) {
this.scene.sys.events.on(this.tickEventName, this.update, this);
} else {
this.game.events.on(this.tickEventName, this.update, this);
}
}
stopTicking() {
super.stopTicking();
if (this.isSceneTicker && this.scene) { // Scene might be destoryed
this.scene.sys.events.off(this.tickEventName, this.update, this);
} else if (this.game) {
this.game.events.off(this.tickEventName, this.update, this);
}
}
// update(time, delta) {
//
// }
}
var IsGameUpdateEvent = function (eventName) {
return (eventName === 'step') || (eventName === 'poststep');
};
const GetValue$2 = Phaser.Utils.Objects.GetValue;
const Clamp = Phaser.Math.Clamp;
class Timer {
constructor(config) {
this.resetFromJSON(config);
}
resetFromJSON(o) {
this.state = GetValue$2(o, 'state', IDLE);
this.timeScale = GetValue$2(o, 'timeScale', 1);
this.delay = GetValue$2(o, 'delay', 0);
this.repeat = GetValue$2(o, 'repeat', 0);
this.repeatCounter = GetValue$2(o, 'repeatCounter', 0);
this.repeatDelay = GetValue$2(o, 'repeatDelay', 0);
this.duration = GetValue$2(o, 'duration', 0);
this.nowTime = GetValue$2(o, 'nowTime', 0);
this.justRestart = GetValue$2(o, 'justRestart', false);
}
toJSON() {
return {
state: this.state,
timeScale: this.timeScale,
delay: this.delay,
repeat: this.repeat,
repeatCounter: this.repeatCounter,
repeatDelay: this.repeatDelay,
duration: this.duration,
nowTime: this.nowTime,
justRestart: this.justRestart,
}
}
destroy() {
}
setTimeScale(timeScale) {
this.timeScale = timeScale;
return this;
}
setDelay(delay) {
if (delay === undefined) {
delay = 0;
}
this.delay = delay;
return this;
}
setDuration(duration) {
this.duration = duration;
return this;
}
setRepeat(repeat) {
this.repeat = repeat;
return this;
}
setRepeatInfinity() {
this.repeat = -1;
return this;
}
setRepeatDelay(repeatDelay) {
this.repeatDelay = repeatDelay;
return this;
}
start() {
this.nowTime = (this.delay > 0) ? -this.delay : 0;
this.state = (this.nowTime >= 0) ? COUNTDOWN : DELAY;
this.repeatCounter = 0;
return this;
}
stop() {
this.state = IDLE;
return this;
}
update(time, delta) {
if (this.state === IDLE || this.state === DONE ||
delta === 0 || this.timeScale === 0
) {
return;
}
this.nowTime += (delta * this.timeScale);
this.justRestart = false;
if (this.nowTime >= this.duration) {
if ((this.repeat === -1) || (this.repeatCounter < this.repeat)) {
this.repeatCounter++;
this.justRestart = true;
this.nowTime -= this.duration;
if (this.repeatDelay > 0) {
this.nowTime -= this.repeatDelay;
this.state = REPEATDELAY;
}
} else {
this.nowTime = this.duration;
this.state = DONE;
}
} else if (this.nowTime >= 0) {
this.state = COUNTDOWN;
}
}
get t() {
var t;
switch (this.state) {
case IDLE:
case DELAY:
case REPEATDELAY:
t = 0;
break;
case COUNTDOWN:
t = this.nowTime / this.duration;
break;
case DONE:
t = 1;
break;
}
return Clamp(t, 0, 1);
}
set t(value) {
value = Clamp(value, -1, 1);
if (value < 0) {
this.state = DELAY;
this.nowTime = -this.delay * value;
} else {
this.state = COUNTDOWN;
this.nowTime = this.duration * value;
if ((value === 1) && (this.repeat !== 0)) {
this.repeatCounter++;
}
}
}
setT(t) {
this.t = t;
return this;
}
get isIdle() {
return this.state === IDLE;
}
get isDelay() {
return this.state === DELAY;
}
get isCountDown() {
return this.state === COUNTDOWN;
}
get isRunning() {
return this.state === DELAY || this.state === COUNTDOWN;
}
get isDone() {
return this.state === DONE;
}
get isOddIteration() {
return (this.repeatCounter & 1) === 1;
}
get isEvenIteration() {
return (this.repeatCounter & 1) === 0;
}
}
const IDLE = 0;
const DELAY = 1;
const COUNTDOWN = 2;
const REPEATDELAY = 3;
const DONE = -1;
class TimerTickTask extends SceneUpdateTickTask {
constructor(parent, config) {
super(parent, config);
this.timer = new Timer();
// boot() later
}
// override
shutdown(fromScene) {
// Already shutdown
if (this.isShutdown) {
return;
}
super.shutdown(fromScene);
this.timer.destroy();
this.timer = undefined;
}
start() {
this.timer.start();
super.start();
return this;
}
stop() {
this.timer.stop();
super.stop();
return this;
}
complete() {
this.timer.stop();
super.complete();
return this;
}
}
const GetValue$1 = Phaser.Utils.Objects.GetValue;
const GetAdvancedValue$1 = Phaser.Utils.Objects.GetAdvancedValue;
const GetEaseFunction = Phaser.Tweens.Builders.GetEaseFunction;
class EaseValueTaskBase extends TimerTickTask {
resetFromJSON(o) {
this.timer.resetFromJSON(GetValue$1(o, 'timer'));
this.setEnable(GetValue$1(o, 'enable', true));
this.setTarget(GetValue$1(o, 'target', this.parent));
this.setDelay(GetAdvancedValue$1(o, 'delay', 0));
this.setDuration(GetAdvancedValue$1(o, 'duration', 1000));
this.setEase(GetValue$1(o, 'ease', 'Linear'));
this.setRepeat(GetValue$1(o, 'repeat', 0));
return this;
}
setEnable(e) {
if (e == undefined) {
e = true;
}
this.enable = e;
return this;
}
setTarget(target) {
if (target === undefined) {
target = this.parent;
}
this.target = target;
return this;
}
setDelay(time) {
this.delay = time;
// Assign `this.timer.setRepeat(repeat)` manually
return this;
}
setDuration(time) {
this.duration = time;
return this;
}
setRepeat(repeat) {
this.repeat = repeat;
// Assign `this.timer.setRepeat(repeat)` manually
return this;
}
setRepeatDelay(repeatDelay) {
this.repeatDelay = repeatDelay;
// Assign `this.timer.setRepeatDelay(repeatDelay)` manually
return this;
}
setEase(ease) {
if (ease === undefined) {
ease = 'Linear';
}
this.ease = ease;
this.easeFn = GetEaseFunction(ease);
return this;
}
// Override
start() {
// Ignore start if timer is running, i.e. in DELAY, o RUN state
if (this.timer.isRunning) {
return this;
}
super.start();
return this;
}
restart() {
this.timer.stop();
this.start.apply(this, arguments);
return this;
}
stop(toEnd) {
if (toEnd === undefined) {
toEnd = false;
}
super.stop();
if (toEnd) {
this.timer.setT(1);
this.updateTarget(this.target, this.timer);
this.complete();
}
return this;
}
update(time, delta) {
if (
(!this.isRunning) ||
(!this.enable) ||
(this.parent.hasOwnProperty('active') && !this.parent.active)
) {
return this;
}
var target = this.target,
timer = this.timer;
timer.update(time, delta);
// isDelay, isCountDown, isDone
if (!timer.isDelay) {
this.updateTarget(target, timer);
}
this.emit('update', target, this);
if (timer.isDone) {
this.complete();
}
return this;
}
// Override
updateTarget(target, timer) {
}
}
const GetValue = Phaser.Utils.Objects.GetValue;
const GetAdvancedValue = Phaser.Utils.Objects.GetAdvancedValue;
const Linear = Phaser.Math.Linear;
class Scale extends EaseValueTaskBase {
constructor(gameObject, config) {
super(gameObject, config);
// this.parent = gameObject;
// this.timer
this.scaleStart = {};
this.scaleEnd = {};
this.resetFromJSON(config);
this.boot();
}
resetFromJSON(o) {
super.resetFromJSON(o);
this.setMode(GetValue(o, 'mode', 0));
this.setScaleRange(
GetAdvancedValue(o, 'start', undefined),
GetAdvancedValue(o, 'end', 0)
);
return this;
}
setMode(m) {
if (typeof (m) === 'string') {
m = MODE[m];
}
this.mode = m;
return this;
}
setScaleRange(start, end) {
if (typeof (start) === 'number') {
this.startX = start;
this.startY = start;
} else {
this.startX = GetAdvancedValue(start, 'x', this.parent.scaleX);
this.startY = GetAdvancedValue(start, 'y', this.parent.scaleY);
}
if (typeof (end) === 'number') {
this.endX = end;
this.endY = end;
} else {
this.endX = GetAdvancedValue(end, 'x', undefined);
this.endY = GetAdvancedValue(end, 'y', undefined);
}
this.hasScaleX = (this.startX !== undefined) && (this.endX !== undefined);
this.hasScaleY = (this.startY !== undefined) && (this.endY !== undefined);
return this;
}
start() {
if (this.timer.isRunning) {
return this;
}
var gameObject = this.parent;
if (this.hasScaleX) {
gameObject.scaleX = this.startX;
}
if (this.hasScaleY) {
gameObject.scaleY = this.startY;
}
var repeat = this.repeat;
if (this.mode === 2) { // Yoyo
if (repeat !== -1) {
repeat = ((repeat + 1) * 2) - 1;
}
}
this.timer
.setDelay(this.delay)
.setDuration(this.duration)
.setRepeat(repeat);
super.start();
return this;
}
updateTarget(gameObject, timer) {
var t = timer.t;
if (timer.isOddIteration) { // Yoyo
t = 1 - t;
}
t = this.easeFn(t);
if (this.hasScaleX) {
gameObject.scaleX = Linear(this.startX, this.endX, t);
}
if (this.hasScaleY) {
gameObject.scaleY = Linear(this.startY, this.endY, t);
}
}
complete() {
super.complete();
if (this.mode === 1) {
this.parent.destroy();
// Will also destroy this behavior
}
return this;
}
}
const MODE = {
stop: 0,
destroy: 1,
yoyo: 2
};
var ScaleDown = function (gameObject, duration, orientation, ease, scale) {
if (ease === undefined) {
ease = 'Linear';
}
var config = {};
config.mode = 0;
switch (orientation) {
case 0:
case 'x':
config.end = {
x: 0
};
break;
case 1:
case 'y':
config.end = {
y: 0
};
break;
default:
config.end = 0;
break;
}
config.duration = duration;
config.ease = ease;
if (scale === undefined) {
scale = new Scale(gameObject, config);
} else {
scale.resetFromJSON(config);
}
scale.restart();
return scale;
};
var ScaleDownDestroy = function (gameObject, duration, orientation, ease, destroyMode, scale) {
if (ease === undefined) {
ease = 'Linear';
}
// Ease from current scale to 0
if (destroyMode instanceof Scale) {
scale = destroyMode;
destroyMode = undefined;
}
if (destroyMode === undefined) {
destroyMode = true;
}
var config = {};
config.mode = (destroyMode) ? 1 : 0;
switch (orientation) {
case 0:
case 'x':
config.end = {
x: 0
};
break;
case 1:
case 'y':
config.end = {
y: 0
};
break;
default:
config.end = 0;
break;
}
config.duration = duration;
config.ease = ease;
if (scale === undefined) {
scale = new Scale(gameObject, config);
} else {
scale.resetFromJSON(config);
}
scale.restart();
return scale;
};
var PopUp = function (gameObject, duration, orientation, ease, scale) {
if (ease === undefined) {
ease = 'Cubic';
}
// Ease scale from 0 to current scale
var start, end;
switch (orientation) {
case 0:
case 'x':
start = { x: 0 };
end = { x: gameObject.scaleX };
break;
case 1:
case 'y':
start = { y: 0 };
end = { y: gameObject.scaleY };
break;
default:
start = 0;
end = gameObject.scale;
break;
}
var config = {
mode: 0,
start: start,
end: end,
duration: duration,
ease: ease
};
if (scale === undefined) {
scale = new Scale(gameObject, config);
} else {
scale.resetFromJSON(config);
}
scale.restart();
return scale;
};
var Yoyo = function (gameObject, duration, peakValue, repeat, orientation, ease, scale) {
if (peakValue === undefined) {
peakValue = 1.2;
}
if (repeat === undefined) {
repeat = 0;
}
if (ease === undefined) {
ease = 'Cubic';
}
// Ease scale from 0 to current scale
var start, end;
switch (orientation) {
case 0:
case 'x':
start = { x: gameObject.scaleX };
end = { x: peakValue };
break;
case 1:
case 'y':
start = { y: gameObject.scaleX };
end = { y: peakValue };
break;
default:
start = gameObject.scaleX;
end = peakValue;
break;
}
var config = {
mode: 2,
start: start,
end: end,
duration: (duration / 2),
ease: ease,
repeat: repeat,
};
if (scale === undefined) {
scale = new Scale(gameObject, config);
} else {
scale.resetFromJSON(config);
}
scale.restart();
return scale;
};
var WaitEvent = function (eventEmitter, eventName) {
return new Promise(function (resolve, reject) {
eventEmitter.once(eventName, function () {
resolve();
});
});
};
var WaitComplete = function (eventEmitter) {
return WaitEvent(eventEmitter, 'complete');
};
const IsPlainObject = Phaser.Utils.Objects.IsPlainObject;
var ScaleMethods = {
onInitScale() {
var gameObject = this;
var scale = this._scaleBehavior;
// Route 'complete' of scale to gameObject
scale.completeEventName = undefined;
scale.on('complete', function () {
if (scale.completeEventName) {
gameObject.emit(scale.completeEventName, gameObject);
scale.completeEventName = undefined;
}
});
},
popUp(duration, orientation, ease) {
if (IsPlainObject(duration)) {
var config = duration;
duration = config.duration;
orientation = config.orientation;
ease = config.ease;
}
var isInit = (this._scaleBehavior === undefined);
this._scaleBehavior = PopUp(this, duration, orientation, ease, this._scaleBehavior);
if (isInit) {
this.onInitScale();
}
this._scaleBehavior.completeEventName = 'popup.complete';
return this;
},
popUpPromise(duration, orientation, ease) {
this.popUp(duration, orientation, ease);
return WaitComplete(this._scaleBehavior);
},
isRunningPopUp() {
return this._scaleBehavior && (this._scaleBehavior.completeEventName === 'popup.complete');
},
scaleDownDestroy(duration, orientation, ease, destroyMode) {
if (IsPlainObject(duration)) {
var config = duration;
duration = config.duration;
orientation = config.orientation;
ease = config.ease;
destroyMode = config.destroy;
}
var isInit = (this._scaleBehavior === undefined);
this._scaleBehavior = ScaleDownDestroy(this, duration, orientation, ease, destroyMode, this._scaleBehavior);
if (isInit) {
this.onInitScale();
}
this._scaleBehavior.completeEventName = 'scaledown.complete';
return this;
},
scaleDownDestroyPromise(duration, orientation, ease, destroyMode) {
this.scaleDownDestroy(duration, orientation, ease, destroyMode);
return WaitComplete(this._scaleBehavior);
},
scaleDown(duration, orientation, ease) {
this.scaleDownDestroy(duration, orientation, ease, false);
return this;
},
scaleDownPromise(duration, orientation, ease) {
this.scaleDown(duration, orientation, ease);
return WaitComplete(this._scaleBehavior);
},
isRunningScaleDown() {
return this._scaleBehavior && (this._scaleBehavior.completeEventName === 'scaledown.complete');
},
scaleYoyo(duration, peakValue, repeat, orientation, ease) {
if (IsPlainObject(duration)) {
var config = duration;
duration = config.duration;
peakValue = config.peakValue;
repeat = config.repeat;
orientation = config.orientation;
ease = config.ease;
}
var isInit = (this._scaleBehavior === undefined);
this._scaleBehavior = Yoyo(this, duration, peakValue, repeat, orientation, ease, this._scaleBehavior);
if (isInit) {
this.onInitScale();
}
this._scaleBehavior.completeEventName = 'scaleyoyo.complete';
return this;
},
scaleYoyoPromise(duration, peakValue, repeat, orientation, ease) {
this.scaleYoyo(duration, peakValue, repeat, orientation, ease);
return WaitComplete(this._scaleBehavior);
},
isRunningScaleYoyo() {
return this._scaleBehavior && (this._scaleBehavior.completeEventName = 'scaleyoyo.complete');
},
isRunningEaseScale() {
return this.isRunningPopUp() || this.isRunningScaleDown() || this.isRunningScaleYoyo();
},
};
class ScalePlugin extends Phaser.Plugins.BasePlugin {
constructor(pluginManager) {
super(pluginManager);
}
start() {
var eventEmitter = this.game.events;
eventEmitter.on('destroy', this.destroy, this);
}
add(gameObject, config) {
return new Scale(gameObject, config);
}
injectMethods(gameObject) {
Object.assign(gameObject, ScaleMethods);
return gameObject;
}
injectMethodsToRootClass() {
this.injectMethods(Phaser.GameObjects.GameObject.prototype);
return this;
}
}
// mixin
var methods = {
scaleDown: ScaleDown,
scaleDownDestroy: ScaleDownDestroy,
popup: PopUp,
yoyo: Yoyo,
};
Object.assign(
ScalePlugin.prototype,
methods
);
return ScalePlugin;
}));