mage-engine 3.20.2 → 3.21.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/mage.js +779 -478
- package/package.json +1 -1
package/dist/mage.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
function ownKeys$1(object, enumerableOnly) {
|
|
2
2
|
var keys = Object.keys(object);
|
|
3
3
|
|
|
4
4
|
if (Object.getOwnPropertySymbols) {
|
|
@@ -371,13 +371,28 @@ function _createForOfIteratorHelper(o, allowArrayLike) {
|
|
|
371
371
|
}
|
|
372
372
|
}
|
|
373
373
|
};
|
|
374
|
-
}var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
374
|
+
}var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
375
|
+
|
|
376
|
+
function getAugmentedNamespace(n) {
|
|
377
|
+
if (n.__esModule) return n;
|
|
378
|
+
var a = Object.defineProperty({}, '__esModule', {value: true});
|
|
379
|
+
Object.keys(n).forEach(function (k) {
|
|
380
|
+
var d = Object.getOwnPropertyDescriptor(n, k);
|
|
381
|
+
Object.defineProperty(a, k, d.get ? d : {
|
|
382
|
+
enumerable: true,
|
|
383
|
+
get: function () {
|
|
384
|
+
return n[k];
|
|
385
|
+
}
|
|
386
|
+
});
|
|
387
|
+
});
|
|
388
|
+
return a;
|
|
389
|
+
}var between$1 = {exports: {}};/* Between.js v0.1.2-fix.2 */
|
|
375
390
|
|
|
376
391
|
(function (module, exports) {
|
|
377
392
|
!function(t,n){module.exports=n();}(commonjsGlobal,function(){function O(t){return (O="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function r(t,n){for(var e=0;e<n.length;e++){var r=n[e];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r);}}function n(t,n,e){return n&&r(t.prototype,n),e&&r(t,e),t}function M(t,n,e){return n in t?Object.defineProperty(t,n,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[n]=e,t}function I(t){return (I=Object.getPrototypeOf||function(t){return t.__proto__})(t)}function o(t,n){return (o=Object.setPrototypeOf||function(t,n){return t.__proto__=n,t})(t,n)}function u(t,n,e){return (u="undefined"!=typeof Reflect&&Reflect.construct?Reflect.construct:function(t,n,e){var r=[null];r.push.apply(r,n);var u=new(t.bind.apply(t,r));return e&&o(u,e.prototype),u}).apply(null,arguments)}function _(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}var t=function(o){var a={},i=[];(o=o||this).on=function(t,n,e){return (a[t]=a[t]||[]).push([n,e]),o},o.off=function(t,n){t||(a={});for(var e=a[t]||i,r=e.length=n?e.length:0;r--;)n==e[r][0]&&e.splice(r,1);return o},o.emit=function(t){for(var n,e=a[t]||i,r=0<e.length?e.slice(0,e.length):e,u=0;n=r[u++];)n[0].apply(n[1],i.slice.call(arguments,1));return o};};var V=function(t,n,e){return t*(1-e)+n*e},e="undefined"!=typeof window?window:"undefined"!=typeof commonjsGlobal?commonjsGlobal:"undefined"!=typeof self?self:{};function a(t,n){return t(n={exports:{}},n.exports),n.exports}for(var i=a(function(t){var n=t.exports={Linear:{None:function(t){return t}},Quadratic:{In:function(t){return t*t},Out:function(t){return t*(2-t)},InOut:function(t){return (t*=2)<1?.5*t*t:-.5*(--t*(t-2)-1)}},Cubic:{In:function(t){return t*t*t},Out:function(t){return --t*t*t+1},InOut:function(t){return (t*=2)<1?.5*t*t*t:.5*((t-=2)*t*t+2)}},Quartic:{In:function(t){return t*t*t*t},Out:function(t){return 1- --t*t*t*t},InOut:function(t){return (t*=2)<1?.5*t*t*t*t:-.5*((t-=2)*t*t*t-2)}},Quintic:{In:function(t){return t*t*t*t*t},Out:function(t){return --t*t*t*t*t+1},InOut:function(t){return (t*=2)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2)}},Sinusoidal:{In:function(t){return 1-Math.cos(t*Math.PI/2)},Out:function(t){return Math.sin(t*Math.PI/2)},InOut:function(t){return .5*(1-Math.cos(Math.PI*t))}},Exponential:{In:function(t){return 0===t?0:Math.pow(1024,t-1)},Out:function(t){return 1===t?1:1-Math.pow(2,-10*t)},InOut:function(t){return 0===t?0:1===t?1:(t*=2)<1?.5*Math.pow(1024,t-1):.5*(2-Math.pow(2,-10*(t-1)))}},Circular:{In:function(t){return 1-Math.sqrt(1-t*t)},Out:function(t){return Math.sqrt(1- --t*t)},InOut:function(t){return (t*=2)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)}},Elastic:{In:function(t){var n,e=.1;return 0===t?0:1===t?1:(!e||e<1?(e=1,n=.1):n=.4*Math.asin(1/e)/(2*Math.PI),-e*Math.pow(2,10*(t-=1))*Math.sin((t-n)*(2*Math.PI)/.4))},Out:function(t){var n,e=.1;return 0===t?0:1===t?1:(!e||e<1?(e=1,n=.1):n=.4*Math.asin(1/e)/(2*Math.PI),e*Math.pow(2,-10*t)*Math.sin((t-n)*(2*Math.PI)/.4)+1)},InOut:function(t){var n,e=.1;return 0===t?0:1===t?1:(!e||e<1?(e=1,n=.1):n=.4*Math.asin(1/e)/(2*Math.PI),(t*=2)<1?e*Math.pow(2,10*(t-=1))*Math.sin((t-n)*(2*Math.PI)/.4)*-.5:e*Math.pow(2,-10*(t-=1))*Math.sin((t-n)*(2*Math.PI)/.4)*.5+1)}},Back:{In:function(t){return t*t*(2.70158*t-1.70158)},Out:function(t){return --t*t*(2.70158*t+1.70158)+1},InOut:function(t){var n=2.5949095;return (t*=2)<1?t*t*((n+1)*t-n)*.5:.5*((t-=2)*t*((n+1)*t+n)+2)}},Bounce:{In:function(t){return 1-n.Bounce.Out(1-t)},Out:function(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375},InOut:function(t){return t<.5?.5*n.Bounce.In(2*t):.5*n.Bounce.Out(2*t-1)+.5}}};}),c=(i.Linear,i.Quadratic,i.Cubic,i.Quartic,i.Quintic,i.Sinusoidal,i.Exponential,i.Circular,i.Elastic,i.Back,i.Bounce,a(function(a){(function(){var t,n,e,r,u,o;"undefined"!=typeof performance&&null!==performance&&performance.now?a.exports=function(){return performance.now()}:"undefined"!=typeof process&&null!==process&&process.hrtime?(a.exports=function(){return (t()-u)/1e6},n=process.hrtime,r=(t=function(){var t;return 1e9*(t=n())[0]+t[1]})(),o=1e9*process.uptime(),u=r-o):Date.now?(a.exports=function(){return Date.now()-e},e=Date.now()):(a.exports=function(){return (new Date).getTime()-e},e=(new Date).getTime());}).call(e);})),l="undefined"==typeof window?e:window,f=["moz","webkit"],s="AnimationFrame",p=l["request"+s],h=l["cancel"+s]||l["cancelRequest"+s],m=0;!p&&m<f.length;m++)p=l[f[m]+"Request"+s],h=l[f[m]+"Cancel"+s]||l[f[m]+"CancelRequest"+s];if(!p||!h){var d=0,y=0,v=[];p=function(t){if(0===v.length){var n=c(),e=Math.max(0,1e3/60-(n-d));d=e+n,setTimeout(function(){for(var t=v.slice(0),n=v.length=0;n<t.length;n++)if(!t[n].cancelled)try{t[n].callback(d);}catch(t){setTimeout(function(){throw t},0);}},Math.round(e));}return v.push({handle:++y,callback:t,cancelled:!1}),y},h=function(t){for(var n=0;n<v.length;n++)v[n].handle===t&&(v[n].cancelled=!0);};}var b=function(t){return p.call(l,t)};b.cancel=function(){h.apply(l,arguments);},b.polyfill=function(t){t||(t=l),t.requestAnimationFrame=p,t.cancelAnimationFrame=h;};var w,k,P=[],T=Symbol("type"),j=Symbol("start_time"),x=Symbol("completed"),D=Symbol("paused"),g=requestAnimationFrame||b,A=Date.now();!function t(){g(t),w=Date.now(),k=w-A;for(var n=0;n<P.length;n++)P[n][x]||P[n](k,Date.now()-P[n][j]);A=w;}();var E=function(t){function g(e,t){var n,r,u,o;!function(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}(this,g),u=this,o=I(g).call(this),M(_(_(r=!o||"object"!=typeof o&&"function"!=typeof o?_(u):o)),"update",function(){var e=_(_(r))._updateValue;return function(t,n){r[x]||r[D]||(0===r.localTime&&r.emit("start",r.value,_(_(r))),e(r.ease(r.loopFunction.progress(Math.min(1,(n||r.localTime)/r.duration)))),r.emit("update",r.value,_(_(r)),t),r.localTime>=r.duration&&r.loopFunction.complete(function(){r[x]=!0,r.emit("complete",r.value,_(_(r)));}),r.localTime+=t);}});var a=r.plugin=Object.values(g._plugins).reduce(function(t,n){return t||n&&n.test&&n.test(e)&&n},!1),i=a&&a.name||("object"===O(e)?Array.isArray(e)?"array":"object":"number");if(a){var c=a.initialize(e,t);e=c.startValue,t=c.destValue,r.data=c.data;}switch(Object.assign(_(_(r)),(M(n={duration:1e3,localTime:0,startValue:e,destValue:t,loopMode:"once",loopFunction:g.DEFAULT_LOOP,ease:function(t){return t},value:"array"===i?[].concat(e):"object"===i?Object.assign({},e):e},x,!1),M(n,T,i),M(n,j,Date.now()),M(n,D,!1),n)),r[T]){case"number":r._updateValue=function(t){r.value=V(r.startValue,r.destValue,t);};break;case"array":var l=r.value.length,f=_(_(r)),s=f.startValue,p=f.destValue,h=f.value;r._updateValue=function(t){for(var n=0;n<l;n++)h[n]=V(s[n],p[n],t);};break;case"object":var m=Object.keys(r.startValue),d=m.length,y=_(_(r)),v=y.startValue,b=y.destValue,w=y.value;r._updateValue=function(t){for(var n=0;n<d;n++){var e=m[n];w[e]=V(v[e],b[e],t);}};break;default:r.plugin?r._updateValue=function(t){r.value=r.plugin.interpolate(r.startValue,r.destValue,t,r.data);}:(console.warn("Between: startValue type was unrecognized."),r._updateValue=function(){return null});}return P.push(r.update()),r}return n(g,null,[{key:"between",value:function(){for(var t=arguments.length,n=new Array(t),e=0;e<t;e++)n[e]=arguments[e];return u(g,n)}}]),n(g,[{key:"pause",value:function(){return this[D]=!0,this.emit("pause",this.value,this,k),this}},{key:"play",value:function(){return this[D]=!1,this.emit("play",this.value,this,k),this}},{key:"easing",value:function(t){return this.ease=t,this}},{key:"time",value:function(t){return this.duration=t,this}},{key:"loop",value:function(){for(var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:"once",n="__loop_".concat(t),e=arguments.length,r=new Array(1<e?e-1:0),u=1;u<e;u++)r[u-1]=arguments[u];return this.loopFunction=n in this?Object.assign({},g.DEFAULT_LOOP,this[n].apply(this,r)):g.DEFAULT_LOOP,this}},{key:"__loop_repeat",value:function(t){var n=this,e=t;return this.times=0,{complete:function(t){n.localTime=0,Number.isInteger(e)&&++n.times===e?t():Number.isInteger(e)||++n.times;}}}},{key:"__loop_bounce",value:function(t){var n=this,e=t,r=1;return this.times=0,{complete:function(t){n.localTime=0,r=-r,Number.isInteger(e)&&++n.times===e?t():Number.isInteger(e)||++n.times;},progress:function(t){return 0<r?t:1-t}}}},{key:"isPaused",get:function(){return this[D]}}]),function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function");o(t.prototype,n&&n.prototype),n&&o(t,n);}(g,t),g}(t);return M(E,"DEFAULT_LOOP",{complete:function(t){return t()},progress:function(t){return t}}),E.Easing=i,E._plugins={},E});
|
|
378
|
-
}(between));
|
|
393
|
+
}(between$1));
|
|
379
394
|
|
|
380
|
-
var
|
|
395
|
+
var between = between$1.exports;/*! *****************************************************************************
|
|
381
396
|
Copyright (c) Microsoft Corporation. All rights reserved.
|
|
382
397
|
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
383
398
|
this file except in compliance with the License. You may obtain a copy of the
|
|
@@ -863,6 +878,27 @@ function updateContext(context, _event, assignActions, state) {
|
|
|
863
878
|
|
|
864
879
|
var warn = function () {};
|
|
865
880
|
|
|
881
|
+
if (!IS_PRODUCTION) {
|
|
882
|
+
warn = function (condition, message) {
|
|
883
|
+
var error = condition instanceof Error ? condition : undefined;
|
|
884
|
+
|
|
885
|
+
if (!error && condition) {
|
|
886
|
+
return;
|
|
887
|
+
}
|
|
888
|
+
|
|
889
|
+
if (console !== undefined) {
|
|
890
|
+
var args = ["Warning: " + message];
|
|
891
|
+
|
|
892
|
+
if (error) {
|
|
893
|
+
args.push(error);
|
|
894
|
+
} // tslint:disable-next-line:no-console
|
|
895
|
+
|
|
896
|
+
|
|
897
|
+
console.warn.apply(console, args);
|
|
898
|
+
}
|
|
899
|
+
};
|
|
900
|
+
}
|
|
901
|
+
|
|
866
902
|
function isArray$4(value) {
|
|
867
903
|
return Array.isArray(value);
|
|
868
904
|
} // tslint:disable-next-line:ban-types
|
|
@@ -933,6 +969,16 @@ function isMachine(value) {
|
|
|
933
969
|
}
|
|
934
970
|
}
|
|
935
971
|
|
|
972
|
+
var uniqueId =
|
|
973
|
+
/*#__PURE__*/
|
|
974
|
+
function () {
|
|
975
|
+
var currentId = 0;
|
|
976
|
+
return function () {
|
|
977
|
+
currentId++;
|
|
978
|
+
return currentId.toString(16);
|
|
979
|
+
};
|
|
980
|
+
}();
|
|
981
|
+
|
|
936
982
|
function toEventObject(event, payload // id?: TEvent['type']
|
|
937
983
|
) {
|
|
938
984
|
if (isString$4(event) || typeof event === 'number') {
|
|
@@ -981,6 +1027,47 @@ function normalizeTarget(target) {
|
|
|
981
1027
|
}
|
|
982
1028
|
|
|
983
1029
|
return toArray$1(target);
|
|
1030
|
+
}
|
|
1031
|
+
|
|
1032
|
+
function reportUnhandledExceptionOnInvocation(originalError, currentError, id) {
|
|
1033
|
+
if (!IS_PRODUCTION) {
|
|
1034
|
+
var originalStackTrace = originalError.stack ? " Stacktrace was '" + originalError.stack + "'" : '';
|
|
1035
|
+
|
|
1036
|
+
if (originalError === currentError) {
|
|
1037
|
+
// tslint:disable-next-line:no-console
|
|
1038
|
+
console.error("Missing onError handler for invocation '" + id + "', error was '" + originalError + "'." + originalStackTrace);
|
|
1039
|
+
} else {
|
|
1040
|
+
var stackTrace = currentError.stack ? " Stacktrace was '" + currentError.stack + "'" : ''; // tslint:disable-next-line:no-console
|
|
1041
|
+
|
|
1042
|
+
console.error("Missing onError handler and/or unhandled exception/promise rejection for invocation '" + id + "'. " + ("Original error: '" + originalError + "'. " + originalStackTrace + " Current error is '" + currentError + "'." + stackTrace));
|
|
1043
|
+
}
|
|
1044
|
+
}
|
|
1045
|
+
}function mapState(stateMap, stateId) {
|
|
1046
|
+
var e_1, _a;
|
|
1047
|
+
|
|
1048
|
+
var foundStateId;
|
|
1049
|
+
|
|
1050
|
+
try {
|
|
1051
|
+
for (var _b = __values(keys(stateMap)), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
1052
|
+
var mappedStateId = _c.value;
|
|
1053
|
+
|
|
1054
|
+
if (matchesState(mappedStateId, stateId) && (!foundStateId || stateId.length > foundStateId.length)) {
|
|
1055
|
+
foundStateId = mappedStateId;
|
|
1056
|
+
}
|
|
1057
|
+
}
|
|
1058
|
+
} catch (e_1_1) {
|
|
1059
|
+
e_1 = {
|
|
1060
|
+
error: e_1_1
|
|
1061
|
+
};
|
|
1062
|
+
} finally {
|
|
1063
|
+
try {
|
|
1064
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
1065
|
+
} finally {
|
|
1066
|
+
if (e_1) throw e_1.error;
|
|
1067
|
+
}
|
|
1068
|
+
}
|
|
1069
|
+
|
|
1070
|
+
return stateMap[foundStateId];
|
|
984
1071
|
}var ActionTypes$1;
|
|
985
1072
|
|
|
986
1073
|
(function (ActionTypes) {
|
|
@@ -1016,10 +1103,10 @@ var raise$1 = ActionTypes$1.Raise;
|
|
|
1016
1103
|
var send$1 = ActionTypes$1.Send;
|
|
1017
1104
|
var cancel$1 = ActionTypes$1.Cancel;
|
|
1018
1105
|
var nullEvent = ActionTypes$1.NullEvent;
|
|
1019
|
-
var assign = ActionTypes$1.Assign;
|
|
1106
|
+
var assign$1 = ActionTypes$1.Assign;
|
|
1020
1107
|
ActionTypes$1.After;
|
|
1021
1108
|
ActionTypes$1.DoneState;
|
|
1022
|
-
var log = ActionTypes$1.Log;
|
|
1109
|
+
var log$1 = ActionTypes$1.Log;
|
|
1023
1110
|
var init = ActionTypes$1.Init;
|
|
1024
1111
|
var invoke = ActionTypes$1.Invoke;
|
|
1025
1112
|
ActionTypes$1.ErrorExecution;
|
|
@@ -1181,6 +1268,71 @@ function resolveSend(action, ctx, _event, delaysMap) {
|
|
|
1181
1268
|
delay: resolvedDelay
|
|
1182
1269
|
});
|
|
1183
1270
|
}
|
|
1271
|
+
/**
|
|
1272
|
+
* Sends an event to this machine's parent.
|
|
1273
|
+
*
|
|
1274
|
+
* @param event The event to send to the parent machine.
|
|
1275
|
+
* @param options Options to pass into the send event.
|
|
1276
|
+
*/
|
|
1277
|
+
|
|
1278
|
+
|
|
1279
|
+
function sendParent(event, options) {
|
|
1280
|
+
return send(event, __assign(__assign({}, options), {
|
|
1281
|
+
to: SpecialTargets.Parent
|
|
1282
|
+
}));
|
|
1283
|
+
}
|
|
1284
|
+
/**
|
|
1285
|
+
* Sends an update event to this machine's parent.
|
|
1286
|
+
*/
|
|
1287
|
+
|
|
1288
|
+
|
|
1289
|
+
function sendUpdate() {
|
|
1290
|
+
return sendParent(update);
|
|
1291
|
+
}
|
|
1292
|
+
/**
|
|
1293
|
+
* Sends an event back to the sender of the original event.
|
|
1294
|
+
*
|
|
1295
|
+
* @param event The event to send back to the sender
|
|
1296
|
+
* @param options Options to pass into the send event
|
|
1297
|
+
*/
|
|
1298
|
+
|
|
1299
|
+
|
|
1300
|
+
function respond(event, options) {
|
|
1301
|
+
return send(event, __assign(__assign({}, options), {
|
|
1302
|
+
to: function (_, __, _a) {
|
|
1303
|
+
var _event = _a._event;
|
|
1304
|
+
return _event.origin; // TODO: handle when _event.origin is undefined
|
|
1305
|
+
}
|
|
1306
|
+
}));
|
|
1307
|
+
}
|
|
1308
|
+
|
|
1309
|
+
var defaultLogExpr = function (context, event) {
|
|
1310
|
+
return {
|
|
1311
|
+
context: context,
|
|
1312
|
+
event: event
|
|
1313
|
+
};
|
|
1314
|
+
};
|
|
1315
|
+
/**
|
|
1316
|
+
*
|
|
1317
|
+
* @param expr The expression function to evaluate which will be logged.
|
|
1318
|
+
* Takes in 2 arguments:
|
|
1319
|
+
* - `ctx` - the current state context
|
|
1320
|
+
* - `event` - the event that caused this action to be executed.
|
|
1321
|
+
* @param label The label to give to the logged expression.
|
|
1322
|
+
*/
|
|
1323
|
+
|
|
1324
|
+
|
|
1325
|
+
function log(expr, label) {
|
|
1326
|
+
if (expr === void 0) {
|
|
1327
|
+
expr = defaultLogExpr;
|
|
1328
|
+
}
|
|
1329
|
+
|
|
1330
|
+
return {
|
|
1331
|
+
type: log$1,
|
|
1332
|
+
label: label,
|
|
1333
|
+
expr: expr
|
|
1334
|
+
};
|
|
1335
|
+
}
|
|
1184
1336
|
|
|
1185
1337
|
var resolveLog = function (action, ctx, _event) {
|
|
1186
1338
|
return __assign(__assign({}, action), {
|
|
@@ -1234,6 +1386,19 @@ function stop(activity) {
|
|
|
1234
1386
|
exec: undefined
|
|
1235
1387
|
};
|
|
1236
1388
|
}
|
|
1389
|
+
/**
|
|
1390
|
+
* Updates the current context of the machine.
|
|
1391
|
+
*
|
|
1392
|
+
* @param assignment An object that represents the partial context to update.
|
|
1393
|
+
*/
|
|
1394
|
+
|
|
1395
|
+
|
|
1396
|
+
var assign = function (assignment) {
|
|
1397
|
+
return {
|
|
1398
|
+
type: assign$1,
|
|
1399
|
+
assignment: assignment
|
|
1400
|
+
};
|
|
1401
|
+
};
|
|
1237
1402
|
/**
|
|
1238
1403
|
* Returns an event type that represents an implicit event that
|
|
1239
1404
|
* is sent after the specified `delay`.
|
|
@@ -1306,6 +1471,40 @@ function error(id, data) {
|
|
|
1306
1471
|
};
|
|
1307
1472
|
|
|
1308
1473
|
return eventObject;
|
|
1474
|
+
}
|
|
1475
|
+
/**
|
|
1476
|
+
* Forwards (sends) an event to a specified service.
|
|
1477
|
+
*
|
|
1478
|
+
* @param target The target service to forward the event to.
|
|
1479
|
+
* @param options Options to pass into the send action creator.
|
|
1480
|
+
*/
|
|
1481
|
+
|
|
1482
|
+
|
|
1483
|
+
function forwardTo(target, options) {
|
|
1484
|
+
return send(function (_, event) {
|
|
1485
|
+
return event;
|
|
1486
|
+
}, __assign(__assign({}, options), {
|
|
1487
|
+
to: target
|
|
1488
|
+
}));
|
|
1489
|
+
}
|
|
1490
|
+
/**
|
|
1491
|
+
* Escalates an error by sending it as an event to this machine's parent.
|
|
1492
|
+
*
|
|
1493
|
+
* @param errorData The error data to send, or the expression function that
|
|
1494
|
+
* takes in the `context`, `event`, and `meta`, and returns the error data to send.
|
|
1495
|
+
* @param options Options to pass into the send action creator.
|
|
1496
|
+
*/
|
|
1497
|
+
|
|
1498
|
+
|
|
1499
|
+
function escalate(errorData, options) {
|
|
1500
|
+
return sendParent(function (context, event, meta) {
|
|
1501
|
+
return {
|
|
1502
|
+
type: error$1,
|
|
1503
|
+
data: isFunction$4(errorData) ? errorData(context, event, meta) : errorData
|
|
1504
|
+
};
|
|
1505
|
+
}, __assign(__assign({}, options), {
|
|
1506
|
+
to: SpecialTargets.Parent
|
|
1507
|
+
}));
|
|
1309
1508
|
}var isLeafNode = function (stateNode) {
|
|
1310
1509
|
return stateNode.type === 'atomic' || stateNode.type === 'final';
|
|
1311
1510
|
};
|
|
@@ -1776,7 +1975,7 @@ function () {
|
|
|
1776
1975
|
};
|
|
1777
1976
|
|
|
1778
1977
|
return State;
|
|
1779
|
-
}();function createNullActor(id) {
|
|
1978
|
+
}();function createNullActor$1(id) {
|
|
1780
1979
|
return {
|
|
1781
1980
|
id: id,
|
|
1782
1981
|
send: function () {
|
|
@@ -1805,7 +2004,7 @@ function () {
|
|
|
1805
2004
|
|
|
1806
2005
|
|
|
1807
2006
|
function createInvocableActor(invokeDefinition) {
|
|
1808
|
-
var tempActor = createNullActor(invokeDefinition.id);
|
|
2007
|
+
var tempActor = createNullActor$1(invokeDefinition.id);
|
|
1809
2008
|
tempActor.meta = invokeDefinition;
|
|
1810
2009
|
return tempActor;
|
|
1811
2010
|
}
|
|
@@ -2686,7 +2885,7 @@ function () {
|
|
|
2686
2885
|
}
|
|
2687
2886
|
|
|
2688
2887
|
var _b = __read(partition$1(actions, function (action) {
|
|
2689
|
-
return action.type === assign;
|
|
2888
|
+
return action.type === assign$1;
|
|
2690
2889
|
}), 2),
|
|
2691
2890
|
assignActions = _b[0],
|
|
2692
2891
|
otherActions = _b[1];
|
|
@@ -2708,7 +2907,7 @@ function () {
|
|
|
2708
2907
|
|
|
2709
2908
|
return sendAction;
|
|
2710
2909
|
|
|
2711
|
-
case log:
|
|
2910
|
+
case log$1:
|
|
2712
2911
|
return resolveLog(actionObject, updatedContext, _event);
|
|
2713
2912
|
|
|
2714
2913
|
case pure:
|
|
@@ -3374,7 +3573,16 @@ function () {
|
|
|
3374
3573
|
};
|
|
3375
3574
|
|
|
3376
3575
|
return StateNode;
|
|
3377
|
-
}();function
|
|
3576
|
+
}();function Machine(config, options, initialContext) {
|
|
3577
|
+
if (initialContext === void 0) {
|
|
3578
|
+
initialContext = config.context;
|
|
3579
|
+
}
|
|
3580
|
+
|
|
3581
|
+
var resolvedInitialContext = typeof initialContext === 'function' ? initialContext() : initialContext;
|
|
3582
|
+
return new StateNode(config, options, resolvedInitialContext);
|
|
3583
|
+
}
|
|
3584
|
+
|
|
3585
|
+
function createMachine(config, options) {
|
|
3378
3586
|
var resolvedInitialContext = typeof config.context === 'function' ? config.context() : config.context;
|
|
3379
3587
|
return new StateNode(config, options, resolvedInitialContext);
|
|
3380
3588
|
}var defaultOptions = {
|
|
@@ -3469,7 +3677,27 @@ var registry = {
|
|
|
3469
3677
|
free: function (id) {
|
|
3470
3678
|
children.delete(id);
|
|
3471
3679
|
}
|
|
3472
|
-
};
|
|
3680
|
+
};function getDevTools() {
|
|
3681
|
+
var w = window;
|
|
3682
|
+
|
|
3683
|
+
if (!!w.__xstate__) {
|
|
3684
|
+
return w.__xstate__;
|
|
3685
|
+
}
|
|
3686
|
+
|
|
3687
|
+
return undefined;
|
|
3688
|
+
}
|
|
3689
|
+
|
|
3690
|
+
function registerService(service) {
|
|
3691
|
+
if (IS_PRODUCTION || typeof window === 'undefined') {
|
|
3692
|
+
return;
|
|
3693
|
+
}
|
|
3694
|
+
|
|
3695
|
+
var devTools = getDevTools();
|
|
3696
|
+
|
|
3697
|
+
if (devTools) {
|
|
3698
|
+
devTools.register(service);
|
|
3699
|
+
}
|
|
3700
|
+
}var DEFAULT_SPAWN_OPTIONS = {
|
|
3473
3701
|
sync: false,
|
|
3474
3702
|
autoForward: false
|
|
3475
3703
|
};
|
|
@@ -3641,6 +3869,9 @@ function () {
|
|
|
3641
3869
|
});
|
|
3642
3870
|
Object.defineProperty(Interpreter.prototype, "state", {
|
|
3643
3871
|
get: function () {
|
|
3872
|
+
if (!IS_PRODUCTION) {
|
|
3873
|
+
warn(this._status !== InterpreterStatus.NotStarted, "Attempted to read state from uninitialized service '" + this.id + "'. Make sure the service is started first.");
|
|
3874
|
+
}
|
|
3644
3875
|
|
|
3645
3876
|
return this._state;
|
|
3646
3877
|
},
|
|
@@ -4044,7 +4275,12 @@ function () {
|
|
|
4044
4275
|
Interpreter.prototype.batch = function (events) {
|
|
4045
4276
|
var _this = this;
|
|
4046
4277
|
|
|
4047
|
-
if (this._status === InterpreterStatus.NotStarted && this.options.deferEvents)
|
|
4278
|
+
if (this._status === InterpreterStatus.NotStarted && this.options.deferEvents) {
|
|
4279
|
+
// tslint:disable-next-line:no-console
|
|
4280
|
+
if (!IS_PRODUCTION) {
|
|
4281
|
+
warn(false, events.length + " event(s) were sent to uninitialized service \"" + this.machine.id + "\" and are deferred. Make sure .start() is called for this service.\nEvent: " + JSON.stringify(event));
|
|
4282
|
+
}
|
|
4283
|
+
} else if (this._status !== InterpreterStatus.Running) {
|
|
4048
4284
|
throw new Error( // tslint:disable-next-line:max-line-length
|
|
4049
4285
|
events.length + " event(s) were sent to uninitialized service \"" + this.machine.id + "\". Make sure .start() is called for this service, or set { deferEvents: true } in the service options.");
|
|
4050
4286
|
}
|
|
@@ -4236,9 +4472,18 @@ function () {
|
|
|
4236
4472
|
var id = activity.id,
|
|
4237
4473
|
data = activity.data;
|
|
4238
4474
|
|
|
4475
|
+
if (!IS_PRODUCTION) {
|
|
4476
|
+
warn(!('forward' in activity), // tslint:disable-next-line:max-line-length
|
|
4477
|
+
"`forward` property is deprecated (found in invocation of '" + activity.src + "' in in machine '" + this.machine.id + "'). " + "Please use `autoForward` instead.");
|
|
4478
|
+
}
|
|
4479
|
+
|
|
4239
4480
|
var autoForward = 'autoForward' in activity ? activity.autoForward : !!activity.forward;
|
|
4240
4481
|
|
|
4241
4482
|
if (!serviceCreator) {
|
|
4483
|
+
// tslint:disable-next-line:no-console
|
|
4484
|
+
if (!IS_PRODUCTION) {
|
|
4485
|
+
warn(false, "No service found for invocation '" + activity.src + "' in machine '" + this.machine.id + "'.");
|
|
4486
|
+
}
|
|
4242
4487
|
|
|
4243
4488
|
return;
|
|
4244
4489
|
}
|
|
@@ -4271,7 +4516,7 @@ function () {
|
|
|
4271
4516
|
break;
|
|
4272
4517
|
}
|
|
4273
4518
|
|
|
4274
|
-
case log:
|
|
4519
|
+
case log$1:
|
|
4275
4520
|
var label = action.label,
|
|
4276
4521
|
value = action.value;
|
|
4277
4522
|
|
|
@@ -4281,6 +4526,13 @@ function () {
|
|
|
4281
4526
|
this.logger(value);
|
|
4282
4527
|
}
|
|
4283
4528
|
|
|
4529
|
+
break;
|
|
4530
|
+
|
|
4531
|
+
default:
|
|
4532
|
+
if (!IS_PRODUCTION) {
|
|
4533
|
+
warn(false, "No implementation found for action type '" + action.type + "'");
|
|
4534
|
+
}
|
|
4535
|
+
|
|
4284
4536
|
break;
|
|
4285
4537
|
}
|
|
4286
4538
|
|
|
@@ -4379,6 +4631,7 @@ function () {
|
|
|
4379
4631
|
origin: id
|
|
4380
4632
|
}));
|
|
4381
4633
|
} catch (error) {
|
|
4634
|
+
reportUnhandledExceptionOnInvocation(errorData, error, id);
|
|
4382
4635
|
|
|
4383
4636
|
if (_this.devTools) {
|
|
4384
4637
|
_this.devTools.send(errorEvent, _this.state);
|
|
@@ -4552,6 +4805,9 @@ function () {
|
|
|
4552
4805
|
var implementation = this.machine.options && this.machine.options.activities ? this.machine.options.activities[activity.type] : undefined;
|
|
4553
4806
|
|
|
4554
4807
|
if (!implementation) {
|
|
4808
|
+
if (!IS_PRODUCTION) {
|
|
4809
|
+
warn(false, "No implementation found for activity '" + activity.type + "'");
|
|
4810
|
+
} // tslint:disable-next-line:no-console
|
|
4555
4811
|
|
|
4556
4812
|
|
|
4557
4813
|
return;
|
|
@@ -4606,6 +4862,9 @@ function () {
|
|
|
4606
4862
|
}), this.machine);
|
|
4607
4863
|
this.devTools.init(this.state);
|
|
4608
4864
|
} // add XState-specific dev tooling hook
|
|
4865
|
+
|
|
4866
|
+
|
|
4867
|
+
registerService(this);
|
|
4609
4868
|
}
|
|
4610
4869
|
};
|
|
4611
4870
|
|
|
@@ -4648,6 +4907,57 @@ function () {
|
|
|
4648
4907
|
Interpreter.interpret = interpret;
|
|
4649
4908
|
return Interpreter;
|
|
4650
4909
|
}();
|
|
4910
|
+
|
|
4911
|
+
var createNullActor = function (name) {
|
|
4912
|
+
if (name === void 0) {
|
|
4913
|
+
name = 'null';
|
|
4914
|
+
}
|
|
4915
|
+
|
|
4916
|
+
return {
|
|
4917
|
+
id: name,
|
|
4918
|
+
send: function () {
|
|
4919
|
+
return void 0;
|
|
4920
|
+
},
|
|
4921
|
+
subscribe: function () {
|
|
4922
|
+
// tslint:disable-next-line:no-empty
|
|
4923
|
+
return {
|
|
4924
|
+
unsubscribe: function () {}
|
|
4925
|
+
};
|
|
4926
|
+
},
|
|
4927
|
+
toJSON: function () {
|
|
4928
|
+
return {
|
|
4929
|
+
id: name
|
|
4930
|
+
};
|
|
4931
|
+
}
|
|
4932
|
+
};
|
|
4933
|
+
};
|
|
4934
|
+
|
|
4935
|
+
var resolveSpawnOptions = function (nameOrOptions) {
|
|
4936
|
+
if (isString$4(nameOrOptions)) {
|
|
4937
|
+
return __assign(__assign({}, DEFAULT_SPAWN_OPTIONS), {
|
|
4938
|
+
name: nameOrOptions
|
|
4939
|
+
});
|
|
4940
|
+
}
|
|
4941
|
+
|
|
4942
|
+
return __assign(__assign(__assign({}, DEFAULT_SPAWN_OPTIONS), {
|
|
4943
|
+
name: uniqueId()
|
|
4944
|
+
}), nameOrOptions);
|
|
4945
|
+
};
|
|
4946
|
+
|
|
4947
|
+
function spawn(entity, nameOrOptions) {
|
|
4948
|
+
var resolvedOptions = resolveSpawnOptions(nameOrOptions);
|
|
4949
|
+
return withServiceScope(undefined, function (service) {
|
|
4950
|
+
if (!IS_PRODUCTION) {
|
|
4951
|
+
warn(!!service, "Attempted to spawn an Actor (ID: \"" + (isMachine(entity) ? entity.id : 'undefined') + "\") outside of a service. This will have no effect.");
|
|
4952
|
+
}
|
|
4953
|
+
|
|
4954
|
+
if (service) {
|
|
4955
|
+
return service.spawn(entity, resolvedOptions.name, resolvedOptions);
|
|
4956
|
+
} else {
|
|
4957
|
+
return createNullActor(resolvedOptions.name);
|
|
4958
|
+
}
|
|
4959
|
+
});
|
|
4960
|
+
}
|
|
4651
4961
|
/**
|
|
4652
4962
|
* Creates a new Interpreter instance for the given machine with the provided options, if any.
|
|
4653
4963
|
*
|
|
@@ -4659,7 +4969,50 @@ function () {
|
|
|
4659
4969
|
function interpret(machine, options) {
|
|
4660
4970
|
var interpreter = new Interpreter(machine, options);
|
|
4661
4971
|
return interpreter;
|
|
4662
|
-
}
|
|
4972
|
+
}function matchState(state, patterns, defaultValue) {
|
|
4973
|
+
var e_1, _a;
|
|
4974
|
+
|
|
4975
|
+
var resolvedState = State.from(state, state instanceof State ? state.context : undefined);
|
|
4976
|
+
|
|
4977
|
+
try {
|
|
4978
|
+
for (var patterns_1 = __values(patterns), patterns_1_1 = patterns_1.next(); !patterns_1_1.done; patterns_1_1 = patterns_1.next()) {
|
|
4979
|
+
var _b = __read(patterns_1_1.value, 2),
|
|
4980
|
+
stateValue = _b[0],
|
|
4981
|
+
getValue = _b[1];
|
|
4982
|
+
|
|
4983
|
+
if (resolvedState.matches(stateValue)) {
|
|
4984
|
+
return getValue(resolvedState);
|
|
4985
|
+
}
|
|
4986
|
+
}
|
|
4987
|
+
} catch (e_1_1) {
|
|
4988
|
+
e_1 = {
|
|
4989
|
+
error: e_1_1
|
|
4990
|
+
};
|
|
4991
|
+
} finally {
|
|
4992
|
+
try {
|
|
4993
|
+
if (patterns_1_1 && !patterns_1_1.done && (_a = patterns_1.return)) _a.call(patterns_1);
|
|
4994
|
+
} finally {
|
|
4995
|
+
if (e_1) throw e_1.error;
|
|
4996
|
+
}
|
|
4997
|
+
}
|
|
4998
|
+
|
|
4999
|
+
return defaultValue(resolvedState);
|
|
5000
|
+
}var actions = {
|
|
5001
|
+
raise: raise,
|
|
5002
|
+
send: send,
|
|
5003
|
+
sendParent: sendParent,
|
|
5004
|
+
sendUpdate: sendUpdate,
|
|
5005
|
+
log: log,
|
|
5006
|
+
cancel: cancel,
|
|
5007
|
+
start: start,
|
|
5008
|
+
stop: stop,
|
|
5009
|
+
assign: assign,
|
|
5010
|
+
after: after,
|
|
5011
|
+
done: done,
|
|
5012
|
+
respond: respond,
|
|
5013
|
+
forwardTo: forwardTo,
|
|
5014
|
+
escalate: escalate
|
|
5015
|
+
};var index$3=/*#__PURE__*/Object.freeze({__proto__:null,actions:actions,matchesState:matchesState,mapState:mapState,get ActionTypes(){return ActionTypes$1},get SpecialTargets(){return SpecialTargets},assign:assign,doneInvoke:doneInvoke,forwardTo:forwardTo,send:send,sendParent:sendParent,sendUpdate:sendUpdate,State:State,StateNode:StateNode,Machine:Machine,createMachine:createMachine,Interpreter:Interpreter,interpret:interpret,spawn:spawn,matchState:matchState});// threejs.org/license
|
|
4663
5016
|
const REVISION = '126';
|
|
4664
5017
|
const MOUSE = { LEFT: 0, MIDDLE: 1, RIGHT: 2, ROTATE: 0, DOLLY: 1, PAN: 2 };
|
|
4665
5018
|
const TOUCH = { ROTATE: 0, PAN: 1, DOLLY_PAN: 2, DOLLY_ROTATE: 3 };
|
|
@@ -53603,7 +53956,6 @@ var BOUNDINGBOX_NOT_AVAILABLE = "".concat(PREFIX, " Selected element does not ha
|
|
|
53603
53956
|
var INVALID_EMITTER_ID = "".concat(PREFIX, " The selected emitter id is not valid.");
|
|
53604
53957
|
var EMITTER_NOT_FOUND = "".concat(PREFIX, " The requested emitter could not be found");
|
|
53605
53958
|
var FEATURE_NOT_SUPPORTED = "".concat(PREFIX, " The following features are not supported: ");
|
|
53606
|
-
var METHOD_NOT_SUPPORTED = "".concat(PREFIX, " This method is not supported.");
|
|
53607
53959
|
var ANIMATION_NOT_FOUND = "".concat(PREFIX, " Required animation can't be found.");
|
|
53608
53960
|
var ANIMATION_HANDLER_NOT_FOUND = "".concat(PREFIX, " AnimationHander hasn't been defined yet.");
|
|
53609
53961
|
var ELEMENT_NOT_SET$1 = "".concat(PREFIX, " Body hasn't been defined yet.");
|
|
@@ -54729,7 +55081,8 @@ var Universe$1 = new Universe();var generateUUID = function generateUUID() {
|
|
|
54729
55081
|
};
|
|
54730
55082
|
var generateRandomName = function generateRandomName(prefix) {
|
|
54731
55083
|
return "".concat(prefix, "_").concat(generateUUID());
|
|
54732
|
-
};var uuid$1=/*#__PURE__*/Object.freeze({__proto__:null,generateUUID:generateUUID,generateRandomName:generateRandomName});var
|
|
55084
|
+
};var uuid$1=/*#__PURE__*/Object.freeze({__proto__:null,generateUUID:generateUUID,generateRandomName:generateRandomName});var ALMOST_ZERO = 0.00001;
|
|
55085
|
+
var UP$1 = 'UP';
|
|
54733
55086
|
var DOWN$1 = 'DOWN';
|
|
54734
55087
|
var LEFT = 'LEFT';
|
|
54735
55088
|
var RIGHT = 'RIGHT';
|
|
@@ -54830,7 +55183,7 @@ var EMPTY$2 = '';
|
|
|
54830
55183
|
var QUERY_START = '?';
|
|
54831
55184
|
var DEFAULT_SELECTOR = '#gameContainer';
|
|
54832
55185
|
var BEFORE_UNLOAD = 'beforeunload';
|
|
54833
|
-
var HASH_CHANGE = 'hashchange';var lib_constants=/*#__PURE__*/Object.freeze({__proto__:null,UP:UP$1,DOWN:DOWN$1,LEFT:LEFT,RIGHT:RIGHT,FRONT:FRONT,BACK:BACK,VECTOR_UP:VECTOR_UP,VECTOR_DOWN:VECTOR_DOWN,VECTOR_LEFT:VECTOR_LEFT,VECTOR_RIGHT:VECTOR_RIGHT,VECTOR_FRONT:VECTOR_FRONT,VECTOR_BACK:VECTOR_BACK,ORIGIN:ORIGIN,ZERO_QUATERNION:ZERO_QUATERNION,MATERIALS:MATERIALS,TEXTURES:TEXTURES,EFFECTS:EFFECTS,COLLISION_EVENT:COLLISION_EVENT,COLORS:COLORS,ASSETS_TYPES:ASSETS_TYPES,OUTPUT_ENCODINGS:OUTPUT_ENCODINGS,DEFAULT_OUTPUT_ENCODING:DEFAULT_OUTPUT_ENCODING,ROOT:ROOT,DIVIDER:DIVIDER,HASH:HASH,EMPTY:EMPTY$2,QUERY_START:QUERY_START,DEFAULT_SELECTOR:DEFAULT_SELECTOR,BEFORE_UNLOAD:BEFORE_UNLOAD,HASH_CHANGE:HASH_CHANGE});var buildAssetId = function buildAssetId(name, level) {
|
|
55186
|
+
var HASH_CHANGE = 'hashchange';var lib_constants=/*#__PURE__*/Object.freeze({__proto__:null,ALMOST_ZERO:ALMOST_ZERO,UP:UP$1,DOWN:DOWN$1,LEFT:LEFT,RIGHT:RIGHT,FRONT:FRONT,BACK:BACK,VECTOR_UP:VECTOR_UP,VECTOR_DOWN:VECTOR_DOWN,VECTOR_LEFT:VECTOR_LEFT,VECTOR_RIGHT:VECTOR_RIGHT,VECTOR_FRONT:VECTOR_FRONT,VECTOR_BACK:VECTOR_BACK,ORIGIN:ORIGIN,ZERO_QUATERNION:ZERO_QUATERNION,MATERIALS:MATERIALS,TEXTURES:TEXTURES,EFFECTS:EFFECTS,COLLISION_EVENT:COLLISION_EVENT,COLORS:COLORS,ASSETS_TYPES:ASSETS_TYPES,OUTPUT_ENCODINGS:OUTPUT_ENCODINGS,DEFAULT_OUTPUT_ENCODING:DEFAULT_OUTPUT_ENCODING,ROOT:ROOT,DIVIDER:DIVIDER,HASH:HASH,EMPTY:EMPTY$2,QUERY_START:QUERY_START,DEFAULT_SELECTOR:DEFAULT_SELECTOR,BEFORE_UNLOAD:BEFORE_UNLOAD,HASH_CHANGE:HASH_CHANGE});var buildAssetId = function buildAssetId(name, level) {
|
|
54834
55187
|
return level ? "".concat(level, "_").concat(name) : name;
|
|
54835
55188
|
};
|
|
54836
55189
|
var isLevelName = function isLevelName(level) {
|
|
@@ -55446,7 +55799,7 @@ var convertAmmoVector = function convertAmmoVector(_ref2) {
|
|
|
55446
55799
|
};
|
|
55447
55800
|
};var utils=/*#__PURE__*/Object.freeze({__proto__:null,DEFAULT_DESCRIPTION:DEFAULT_DESCRIPTION$1,mapColliderTypeToAddEvent:mapColliderTypeToAddEvent$1,extractBoundingBox:extractBoundingBox,extractBiggestBoundingBox:extractBiggestBoundingBox,extractBoundingSphere:extractBoundingSphere,extractBiggestBoundingSphere:extractBiggestBoundingSphere,parseBoundingBoxSize:parseBoundingBoxSize,extractPositionAndQuaternion:extractPositionAndQuaternion$1,extractBoxDescription:extractBoxDescription,extractSphereDescription:extractSphereDescription,getBoxDescriptionForElement:getBoxDescriptionForElement$1,getSphereDescriptionForElement:getSphereDescriptionForElement,mapColliderTypeToDescription:mapColliderTypeToDescription$1,iterateGeometries:iterateGeometries$1,convertAmmoVector:convertAmmoVector});var getHostURL = function getHostURL() {
|
|
55448
55801
|
return "".concat(document.location.protocol, "//").concat(document.location.host);
|
|
55449
|
-
};var _excluded$
|
|
55802
|
+
};var _excluded$a = ["uuid"];
|
|
55450
55803
|
var COLLIDER_TYPES = COLLIDER_TYPES$1;
|
|
55451
55804
|
var getBoxDescriptionForElement = getBoxDescriptionForElement$1,
|
|
55452
55805
|
extractPositionAndQuaternion = extractPositionAndQuaternion$1,
|
|
@@ -55520,7 +55873,7 @@ var Physics = /*#__PURE__*/function (_EventDispatcher) {
|
|
|
55520
55873
|
|
|
55521
55874
|
_defineProperty$1(_assertThisInitialized(_this), "handleBodyUpdate", function (_ref3) {
|
|
55522
55875
|
var uuid = _ref3.uuid,
|
|
55523
|
-
data = _objectWithoutProperties(_ref3, _excluded$
|
|
55876
|
+
data = _objectWithoutProperties(_ref3, _excluded$a);
|
|
55524
55877
|
|
|
55525
55878
|
var element = Universe$1.getByUUID(uuid);
|
|
55526
55879
|
|
|
@@ -55902,9 +56255,8 @@ var Physics$1 = new Physics();var ENTITY_TYPES = {
|
|
|
55902
56255
|
},
|
|
55903
56256
|
AUDIO: {
|
|
55904
56257
|
DEFAULT: 'AUDIO.DEFAULT',
|
|
55905
|
-
AMBIENT: 'AUDIO.AMBIENT',
|
|
55906
56258
|
DIRECTIONAL: 'AUDIO.DIRECTIONAL',
|
|
55907
|
-
|
|
56259
|
+
AMBIENT: 'AUDIO.AMBIENT'
|
|
55908
56260
|
},
|
|
55909
56261
|
MODEL: 'MODEL',
|
|
55910
56262
|
SPRITE: 'SPRITE',
|
|
@@ -55928,6 +56280,9 @@ var ENTITY_EVENTS = {
|
|
|
55928
56280
|
ANIMATION: {
|
|
55929
56281
|
LOOP: 'LOOP',
|
|
55930
56282
|
FINISHED: 'FINISHED'
|
|
56283
|
+
},
|
|
56284
|
+
AUDIO: {
|
|
56285
|
+
ENDED: 'ended'
|
|
55931
56286
|
}
|
|
55932
56287
|
};
|
|
55933
56288
|
var DEFAULT_TAG = 'all';var Scene = /*#__PURE__*/function () {
|
|
@@ -57396,7 +57751,7 @@ function applyMiddleware() {
|
|
|
57396
57751
|
|
|
57397
57752
|
var thunk = createThunkMiddleware();
|
|
57398
57753
|
thunk.withExtraArgument = createThunkMiddleware;var name = "mage-engine";
|
|
57399
|
-
var version$1 = "3.
|
|
57754
|
+
var version$1 = "3.21.1";
|
|
57400
57755
|
var description = "A WebGL Javascript Game Engine, built on top of THREE.js and many other libraries.";
|
|
57401
57756
|
var main = "dist/mage.js";
|
|
57402
57757
|
var author$1 = {
|
|
@@ -58665,7 +59020,7 @@ if (!self.fetch) {
|
|
|
58665
59020
|
self.Headers = Headers;
|
|
58666
59021
|
self.Request = Request;
|
|
58667
59022
|
self.Response = Response;
|
|
58668
|
-
}var _excluded$
|
|
59023
|
+
}var _excluded$9 = ["wheels", "accelerationKey", "brakingKey", "rightKey", "leftKey", "debug", "autostart"];
|
|
58669
59024
|
|
|
58670
59025
|
var BaseCar = /*#__PURE__*/function (_BaseScript) {
|
|
58671
59026
|
_inherits(BaseCar, _BaseScript);
|
|
@@ -58693,7 +59048,7 @@ var BaseCar = /*#__PURE__*/function (_BaseScript) {
|
|
|
58693
59048
|
options.debug;
|
|
58694
59049
|
var _options$autostart = options.autostart,
|
|
58695
59050
|
autostart = _options$autostart === void 0 ? true : _options$autostart,
|
|
58696
|
-
physicsOptions = _objectWithoutProperties(options, _excluded$
|
|
59051
|
+
physicsOptions = _objectWithoutProperties(options, _excluded$9);
|
|
58697
59052
|
|
|
58698
59053
|
this.car = element;
|
|
58699
59054
|
this.wheels = wheels;
|
|
@@ -59540,6 +59895,17 @@ var hasMaterial = function hasMaterial(mesh) {
|
|
|
59540
59895
|
var hasGeometry = function hasGeometry(mesh) {
|
|
59541
59896
|
return Boolean(mesh.geometry);
|
|
59542
59897
|
};
|
|
59898
|
+
var applyMaterialChange = function applyMaterialChange(elementBody, changeCallback) {
|
|
59899
|
+
if (hasMaterial(elementBody)) {
|
|
59900
|
+
processMaterial(elementBody.material, changeCallback);
|
|
59901
|
+
} else {
|
|
59902
|
+
elementBody.traverse(function (child) {
|
|
59903
|
+
if (hasMaterial(child)) {
|
|
59904
|
+
processMaterial(child.material, changeCallback);
|
|
59905
|
+
}
|
|
59906
|
+
});
|
|
59907
|
+
}
|
|
59908
|
+
};
|
|
59543
59909
|
var processMaterial = function processMaterial(material, callback) {
|
|
59544
59910
|
return Array.isArray(material) ? material.map(callback) : callback(material);
|
|
59545
59911
|
};
|
|
@@ -59627,7 +59993,7 @@ var EASING_EVENTS = {
|
|
|
59627
59993
|
UPDATE: 'update',
|
|
59628
59994
|
COMPLETE: 'complete'
|
|
59629
59995
|
};
|
|
59630
|
-
var FUNCTIONS = _objectSpread2$1({},
|
|
59996
|
+
var FUNCTIONS = _objectSpread2$1({}, between.Easing);
|
|
59631
59997
|
var tweenTo = function tweenTo(origin, target) {
|
|
59632
59998
|
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
59633
59999
|
return new Promise(function (resolve) {
|
|
@@ -59642,7 +60008,7 @@ var tweenTo = function tweenTo(origin, target) {
|
|
|
59642
60008
|
} : _options$onUpdate,
|
|
59643
60009
|
_options$repeat = options.repeat,
|
|
59644
60010
|
repeat = _options$repeat === void 0 ? undefined : _options$repeat;
|
|
59645
|
-
var tween = new
|
|
60011
|
+
var tween = new between(origin, target).time(time).easing(easing).on(EASING_EVENTS.UPDATE, onUpdate);
|
|
59646
60012
|
var infinite = loop && !repeat;
|
|
59647
60013
|
|
|
59648
60014
|
var onComplete = function onComplete() {
|
|
@@ -59668,16 +60034,16 @@ var tweenTo = function tweenTo(origin, target) {
|
|
|
59668
60034
|
function Entity() {
|
|
59669
60035
|
var _this;
|
|
59670
60036
|
|
|
59671
|
-
var
|
|
59672
|
-
_ref$serializable = _ref.serializable,
|
|
59673
|
-
serializable = _ref$serializable === void 0 ? true : _ref$serializable,
|
|
59674
|
-
_ref$tag = _ref.tag,
|
|
59675
|
-
tag = _ref$tag === void 0 ? '' : _ref$tag,
|
|
59676
|
-
_ref$tags = _ref.tags,
|
|
59677
|
-
tags = _ref$tags === void 0 ? [] : _ref$tags;
|
|
60037
|
+
var _options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
59678
60038
|
|
|
59679
60039
|
_classCallCheck(this, Entity);
|
|
59680
60040
|
|
|
60041
|
+
var _options$serializable = _options.serializable,
|
|
60042
|
+
serializable = _options$serializable === void 0 ? true : _options$serializable,
|
|
60043
|
+
_options$tag = _options.tag,
|
|
60044
|
+
tag = _options$tag === void 0 ? '' : _options$tag,
|
|
60045
|
+
_options$tags = _options.tags,
|
|
60046
|
+
tags = _options$tags === void 0 ? [] : _options$tags;
|
|
59681
60047
|
_this = _super.call(this);
|
|
59682
60048
|
|
|
59683
60049
|
_defineProperty$1(_assertThisInitialized(_this), "getBodyByName", function (name) {
|
|
@@ -59744,11 +60110,11 @@ var tweenTo = function tweenTo(origin, target) {
|
|
|
59744
60110
|
return Object.values(ENTITY_TYPES.EFFECT).includes(_this.getEntityType());
|
|
59745
60111
|
});
|
|
59746
60112
|
|
|
59747
|
-
_defineProperty$1(_assertThisInitialized(_this), "setQuaternion", function (
|
|
59748
|
-
var x =
|
|
59749
|
-
y =
|
|
59750
|
-
z =
|
|
59751
|
-
w =
|
|
60113
|
+
_defineProperty$1(_assertThisInitialized(_this), "setQuaternion", function (_ref) {
|
|
60114
|
+
var x = _ref.x,
|
|
60115
|
+
y = _ref.y,
|
|
60116
|
+
z = _ref.z,
|
|
60117
|
+
w = _ref.w;
|
|
59752
60118
|
|
|
59753
60119
|
_this.body.quaternion.set(x, y, z, w);
|
|
59754
60120
|
});
|
|
@@ -59759,6 +60125,11 @@ var tweenTo = function tweenTo(origin, target) {
|
|
|
59759
60125
|
}
|
|
59760
60126
|
});
|
|
59761
60127
|
|
|
60128
|
+
_this.options = _objectSpread2$1(_objectSpread2$1({}, _options), {}, {
|
|
60129
|
+
serializable: serializable,
|
|
60130
|
+
tag: tag,
|
|
60131
|
+
tags: tags
|
|
60132
|
+
});
|
|
59762
60133
|
_this.scripts = [];
|
|
59763
60134
|
_this.tags = [];
|
|
59764
60135
|
_this.children = [];
|
|
@@ -59827,8 +60198,8 @@ var tweenTo = function tweenTo(origin, target) {
|
|
|
59827
60198
|
}, {
|
|
59828
60199
|
key: "setBody",
|
|
59829
60200
|
value: function setBody() {
|
|
59830
|
-
var
|
|
59831
|
-
body =
|
|
60201
|
+
var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
60202
|
+
body = _ref2.body;
|
|
59832
60203
|
|
|
59833
60204
|
this.body = body;
|
|
59834
60205
|
}
|
|
@@ -59854,11 +60225,11 @@ var tweenTo = function tweenTo(origin, target) {
|
|
|
59854
60225
|
|
|
59855
60226
|
var container = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.getBody();
|
|
59856
60227
|
|
|
59857
|
-
var
|
|
59858
|
-
|
|
59859
|
-
waitForBody =
|
|
59860
|
-
|
|
59861
|
-
waitForBodyMaxRetries =
|
|
60228
|
+
var _ref3 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
|
|
60229
|
+
_ref3$waitForBody = _ref3.waitForBody,
|
|
60230
|
+
waitForBody = _ref3$waitForBody === void 0 ? 0 : _ref3$waitForBody,
|
|
60231
|
+
_ref3$waitForBodyMaxR = _ref3.waitForBodyMaxRetries,
|
|
60232
|
+
waitForBodyMaxRetries = _ref3$waitForBodyMaxR === void 0 ? 1 : _ref3$waitForBodyMaxR;
|
|
59862
60233
|
|
|
59863
60234
|
if (this.hasBody()) {
|
|
59864
60235
|
var _add = function _add(toAdd) {
|
|
@@ -60015,10 +60386,10 @@ var tweenTo = function tweenTo(origin, target) {
|
|
|
60015
60386
|
var _this4 = this;
|
|
60016
60387
|
|
|
60017
60388
|
if (this.hasScripts()) {
|
|
60018
|
-
this.scripts.forEach(function (
|
|
60019
|
-
var script =
|
|
60020
|
-
enabled =
|
|
60021
|
-
options =
|
|
60389
|
+
this.scripts.forEach(function (_ref4) {
|
|
60390
|
+
var script = _ref4.script,
|
|
60391
|
+
enabled = _ref4.enabled,
|
|
60392
|
+
options = _ref4.options;
|
|
60022
60393
|
|
|
60023
60394
|
if (enabled) {
|
|
60024
60395
|
script.start(_this4, options);
|
|
@@ -60032,9 +60403,9 @@ var tweenTo = function tweenTo(origin, target) {
|
|
|
60032
60403
|
key: "update",
|
|
60033
60404
|
value: function update(dt) {
|
|
60034
60405
|
if (this.hasScripts()) {
|
|
60035
|
-
this.scripts.forEach(function (
|
|
60036
|
-
var script =
|
|
60037
|
-
enabled =
|
|
60406
|
+
this.scripts.forEach(function (_ref5) {
|
|
60407
|
+
var script = _ref5.script,
|
|
60408
|
+
enabled = _ref5.enabled;
|
|
60038
60409
|
|
|
60039
60410
|
if (script && enabled) {
|
|
60040
60411
|
script.update(dt);
|
|
@@ -60046,9 +60417,9 @@ var tweenTo = function tweenTo(origin, target) {
|
|
|
60046
60417
|
key: "onPhysicsUpdate",
|
|
60047
60418
|
value: function onPhysicsUpdate(dt) {
|
|
60048
60419
|
if (this.hasScripts()) {
|
|
60049
|
-
this.scripts.forEach(function (
|
|
60050
|
-
var script =
|
|
60051
|
-
enabled =
|
|
60420
|
+
this.scripts.forEach(function (_ref6) {
|
|
60421
|
+
var script = _ref6.script,
|
|
60422
|
+
enabled = _ref6.enabled;
|
|
60052
60423
|
|
|
60053
60424
|
if (script && enabled) {
|
|
60054
60425
|
script.physicsUpdate(dt);
|
|
@@ -60293,13 +60664,13 @@ var tweenTo = function tweenTo(origin, target) {
|
|
|
60293
60664
|
}
|
|
60294
60665
|
}, {
|
|
60295
60666
|
key: "translate",
|
|
60296
|
-
value: function translate(
|
|
60297
|
-
var
|
|
60298
|
-
x =
|
|
60299
|
-
|
|
60300
|
-
y =
|
|
60301
|
-
|
|
60302
|
-
z =
|
|
60667
|
+
value: function translate(_ref7) {
|
|
60668
|
+
var _ref7$x = _ref7.x,
|
|
60669
|
+
x = _ref7$x === void 0 ? 0 : _ref7$x,
|
|
60670
|
+
_ref7$y = _ref7.y,
|
|
60671
|
+
y = _ref7$y === void 0 ? 0 : _ref7$y,
|
|
60672
|
+
_ref7$z = _ref7.z,
|
|
60673
|
+
z = _ref7$z === void 0 ? 0 : _ref7$z;
|
|
60303
60674
|
|
|
60304
60675
|
if (this.hasBody()) {
|
|
60305
60676
|
this.body.translateX(x);
|
|
@@ -60475,10 +60846,10 @@ var tweenTo = function tweenTo(origin, target) {
|
|
|
60475
60846
|
}, {
|
|
60476
60847
|
key: "mapScriptsToJSON",
|
|
60477
60848
|
value: function mapScriptsToJSON() {
|
|
60478
|
-
this.scripts.reduce(function (acc,
|
|
60479
|
-
var name =
|
|
60480
|
-
|
|
60481
|
-
options =
|
|
60849
|
+
this.scripts.reduce(function (acc, _ref8) {
|
|
60850
|
+
var name = _ref8.name,
|
|
60851
|
+
_ref8$options = _ref8.options,
|
|
60852
|
+
options = _ref8$options === void 0 ? {} : _ref8$options;
|
|
60482
60853
|
acc.names.push(name);
|
|
60483
60854
|
acc.options.push(options);
|
|
60484
60855
|
return acc;
|
|
@@ -60637,7 +61008,7 @@ var tweenTo = function tweenTo(origin, target) {
|
|
|
60637
61008
|
var MATERIAL_TEXTURE_MAP = (_MATERIAL_TEXTURE_MAP = {}, _defineProperty$1(_MATERIAL_TEXTURE_MAP, MATERIALS.BASIC, [TEXTURES.ALPHA, TEXTURES.AO, TEXTURES.ENV, TEXTURES.LIGHT, TEXTURES.MAP, TEXTURES.SPECULAR]), _defineProperty$1(_MATERIAL_TEXTURE_MAP, MATERIALS.LAMBERT, [TEXTURES.ALPHA, TEXTURES.AO, TEXTURES.ENV, TEXTURES.LIGHT, TEXTURES.MAP, TEXTURES.SPECULAR, TEXTURES.EMISSIVE]), _defineProperty$1(_MATERIAL_TEXTURE_MAP, MATERIALS.PHONG, [TEXTURES.ALPHA, TEXTURES.AO, TEXTURES.ENV, TEXTURES.LIGHT, TEXTURES.MAP, TEXTURES.SPECULAR, TEXTURES.EMISSIVE, TEXTURES.BUMP, TEXTURES.DISPLACEMENT, TEXTURES.NORMAL]), _defineProperty$1(_MATERIAL_TEXTURE_MAP, MATERIALS.DEPTH, [TEXTURES.ALPHA, TEXTURES.MAP, TEXTURES.DISPLACEMENT]), _defineProperty$1(_MATERIAL_TEXTURE_MAP, MATERIALS.STANDARD, [TEXTURES.ALPHA, TEXTURES.AO, TEXTURES.ENV, TEXTURES.LIGHT, TEXTURES.MAP, TEXTURES.EMISSIVE, TEXTURES.BUMP, TEXTURES.DISPLACEMENT, TEXTURES.NORMAL, TEXTURES.METALNESS, TEXTURES.ROUGHNESS]), _defineProperty$1(_MATERIAL_TEXTURE_MAP, MATERIALS.THREE_TOON, [TEXTURES.ALPHA, TEXTURES.AO, TEXTURES.BUMP, TEXTURES.DISPLACEMENT, TEXTURES.EMISSIVE, TEXTURES.GRADIENT, TEXTURES.LIGHT, TEXTURES.MAP, TEXTURES.NORMAL]), _MATERIAL_TEXTURE_MAP);
|
|
60638
61009
|
var isTextureMapAllowedForMaterial = function isTextureMapAllowedForMaterial(materialType, textureType) {
|
|
60639
61010
|
return MATERIAL_TEXTURE_MAP[materialType] && MATERIAL_TEXTURE_MAP[materialType].includes(textureType);
|
|
60640
|
-
};var _excluded$
|
|
61011
|
+
};var _excluded$8 = ["position", "quaternion"],
|
|
60641
61012
|
_excluded2 = ["applyPhysicsUpdate"],
|
|
60642
61013
|
_excluded3 = ["dt", "event"];
|
|
60643
61014
|
var COLLIDER_TAG = 'collider';
|
|
@@ -60827,7 +61198,7 @@ var Element$1 = /*#__PURE__*/function (_Entity) {
|
|
|
60827
61198
|
_defineProperty$1(_assertThisInitialized(_this), "handlePhysicsUpdate", function (_ref6) {
|
|
60828
61199
|
var position = _ref6.position,
|
|
60829
61200
|
quaternion = _ref6.quaternion,
|
|
60830
|
-
data = _objectWithoutProperties(_ref6, _excluded$
|
|
61201
|
+
data = _objectWithoutProperties(_ref6, _excluded$8);
|
|
60831
61202
|
|
|
60832
61203
|
_this.setPosition(position);
|
|
60833
61204
|
|
|
@@ -61172,18 +61543,12 @@ var Element$1 = /*#__PURE__*/function (_Entity) {
|
|
|
61172
61543
|
}, {
|
|
61173
61544
|
key: "setColor",
|
|
61174
61545
|
value: function setColor(color) {
|
|
61175
|
-
var
|
|
61546
|
+
var _setColor = function _setColor(material) {
|
|
61547
|
+
return material.color = new Color$1(color);
|
|
61548
|
+
};
|
|
61176
61549
|
|
|
61177
61550
|
if (color) {
|
|
61178
|
-
|
|
61179
|
-
this.body.material.color = new Color$1(color);
|
|
61180
|
-
} else {
|
|
61181
|
-
this.body.traverse(function (child) {
|
|
61182
|
-
if (hasMaterial(child) && !_this2.isParentOf(child)) {
|
|
61183
|
-
child.material.color = new Color$1(color);
|
|
61184
|
-
}
|
|
61185
|
-
});
|
|
61186
|
-
}
|
|
61551
|
+
applyMaterialChange(this.getBody(), _setColor);
|
|
61187
61552
|
} else {
|
|
61188
61553
|
console.warn(ELEMENT_SET_COLOR_MISSING_COLOR);
|
|
61189
61554
|
}
|
|
@@ -61229,23 +61594,15 @@ var Element$1 = /*#__PURE__*/function (_Entity) {
|
|
|
61229
61594
|
wrap = _options$wrap === void 0 ? RepeatWrapping$1 : _options$wrap;
|
|
61230
61595
|
this.recordTexture(textureId, textureType);
|
|
61231
61596
|
|
|
61232
|
-
var applyTextureTo = function applyTextureTo(
|
|
61597
|
+
var applyTextureTo = function applyTextureTo(material) {
|
|
61233
61598
|
var texture = Images$1.get(textureId);
|
|
61234
61599
|
texture.wrapS = wrap;
|
|
61235
61600
|
texture.wrapT = wrap;
|
|
61236
61601
|
texture.repeat.set(repeat.x, repeat.y);
|
|
61237
|
-
|
|
61602
|
+
material[textureType] = texture;
|
|
61238
61603
|
};
|
|
61239
61604
|
|
|
61240
|
-
|
|
61241
|
-
applyTextureTo(this.getBody());
|
|
61242
|
-
} else {
|
|
61243
|
-
this.getBody().traverse(function (child) {
|
|
61244
|
-
if (hasMaterial(child)) {
|
|
61245
|
-
applyTextureTo(child);
|
|
61246
|
-
}
|
|
61247
|
-
});
|
|
61248
|
-
}
|
|
61605
|
+
applyMaterialChange(this.getBody(), applyTextureTo);
|
|
61249
61606
|
}
|
|
61250
61607
|
}
|
|
61251
61608
|
}, {
|
|
@@ -61295,64 +61652,58 @@ var Element$1 = /*#__PURE__*/function (_Entity) {
|
|
|
61295
61652
|
}, {
|
|
61296
61653
|
key: "setOpacity",
|
|
61297
61654
|
value: function setOpacity() {
|
|
61298
|
-
var
|
|
61655
|
+
var _this2 = this;
|
|
61299
61656
|
|
|
61300
61657
|
var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1.0;
|
|
61301
61658
|
var opacity = clamp(value, 0, 1);
|
|
61302
61659
|
this.opacity = opacity;
|
|
61303
61660
|
|
|
61304
|
-
|
|
61305
|
-
|
|
61306
|
-
|
|
61307
|
-
}
|
|
61308
|
-
|
|
61309
|
-
|
|
61310
|
-
child.material.transparent = true;
|
|
61311
|
-
child.material.opacity = opacity;
|
|
61312
|
-
}
|
|
61313
|
-
});
|
|
61314
|
-
}
|
|
61661
|
+
var _setOpacity = function _setOpacity(material) {
|
|
61662
|
+
material.transparent = true;
|
|
61663
|
+
material.opacity = _this2.opacity;
|
|
61664
|
+
};
|
|
61665
|
+
|
|
61666
|
+
applyMaterialChange(this.getBody(), _setOpacity);
|
|
61315
61667
|
}
|
|
61316
61668
|
}, {
|
|
61317
61669
|
key: "fadeTo",
|
|
61318
|
-
value: function fadeTo(
|
|
61319
|
-
var
|
|
61670
|
+
value: function fadeTo() {
|
|
61671
|
+
var _this3 = this;
|
|
61320
61672
|
|
|
61321
|
-
|
|
61322
|
-
|
|
61323
|
-
|
|
61324
|
-
|
|
61325
|
-
|
|
61673
|
+
var opacity = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
|
|
61674
|
+
var time = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 250;
|
|
61675
|
+
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
61676
|
+
|
|
61677
|
+
var onUpdate = function onUpdate(value) {
|
|
61678
|
+
return !_this3.isDisposed() && _this3.setOpacity(value);
|
|
61679
|
+
};
|
|
61680
|
+
|
|
61681
|
+
return tweenTo(this.opacity, clamp(opacity, 0, 1), _objectSpread2$1(_objectSpread2$1({}, options), {}, {
|
|
61682
|
+
time: time,
|
|
61683
|
+
onUpdate: onUpdate
|
|
61684
|
+
}));
|
|
61326
61685
|
}
|
|
61327
61686
|
}, {
|
|
61328
61687
|
key: "setWireframe",
|
|
61329
61688
|
value: function setWireframe() {
|
|
61330
61689
|
var flag = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
61331
61690
|
|
|
61332
|
-
|
|
61333
|
-
|
|
61334
|
-
}
|
|
61335
|
-
|
|
61336
|
-
|
|
61337
|
-
child.material.wireframe = flag;
|
|
61338
|
-
}
|
|
61339
|
-
});
|
|
61340
|
-
}
|
|
61691
|
+
var _setWireframe = function _setWireframe(material) {
|
|
61692
|
+
return material.wireframe = flag;
|
|
61693
|
+
};
|
|
61694
|
+
|
|
61695
|
+
applyMaterialChange(this.getBody(), _setWireframe);
|
|
61341
61696
|
}
|
|
61342
61697
|
}, {
|
|
61343
61698
|
key: "setWireframeLineWidth",
|
|
61344
61699
|
value: function setWireframeLineWidth() {
|
|
61345
61700
|
var width = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
|
|
61346
61701
|
|
|
61347
|
-
|
|
61348
|
-
|
|
61349
|
-
}
|
|
61350
|
-
|
|
61351
|
-
|
|
61352
|
-
child.material.wireframeLinewidth = width;
|
|
61353
|
-
}
|
|
61354
|
-
});
|
|
61355
|
-
}
|
|
61702
|
+
var _setWireframeLineWidth = function _setWireframeLineWidth(material) {
|
|
61703
|
+
material.wireframeLinewidth = width;
|
|
61704
|
+
};
|
|
61705
|
+
|
|
61706
|
+
applyMaterialChange(this.getBody(), _setWireframeLineWidth);
|
|
61356
61707
|
}
|
|
61357
61708
|
}, {
|
|
61358
61709
|
key: "disposeBody",
|
|
@@ -61939,7 +62290,7 @@ var Plane = /*#__PURE__*/function (_Element) {
|
|
|
61939
62290
|
}
|
|
61940
62291
|
|
|
61941
62292
|
return Box;
|
|
61942
|
-
}(Element$1);var _excluded$
|
|
62293
|
+
}(Element$1);var _excluded$7 = ["anisotropy"];
|
|
61943
62294
|
|
|
61944
62295
|
var validateAnisotropy = function validateAnisotropy(anisotropy) {
|
|
61945
62296
|
var max = Scene$1.getRenderer().capabilities.getMaxAnisotropy();
|
|
@@ -61965,7 +62316,7 @@ var Sprite = /*#__PURE__*/function (_Element) {
|
|
|
61965
62316
|
|
|
61966
62317
|
var _options$anisotropy = options.anisotropy,
|
|
61967
62318
|
anisotropy = _options$anisotropy === void 0 ? 1 : _options$anisotropy,
|
|
61968
|
-
rest = _objectWithoutProperties(options, _excluded$
|
|
62319
|
+
rest = _objectWithoutProperties(options, _excluded$7);
|
|
61969
62320
|
|
|
61970
62321
|
var texture = Images$1.get(spriteTexture);
|
|
61971
62322
|
texture.anisotropy = validateAnisotropy(anisotropy);
|
|
@@ -68229,9 +68580,9 @@ var connect = createConnect();var BaseUI = function BaseUI() {
|
|
|
68229
68580
|
return null;
|
|
68230
68581
|
};var TIME_FOR_UPDATE = 5;
|
|
68231
68582
|
var VOLUME = 2;
|
|
68232
|
-
var
|
|
68233
|
-
|
|
68234
|
-
|
|
68583
|
+
var DEFAULT_AUDIO_NODE_VOLUME = 5;
|
|
68584
|
+
var DEFAULT_AUDIO_NODE_RAMP_TIME = 100; // value in ms
|
|
68585
|
+
|
|
68235
68586
|
var AUDIO_RAMPS = {
|
|
68236
68587
|
LINEAR: 'LINEAR',
|
|
68237
68588
|
EXPONENTIAL: 'EXPONENTIAL'
|
|
@@ -68307,6 +68658,11 @@ var Audio = /*#__PURE__*/function () {
|
|
|
68307
68658
|
value: function hasContext() {
|
|
68308
68659
|
return !!this.context;
|
|
68309
68660
|
}
|
|
68661
|
+
}, {
|
|
68662
|
+
key: "hasSounds",
|
|
68663
|
+
value: function hasSounds() {
|
|
68664
|
+
return this.sounds.length > 0;
|
|
68665
|
+
}
|
|
68310
68666
|
}, {
|
|
68311
68667
|
key: "createAudioContext",
|
|
68312
68668
|
value: function createAudioContext() {
|
|
@@ -68334,6 +68690,8 @@ var Audio = /*#__PURE__*/function () {
|
|
|
68334
68690
|
if (this.context) {
|
|
68335
68691
|
return this.context.destination;
|
|
68336
68692
|
}
|
|
68693
|
+
|
|
68694
|
+
console.log(AUDIO_CONTEXT_NOT_AVAILABLE);
|
|
68337
68695
|
}
|
|
68338
68696
|
}, {
|
|
68339
68697
|
key: "getVolume",
|
|
@@ -68341,6 +68699,8 @@ var Audio = /*#__PURE__*/function () {
|
|
|
68341
68699
|
if (this.masterVolumeNode) {
|
|
68342
68700
|
return this.masterVolumeNode.gain.value;
|
|
68343
68701
|
}
|
|
68702
|
+
|
|
68703
|
+
console.log(AUDIO_CONTEXT_NOT_AVAILABLE);
|
|
68344
68704
|
}
|
|
68345
68705
|
}, {
|
|
68346
68706
|
key: "getMasterVolumeNode",
|
|
@@ -68365,33 +68725,33 @@ var Audio = /*#__PURE__*/function () {
|
|
|
68365
68725
|
}, {
|
|
68366
68726
|
key: "updateListenerPosition",
|
|
68367
68727
|
value: function updateListenerPosition() {
|
|
68368
|
-
//now handling listener
|
|
68369
68728
|
Scene$1.getCameraBody().updateMatrixWorld();
|
|
68370
68729
|
var p = new Vector3$1();
|
|
68371
|
-
p.setFromMatrixPosition(Scene$1.getCameraBody().matrixWorld);
|
|
68372
|
-
|
|
68373
|
-
this.context.listener.
|
|
68730
|
+
p.setFromMatrixPosition(Scene$1.getCameraBody().matrixWorld);
|
|
68731
|
+
this.context.listener.positionX.setValueAtTime(p.x, this.context.currentTime);
|
|
68732
|
+
this.context.listener.positionY.setValueAtTime(p.y, this.context.currentTime);
|
|
68733
|
+
this.context.listener.positionZ.setValueAtTime(p.z, this.context.currentTime);
|
|
68374
68734
|
}
|
|
68375
68735
|
}, {
|
|
68376
68736
|
key: "updatelistenerOrientation",
|
|
68377
68737
|
value: function updatelistenerOrientation() {
|
|
68378
|
-
//this is to add up and down vector to our camera
|
|
68379
|
-
// The camera's world matrix is named "matrix".
|
|
68380
68738
|
var m = Scene$1.getCameraBody().matrix;
|
|
68381
68739
|
var mx = m.elements[12],
|
|
68382
68740
|
my = m.elements[13],
|
|
68383
68741
|
mz = m.elements[14];
|
|
68384
|
-
m.elements[12] = m.elements[13] = m.elements[14] = 0;
|
|
68385
|
-
|
|
68742
|
+
m.elements[12] = m.elements[13] = m.elements[14] = 0;
|
|
68386
68743
|
var vec = new Vector3$1(0, 0, 1);
|
|
68387
68744
|
vec.applyMatrix4(m);
|
|
68388
|
-
vec.normalize();
|
|
68389
|
-
|
|
68745
|
+
vec.normalize();
|
|
68390
68746
|
var up = new Vector3$1(0, -1, 0);
|
|
68391
68747
|
up.applyMatrix4(m);
|
|
68392
|
-
up.normalize();
|
|
68393
|
-
|
|
68394
|
-
this.context.listener.
|
|
68748
|
+
up.normalize();
|
|
68749
|
+
this.context.listener.forwardX.setValueAtTime(vec.x, this.context.currentTime);
|
|
68750
|
+
this.context.listener.forwardY.setValueAtTime(vec.y, this.context.currentTime);
|
|
68751
|
+
this.context.listener.forwardZ.setValueAtTime(vec.z, this.context.currentTime);
|
|
68752
|
+
this.context.listener.upX.setValueAtTime(up.x, this.context.currentTime);
|
|
68753
|
+
this.context.listener.upY.setValueAtTime(up.y, this.context.currentTime);
|
|
68754
|
+
this.context.listener.upZ.setValueAtTime(up.z, this.context.currentTime);
|
|
68395
68755
|
m.elements[12] = mx;
|
|
68396
68756
|
m.elements[13] = my;
|
|
68397
68757
|
m.elements[14] = mz;
|
|
@@ -68410,13 +68770,17 @@ var Audio = /*#__PURE__*/function () {
|
|
|
68410
68770
|
key: "update",
|
|
68411
68771
|
value: function update(dt) {
|
|
68412
68772
|
if (!this.hasContext()) return;
|
|
68773
|
+
|
|
68774
|
+
if (this.hasSounds()) {
|
|
68775
|
+
this.updateListenerPosition();
|
|
68776
|
+
this.updatelistenerOrientation();
|
|
68777
|
+
}
|
|
68778
|
+
|
|
68413
68779
|
var start = new Date();
|
|
68414
68780
|
|
|
68415
68781
|
for (var index in this.sounds) {
|
|
68416
68782
|
var sound = this.sounds[index];
|
|
68417
68783
|
sound.update(dt);
|
|
68418
|
-
this.updateListenerPosition();
|
|
68419
|
-
this.updatelistenerOrientation();
|
|
68420
68784
|
if (+new Date() - start > TIME_FOR_UPDATE) break;
|
|
68421
68785
|
}
|
|
68422
68786
|
}
|
|
@@ -82336,7 +82700,7 @@ var Stats$1 = new Stats();var Loader = /*#__PURE__*/function () {
|
|
|
82336
82700
|
}]);
|
|
82337
82701
|
|
|
82338
82702
|
return Loader;
|
|
82339
|
-
}();var _excluded$
|
|
82703
|
+
}();var _excluded$6 = ["mesh", "scripts", "texture"];
|
|
82340
82704
|
var MeshLoader = /*#__PURE__*/function (_Loader) {
|
|
82341
82705
|
_inherits(MeshLoader, _Loader);
|
|
82342
82706
|
|
|
@@ -82362,7 +82726,7 @@ var MeshLoader = /*#__PURE__*/function (_Loader) {
|
|
|
82362
82726
|
var mesh = _ref.mesh,
|
|
82363
82727
|
scripts = _ref.scripts,
|
|
82364
82728
|
texture = _ref.texture,
|
|
82365
|
-
opts = _objectWithoutProperties(_ref, _excluded$
|
|
82729
|
+
opts = _objectWithoutProperties(_ref, _excluded$6);
|
|
82366
82730
|
|
|
82367
82731
|
return _this.loadMesh(_this.parseMesh(mesh), scripts, texture, opts);
|
|
82368
82732
|
});
|
|
@@ -82895,9 +83259,11 @@ var PointLight = /*#__PURE__*/function (_Light) {
|
|
|
82895
83259
|
|
|
82896
83260
|
var _super = _createSuper(PointLight);
|
|
82897
83261
|
|
|
82898
|
-
function PointLight(
|
|
83262
|
+
function PointLight() {
|
|
82899
83263
|
var _this;
|
|
82900
83264
|
|
|
83265
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
83266
|
+
|
|
82901
83267
|
_classCallCheck(this, PointLight);
|
|
82902
83268
|
|
|
82903
83269
|
var _options$color = options.color,
|
|
@@ -85488,7 +85854,21 @@ var index$1=/*#__PURE__*/Object.freeze({__proto__:null,Emitter:k,Particle:P,Part
|
|
|
85488
85854
|
}
|
|
85489
85855
|
|
|
85490
85856
|
return Fountain;
|
|
85491
|
-
}(ParticleEmitter);var
|
|
85857
|
+
}(ParticleEmitter);var three_proton_min = {exports: {}};var require$$0 = /*@__PURE__*/getAugmentedNamespace(three_module);/*!
|
|
85858
|
+
* three.proton v0.2.0
|
|
85859
|
+
* https://github.com/drawcall/three.proton
|
|
85860
|
+
*
|
|
85861
|
+
* Copyright 2011-2020, ajiemath
|
|
85862
|
+
* Licensed under the MIT license
|
|
85863
|
+
* http://www.opensource.org/licenses/mit-license
|
|
85864
|
+
*
|
|
85865
|
+
*/
|
|
85866
|
+
|
|
85867
|
+
(function (module, exports) {
|
|
85868
|
+
(function(a,b){module.exports=b(require$$0);})(commonjsGlobal,function(a){function bd(a,b,c,d){bd._super_.call(this),this.camera=a,this.renderer=b,this.dis=c||20,d=d||"1234";for(var e=1;e<5;e++)this["d"+e]=d.indexOf(e+"")>=0;this.name="ScreenZone";}function bc(a,c,d,e,f,g){var h,i,j,k,l,e;bc._super_.call(this),b.Util.isUndefined(c,d,e,f,g)?(h=i=j=0,k=l=e=a||100):b.Util.isUndefined(e,f,g)?(h=i=j=0,k=a,l=c,e=d):(h=a,i=c,j=d,k=e,l=f,e=g),this.x=h,this.y=i,this.z=j,this.width=k,this.height=l,this.depth=e,this.friction=.85,this.max=6;}function bb(a,c,d){var e,f,g;bb._super_.call(this),b.Util.isUndefined(a,c,d)?e=f=g=0:(e=a,f=c,g=d),this.x=e,this.y=f,this.z=g;}function ba(b,c){ba._super_.call(this),b instanceof a.Geometry?this.geometry=b:this.geometry=b.geometry,this.scale=c||1;}function _(a,c,d,e){var f,i;_._super_.call(this),b.Util.isUndefined(c,d,e)?(f=0,i=a||100):(f=a,i=e),this.x=f,this.y=f,this.z=f,this.radius=i,this.tha=this.phi=0;}function $(a,c,d,e,f,g){$._super_.call(this),a instanceof b.Vector3D?(this.x1=a.x,this.y1=a.y,this.z1=a.z,this.x2=e.x,this.y2=e.y,this.z2=e.z):(this.x1=a,this.y1=c,this.z1=d,this.x2=e,this.y2=f,this.z2=g);}function Z(){this.vector=new b.Vector3D(0,0,0),this.random=0,this.crossType="dead",this.log=!0;}function Y(){Y._super_.call(this),this.targetPool=new b.Pool,this.materialPool=new b.Pool,this.name="CustomRender";}function X(b){X._super_.call(this,b),this._body=new a.Sprite(new a.SpriteMaterial({color:16777215})),this.name="SpriteRender";}function W(a){W._super_.call(this),this.points=a,this.name="PointsRender";}function V(c){V._super_.call(this),this.container=c,this._targetPool=new b.Pool,this._materialPool=new b.Pool,this._body=new a.Mesh(new a.BoxGeometry(50,50,50),new a.MeshLambertMaterial({color:"#ff0000"})),this.name="MeshRender";}function U(){this.name="BaseRender";}function R(a,c,d){this.mouseTarget=b.Util.initValue(a,window),this.ease=b.Util.initValue(c,.7),this._allowEmitting=!1,this.mouse=new b.Vector3D,this.initEventHandler(),R._super_.call(this,d);}function Q(a){this.selfBehaviours=[],Q._super_.call(this,a);}function P(a){this.initializes=[],this.particles=[],this.behaviours=[],this.currentEmitTime=0,this.totalEmitTimes=-1,this.damping=.006,this.bindEmitter=!0,this.rate=new b.Rate(1,.1),P._super_.call(this,a),this.id="emitter_"+P.ID++,this.cID=0,this.name="Emitter";}function O(a,b,c,d,e,f,g){O._super_.call(this,f,g),O.prototype.reset(a,b,c,d,e),this.name="Spring";}function N(a,b,c,d){N._super_.call(this,c,d),this.reset(a,b),this.name="Color";}function M(a,b,c,d,e){M._super_.call(this,d,e),this.reset(a,b,c),this.name="Rotate";}function L(a,b,c,d){L._super_.call(this,c,d),this.reset(a,b),this.name="Scale";}function K(a,b,c,d){K._super_.call(this,c,d),this.reset(a,b),this.name="Alpha";}function J(a,b,c,d){J._super_.call(this,c,d),this.reset(a,b),this.name="CrossZone";}function I(a,b,c,d,e){I._super_.call(this,d,e),this.reset(a,b,c),this.name="Collision";}function H(a,b,c){H._super_.call(this,0,-a,0,b,c),this.name="Gravity";}function G(a,b,c,d,e){G._super_.call(this,a,b,c,d,e),this.force*=-1,this.name="Repulsion";}function F(a,b,c,d,e,f){F._super_.call(this,e,f),this.reset(a,b,c,d),this.time=0,this.name="RandomDrift";}function E(a,c,d,e,f){E._super_.call(this,e,f),this.targetPosition=b.Util.initValue(a,new b.Vector3D),this.radius=b.Util.initValue(d,1e3),this.force=b.Util.initValue(this.normalizeValue(c),100),this.radiusSq=this.radius*this.radius,this.attractionForce=new b.Vector3D,this.lengthSq=0,this.name="Attraction";}function D(a,b,c,d,e){D._super_.call(this,d,e),D.prototype.reset.call(this,a,b,c),this.name="Force";}function C(a,c,d){C._super_.call(this),this.body=b.createArraySpan(a),this.w=c,this.h=b.Util.initValue(d,this.w);}function B(a,c,d){B._super_.call(this),this.radius=b.createSpan(a,c,d);}function A(a,c,d){A._super_.call(this),this.massPan=b.createSpan(a,c,d);}function z(a,c,d){z._super_.call(this),this.reset(a,c,d),this.dirVec=new b.Vector3D(0,0,0),this.name="Velocity";}function y(){y._super_.call(this),this.reset.apply(this,arguments);}function x(a,c,d){x._super_.call(this),this.lifePan=b.createSpan(a,c,d);}function v(){this.name="Initialize";}function u(a,c){this.numPan=b.createSpan(b.Util.initValue(a,1)),this.timePan=b.createSpan(b.Util.initValue(c,1)),this.startTime=0,this.nextTime=0,this.init();}function t(a,c){this.id="Behaviour_"+t.id++,this.life=b.Util.initValue(a,Infinity),this.easing=b.Util.initValue(c,b.ease.setEasingByName(b.ease.easeLinear)),this.age=0,this.energy=1,this.dead=!1,this.name="Behaviour";}function s(a,b,c,d,e,f){this.x=a,this.y=b,this.z=c,this.width=d,this.height=e,this.depth=f,this.bottom=this.y+this.height,this.right=this.x+this.width,this.right=this.x+this.width;}function q(a){this._arr=b.Util.isArray(a)?a:[a];}function p(a,c,d){this._isArray=!1,b.Util.isArray(a)?(this._isArray=!0,this.a=a):(this.a=b.Util.initValue(a,1),this.b=b.Util.initValue(c,this.a),this._center=b.Util.initValue(d,!1));}function j(){this.cID=0,this.list={};}function i(a){this.id="particle_"+i.ID++,this.name="Particle",this.reset("init"),b.Util.setPrototypeByObj(this,a);}function c(){this.initialize();}function b(a,c){this.preParticles=b.Util.initValue(a,b.POOL_MAX),this.integrationType=b.Util.initValue(c,b.EULER),this.emitters=[],this.renderers=[],this.pool=new b.Pool,b.integrator=new b.Integration(this.integrationType);}b.POOL_MAX=500,b.TIME_STEP=60,b.PI=3.142,b.DR=b.PI/180,b.MEASURE=100,b.EULER="euler",b.RK2="runge-kutta2",b.RK4="runge-kutta4",b.VERLET="verlet",b.PARTICLE_CREATED="partilcleCreated",b.PARTICLE_UPDATE="partilcleUpdate",b.PARTICLE_SLEEP="particleSleep",b.PARTICLE_DEAD="partilcleDead",b.PROTON_UPDATE="protonUpdate",b.PROTON_UPDATE_AFTER="protonUpdateAfter",b.EMITTER_ADDED="emitterAdded",b.EMITTER_REMOVED="emitterRemoved",b.bindEmtterEvent=!1,b.prototype={addRender:function(a){this.renderers.push(a),a.init(this);},removeRender:function(a){this.renderers.splice(this.renderers.indexOf(a),1),a.remove(this);},addEmitter:function(a){this.emitters.push(a),a.parent=this,this.dispatchEvent("EMITTER_ADDED",a);},removeEmitter:function(a){a.parent==this&&(this.emitters.splice(this.emitters.indexOf(a),1),a.parent=null,this.dispatchEvent("EMITTER_REMOVED",a));},update:function(a){this.dispatchEvent("PROTON_UPDATE",this);var b=a||.0167;if(b>0){var c=this.emitters.length;while(c--)this.emitters[c].update(b);}this.dispatchEvent("PROTON_UPDATE_AFTER",this);},getCount:function(){var a=0,b,c=this.emitters.length;for(b=0;b<c;b++)a+=this.emitters[b].particles.length;return a},destroy:function(){var a=0,b=this.emitters.length;for(a;a<b;a++)this.emitters[a].destroy(),delete this.emitters[a];this.emitters.length=0,this.pool.destroy();}},c.initialize=function(a){a.addEventListener=d.addEventListener,a.removeEventListener=d.removeEventListener,a.removeAllEventListeners=d.removeAllEventListeners,a.hasEventListener=d.hasEventListener,a.dispatchEvent=d.dispatchEvent;};var d=c.prototype;d._listeners=null,d.initialize=function(){},d.addEventListener=function(a,b){this._listeners?this.removeEventListener(a,b):this._listeners={},this._listeners[a]||(this._listeners[a]=[]),this._listeners[a].push(b);return b},d.removeEventListener=function(a,b){if(!!this._listeners){if(!this._listeners[a])return;var c=this._listeners[a];for(var d=0,e=c.length;d<e;d++)if(c[d]==b){e==1?delete this._listeners[a]:c.splice(d,1);break}}},d.removeAllEventListeners=function(a){a?this._listeners&&delete this._listeners[a]:this._listeners=null;},d.dispatchEvent=function(a,b){var c=!1,d=this._listeners;if(a&&d){var e=d[a];if(!e)return c;e=e.slice();var f,g=e.length;while(g--){var f=e[g];c=c||f(b);}}return !!c},d.hasEventListener=function(a){var b=this._listeners;return !!b&&!!b[a]},c.initialize(b.prototype),b.EventDispatcher=c;var e=e||{initValue:function(a,b){var a=a!=null&&a!=undefined?a:b;return a},isArray:function(a){return Object.prototype.toString.call(a)==="[object Array]"},destroyArray:function(a){a.length=0;},destroyObject:function(a){for(var b in a)delete a[b];},isUndefined:function(){for(var a in arguments){var b=arguments[a];if(b!==undefined)return !1}return !0},setVectorByObj:function(a,b){b.x!==undefined&&(a.p.x=b.x),b.y!==undefined&&(a.p.y=b.y),b.z!==undefined&&(a.p.z=b.z),b.vx!==undefined&&(a.v.x=b.vx),b.vy!==undefined&&(a.v.y=b.vy),b.vz!==undefined&&(a.v.z=b.vz),b.ax!==undefined&&(a.a.x=b.ax),b.ay!==undefined&&(a.a.y=b.ay),b.az!==undefined&&(a.a.z=b.az),b.p!==undefined&&a.p.copy(b.p),b.v!==undefined&&a.v.copy(b.v),b.a!==undefined&&a.a.copy(b.a),b.position!==undefined&&a.p.copy(b.position),b.velocity!==undefined&&a.v.copy(b.velocity),b.accelerate!==undefined&&a.a.copy(b.accelerate);},setPrototypeByObj:function(a,b,c){for(var d in b)a.hasOwnProperty(d)&&(c?c.indexOf(d)<0&&(a[d]=e._getValue(b[d])):a[d]=e._getValue(b[d]));return a},_getValue:function(a){return a instanceof p?a.getValue():a},inherits:function(a,b){a._super_=b;if(Object.create)a.prototype=Object.create(b.prototype,{constructor:{value:a}});else {var c=function(){};c.prototype=b.prototype,a.prototype=new c,a.prototype.constructor=a;}}};b.Util=e;var f=f||{getRGB:function(b){var c={};if(typeof b=="number")e=Math.floor(b),c.r=(b>>16&255)/255,c.g=(b>>8&255)/255,c.b=(b&255)/255;else if(typeof b=="string"){var d;if(d=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(b))c.r=Math.min(255,parseInt(d[1],10))/255,c.g=Math.min(255,parseInt(d[2],10))/255,c.b=Math.min(255,parseInt(d[3],10))/255;else if(d=/^\#([A-Fa-f0-9]+)$/.exec(b)){var e=d[1];c.r=parseInt(e.charAt(0)+e.charAt(1),16)/255,c.g=parseInt(e.charAt(2)+e.charAt(3),16)/255,c.b=parseInt(e.charAt(4)+e.charAt(5),16)/255;}}else b instanceof a.Color&&(c.r=b.r,c.g=b.g,c.b=b.b);return c}};b.ColorUtil=f;var g={toScreenPos:function(){var b=new a.Vector3;return function(a,c,d){b.copy(a),b.project(c),b.x=Math.round((b.x+1)*d.width/2),b.y=Math.round((-b.y+1)*d.height/2),b.z=0;return b}}(),toSpacePos:function(){var b=new a.Vector3,c=new a.Vector3,d;return function(a,e,f){b.set(a.x/f.width*2-1,-(a.y/f.height)*2+1,.5),b.unproject(e),c.copy(b.sub(e.position).normalize()),d=-e.position.z/c.z,b.copy(e.position),b.add(c.multiplyScalar(d));return b}}(),getTexture:function(){var c={};return function(d){if(d instanceof a.Texture)return d;if(typeof d=="string"){var e=b.PUID.hash(d);c[e]||(c[e]=new a.Texture(d));return c[e]}if(d instanceof Image){var e=b.PUID.hash(d.src);c[e]||(c[e]=new a.Texture(d));return c[e]}}}()};b.THREEUtil=g;var h=h||{_id:0,_uids:{},id:function(a){for(var b in this._uids)if(this._uids[b]==a)return b;var c="PUID_"+this._id++;this._uids[c]=a;return c},hash:function(a){return}};b.PUID=h,i.ID=0,i.prototype={getDirection:function(){return Math.atan2(this.v.x,-this.v.y)*(180/b.PI)},reset:function(a){this.life=Infinity,this.age=0,this.energy=1,this.dead=!1,this.sleep=!1,this.body=null,this.parent=null,this.mass=1,this.radius=10,this.alpha=1,this.scale=1,this.useColor=!1,this.useAlpha=!1,this.easing=b.ease.setEasingByName(b.ease.easeLinear),a?(this.p=new b.Vector3D,this.v=new b.Vector3D,this.a=new b.Vector3D,this.old={},this.old.p=this.p.clone(),this.old.v=this.v.clone(),this.old.a=this.a.clone(),this.behaviours=[],this.transform={},this.color={r:0,g:0,b:0},this.rotation=new b.Vector3D):(this.p.set(0,0,0),this.v.set(0,0,0),this.a.set(0,0,0),this.old.p.set(0,0,0),this.old.v.set(0,0,0),this.old.a.set(0,0,0),this.color.r=0,this.color.g=0,this.color.b=0,this.rotation.clear(),b.Util.destroyObject(this.transform),this.removeAllBehaviours());return this},update:function(a,b){if(!this.sleep){this.age+=a;var c=this.behaviours.length;while(c--)this.behaviours[c]&&this.behaviours[c].applyBehaviour(this,a,b);}if(this.age>=this.life)this.destroy();else {var d=this.easing(this.age/this.life);this.energy=Math.max(1-d,0);}},addBehaviour:function(a){this.behaviours.push(a),a.initialize(this);},addBehaviours:function(a){var b=a.length;while(b--)this.addBehaviour(a[b]);},removeBehaviour:function(a){var b=this.behaviours.indexOf(a);b>-1&&this.behaviours.splice(b,1);},removeAllBehaviours:function(){b.Util.destroyArray(this.behaviours);},destroy:function(){this.removeAllBehaviours(),this.energy=0,this.dead=!0,this.parent=null;}},b.Particle=i,j.prototype={create:function(a){this.cID++;return typeof a=="function"?new a:a.clone()},getCount:function(){var a=0;for(var b in this.list)a+=this.list[b].length;return a++},get:function(a){var c,d=a.__puid||b.PUID.id(a);this.list[d]&&this.list[d].length>0?c=this.list[d].pop():c=this.create(a),c.__puid=a.__puid||d;return c},expire:function(a){return this._getList(a.__puid).push(a)},destroy:function(){for(var a in this.list)this.list[a].length=0,delete this.list[a];},_getList:function(a){a=a||"default",this.list[a]||(this.list[a]=[]);return this.list[a]}},b.Pool=j;var k={randomAToB:function(a,b,c){return c?(Math.random()*(b-a)>>0)+a:a+Math.random()*(b-a)},randomFloating:function(a,b,c){return k.randomAToB(a-b,a+b,c)},randomZone:function(a){},degreeTransform:function(a){return a*b.PI/180},toColor16:function(a){return "#"+a.toString(16)},randomColor:function(){return "#"+("00000"+(Math.random()*16777216<<0).toString(16)).slice(-6)},lerp:function(a,b,c){return b+(a-b)*c},getNormal:function(a,b){a.x==0&&a.y==0?a.z==0?b.set(1,0,1):b.set(1,1,-a.y/a.z):a.x==0?b.set(1,0,1):b.set(-a.y/a.x,1,1);return b.normalize()},axisRotate:function(a,b,c,d){var e=Math.cos(d),f=Math.sin(d),g=c.dot(b)*(1-e);a.copy(c),a.cross(b).scalar(f),a.addValue(b.x*e,b.y*e,b.z*e),a.addValue(c.x*g,c.y*g,c.z*g);}};b.MathUtils=k;var m=function(a){this.type=b.Util.initValue(a,b.EULER);};m.prototype={integrate:function(a,b,c){this.euler(a,b,c);},euler:function(a,b,c){a.sleep||(a.old.p.copy(a.p),a.old.v.copy(a.v),a.a.scalar(1/a.mass),a.v.add(a.a.scalar(b)),a.p.add(a.old.v.scalar(b)),c&&a.v.scalar(c),a.a.clear());}},b.Integration=m;var n=function(a,b,c){this.x=a||0,this.y=b||0,this.z=c||0;};n.prototype={set:function(a,b,c){this.x=a,this.y=b,this.z=c;return this},setX:function(a){this.x=a;return this},setY:function(a){this.y=a;return this},setZ:function(a){this.z=a;return this},getGradient:function(){if(this.x!=0)return Math.atan2(this.y,this.x);if(this.y>0)return b.PI/2;if(this.y<0)return -b.PI/2},copy:function(a){this.x=a.x,this.y=a.y,this.z=a.z;return this},add:function(a,b){if(b!==undefined)return this.addVectors(a,b);this.x+=a.x,this.y+=a.y,this.z+=a.z;return this},addValue:function(a,b,c){this.x+=a,this.y+=b,this.z+=c;return this},addVectors:function(a,b){this.x=a.x+b.x,this.y=a.y+b.y,this.z=a.z+b.z;return this},addScalar:function(a){this.x+=a,this.y+=a,this.z+=a;return this},sub:function(a,b){if(b!==undefined)return this.subVectors(a,b);this.x-=a.x,this.y-=a.y,this.z-=a.z;return this},subVectors:function(a,b){this.x=a.x-b.x,this.y=a.y-b.y,this.z=a.z-b.z;return this},scalar:function(a){this.x*=a,this.y*=a,this.z*=a;return this},divideScalar:function(a){a!==0?(this.x/=a,this.y/=a,this.z/=a):this.set(0,0,0);return this},negate:function(){return this.scalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},cross:function(a){var b=this.x,c=this.y,d=this.z;this.x=c*a.z-d*a.y,this.y=d*a.x-b*a.z,this.z=b*a.y-c*a.x;return this},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.lengthSq())},normalize:function(){return this.divideScalar(this.length())},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},crossVectors:function(a,b){var c=a.x,d=a.y,e=a.z,f=b.x,g=b.y,h=b.z;this.x=d*h-e*g,this.y=e*f-c*h,this.z=c*g-d*f;return this},eulerFromDir:function(a){},applyEuler:function(){var a;return function(c){a===undefined&&(a=new b.Quaternion),this.applyQuaternion(a.setFromEuler(c));return this}}(),applyAxisAngle:function(){var a;return function(c,d){a===undefined&&(a=new b.Quaternion),this.applyQuaternion(a.setFromAxisAngle(c,d));return this}}(),applyQuaternion:function(a){var b=this.x,c=this.y,d=this.z,e=a.x,f=a.y,g=a.z,h=a.w,i=h*b+f*d-g*c,j=h*c+g*b-e*d,k=h*d+e*c-f*b,l=-e*b-f*c-g*d;this.x=i*h+l*-e+j*-g-k*-f,this.y=j*h+l*-f+k*-e-i*-g,this.z=k*h+l*-g+i*-f-j*-e;return this},distanceToSquared:function(a){var b=this.x-a.x,c=this.y-a.y,d=this.z-a.z;return b*b+c*c+d*d},lerp:function(a,b){this.x+=(a.x-this.x)*b,this.y+=(a.y-this.y)*b,this.z+=(a.z-this.z)*b;return this},equals:function(a){return a.x===this.x&&a.y===this.y&&a.z===this.z},clear:function(){this.x=0,this.y=0,this.z=0;return this},clone:function(){return new b.Vector3D(this.x,this.y,this.z)},toString:function(){return "x:"+this.x+"y:"+this.y+"z:"+this.z}},b.Vector3D=n;var o=function(a,b,c){this.radius=a||1,this.phi=c||0,this.theta=b||0;};o.prototype={set:function(a,b,c){this.radius=a||1,this.phi=c||0,this.theta=b||0;return this},setRadius:function(a){this.radius=a;return this},setPhi:function(a){this.phi=a;return this},setTheta:function(a){this.theta=a;return this},copy:function(a){this.radius=a.radius,this.phi=a.phi,this.theta=a.theta;return this},toVector3D:function(){return new b.Vector3D(this.getX(),this.getY(),this.getZ())},getX:function(){return this.radius*Math.sin(this.theta)*Math.cos(this.phi)},getY:function(){return -this.radius*Math.sin(this.theta)*Math.sin(this.phi)},getZ:function(){return this.radius*Math.cos(this.theta)},normalize:function(){this.radius=1;return this},equals:function(a){return a.radius===this.radius&&a.phi===this.phi&&a.theta===this.theta},clear:function(){this.radius=0,this.phi=0,this.theta=0;return this},clone:function(){return new o(this.radius,this.phi,this.theta)}},b.Polar3D=o,p.prototype={getValue:function(a){return this._isArray?this.a[this.a.length*Math.random()>>0]:this._center?b.MathUtils.randomFloating(this.a,this.b,a):b.MathUtils.randomAToB(this.a,this.b,a)}},b.createSpan=function(a,b,c){if(a instanceof p)return a;return b===undefined?new p(a):c===undefined?new p(a,b):new p(a,b,c)},b.Span=p,b.Util.inherits(q,b.Span),q.prototype.getValue=function(){var a=this._arr[this._arr.length*Math.random()>>0];return a=="random"||a=="Random"?b.MathUtils.randomColor():a},b.createArraySpan=function(a){if(!a)return null;return a instanceof b.ArraySpan?a:new b.ArraySpan(a)},b.ArraySpan=q;var r=function(a,b,c,d){this.x=a||0,this.y=b||0,this.z=c||0,this.w=d!==undefined?d:1;};r.prototype={set:function(a,b,c,d){this.x=a,this.y=b,this.z=c,this.w=d;return this},clone:function(){return new b.Quaternion(this.x,this.y,this.z,this.w)},copy:function(a){this.x=a.x,this.y=a.y,this.z=a.z,this.w=a.w;return this},setFromEuler:function(a){var b=Math.cos(a.x/2),c=Math.cos(a.y/2),d=Math.cos(a.z/2),e=Math.sin(a.x/2),f=Math.sin(a.y/2),g=Math.sin(a.z/2);this.x=e*c*d+b*f*g,this.y=b*f*d-e*c*g,this.z=b*c*g+e*f*d,this.w=b*c*d-e*f*g;return this},setFromAxisAngle:function(a,b){var c=b/2,d=Math.sin(c);this.x=a.x*d,this.y=a.y*d,this.z=a.z*d,this.w=Math.cos(c);return this},normalize:function(){var a=this.length();a===0?(this.x=0,this.y=0,this.z=0,this.w=1):(a=1/a,this.x*=a,this.y*=a,this.z*=a,this.w*=a);return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z+this.w*a.w}},b.Quaternion=r,s.prototype={contains:function(a,b,c){return a<=this.right&&a>=this.x&&b<=this.bottom&&b>=this.y&&c<=this.depth&&c>=this.z?!0:!1}},b.Box=s,t.id=0,t.prototype={reset:function(a,c){this.life=b.Util.initValue(a,Infinity),this.easing=b.Util.initValue(c,b.ease.setEasingByName(b.ease.easeLinear));},normalizeForce:function(a){return a.scalar(b.MEASURE)},normalizeValue:function(a){return a*b.MEASURE},initialize:function(a){},applyBehaviour:function(a,b,c){if(!this.dead){this.age+=b;if(this.age>=this.life){this.energy=0,this.dead=!0;return}var d=this.easing(a.age/a.life);this.energy=Math.max(1-d,0);}},destroy:function(){}},b.Behaviour=t,u.prototype={init:function(){this.startTime=0,this.nextTime=this.timePan.getValue();},getValue:function(a){this.startTime+=a;if(this.startTime>=this.nextTime){this.init();return this.numPan.b==1?this.numPan.getValue("Float")>.5?1:0:this.numPan.getValue("Int")}return 0}},b.Rate=u,v.prototype.reset=function(){},v.prototype.init=function(a,b){b?this.initialize(b):this.initialize(a);},v.prototype.initialize=function(a){},b.Initialize=v;var w={initialize:function(a,c,d){var e=d.length;while(e--){var f=d[e];f instanceof b.Initialize?f.init(a,c):w.init(a,c,f);}w.bindEmitter(a,c);},init:function(a,c,d){b.Util.setPrototypeByObj(c,d),b.Util.setVectorByObj(c,d);},bindEmitter:function(a,b){a.bindEmitter&&(b.p.add(a.p),b.v.add(a.v),b.a.add(a.a),b.v.applyEuler(a.rotation));}};b.InitializeUtil=w,b.Util.inherits(x,b.Initialize),x.prototype.initialize=function(a){this.lifePan.a==Infinity||this.lifePan.a=="infi"?a.life=Infinity:a.life=this.lifePan.getValue();},b.Life=x,b.Util.inherits(y,b.Initialize),y.prototype.reset=function(){this.zones?this.zones.length=0:this.zones=[];var a=Array.prototype.slice.call(arguments);this.zones=this.zones.concat(a);},y.prototype.addZone=function(){var a=Array.prototype.slice.call(arguments);this.zones=this.zones.concat(a);},y.prototype.initialize=function(){return function(a){var b=this.zones[Math.random()*this.zones.length>>0];b.getPosition(),a.p.x=b.vector.x,a.p.y=b.vector.y,a.p.z=b.vector.z;}}(),b.Position=y,b.P=y,b.Util.inherits(z,b.Initialize),z.prototype.reset=function(a,c,d){a instanceof b.Vector3D?(this.radiusPan=b.createSpan(1),this.dir=a.clone(),this.tha=c*b.DR,this._useV=!0):a instanceof b.Polar3D?(this.tha=c*b.DR,this.dirVec=a.toVector3D(),this._useV=!1):(this.radiusPan=b.createSpan(a),this.dir=c.clone().normalize(),this.tha=d*b.DR,this._useV=!0);},z.prototype.normalize=function(a){return a*b.MEASURE},z.prototype.initialize=function(){var a,c=new b.Vector3D(0,0,1),d=new b.Vector3D(0,0,0);return function(e){a=this.tha*Math.random(),this._useV&&this.dirVec.copy(this.dir).scalar(this.radiusPan.getValue()),b.MathUtils.getNormal(this.dirVec,c),d.copy(this.dirVec).applyAxisAngle(c,a),d.applyAxisAngle(this.dirVec.normalize(),Math.random()*b.PI*2),e.v.copy(d);return this}}(),b.Velocity=z,b.V=z,b.Util.inherits(A,b.Initialize),A.prototype.initialize=function(a){a.mass=this.massPan.getValue();},b.Mass=A,b.Util.inherits(B,b.Initialize),B.prototype.reset=function(a,c,d){this.radius=b.createSpan(a,c,d);},B.prototype.initialize=function(a){a.radius=this.radius.getValue(),a.transform.oldRadius=a.radius;},b.Radius=B,b.Util.inherits(C,b.Initialize),C.prototype.initialize=function(a){var b=this.body.getValue();this.w?a.body={width:this.w,height:this.h,body:b}:a.body=b;},b.Body=C,b.Util.inherits(D,b.Behaviour),D.prototype.reset=function(a,c,d){this.force=this.normalizeForce(new b.Vector3D(a,c,d)),this.force.id=Math.random();},D.prototype.applyBehaviour=function(a,b,c){D._super_.prototype.applyBehaviour.call(this,a,b,c),a.a.add(this.force);},b.F=b.Force=D,b.Util.inherits(E,b.Behaviour),E.prototype.reset=function(a,c,d,e,f){this.targetPosition=b.Util.initValue(a,new b.Vector3D),this.radius=b.Util.initValue(d,1e3),this.force=b.Util.initValue(this.normalizeValue(c),100),this.radiusSq=this.radius*this.radius,this.attractionForce=new b.Vector3D,this.lengthSq=0,e&&E._super_.prototype.reset.call(this,e,f);},E.prototype.applyBehaviour=function(a,b,c){E._super_.prototype.applyBehaviour.call(this,a,b,c),this.attractionForce.copy(this.targetPosition),this.attractionForce.sub(a.p),this.lengthSq=this.attractionForce.lengthSq(),this.lengthSq>4e-6&&this.lengthSq<this.radiusSq&&(this.attractionForce.normalize(),this.attractionForce.scalar(1-this.lengthSq/this.radiusSq),this.attractionForce.scalar(this.force),a.a.add(this.attractionForce));},b.Attraction=E,b.Util.inherits(F,b.Behaviour),F.prototype.reset=function(a,c,d,e,f,g){this.randomFoce=this.normalizeForce(new b.Vector3D(a,c,d)),this.delayPan=b.createSpan(e||.03),this.time=0,f&&F._super_.prototype.reset.call(this,f,g);},F.prototype.applyBehaviour=function(a,c,d){F._super_.prototype.applyBehaviour.call(this,a,c,d),this.time+=c;if(this.time>=this.delayPan.getValue()){var e=b.MathUtils.randomAToB(-this.randomFoce.x,this.randomFoce.x),f=b.MathUtils.randomAToB(-this.randomFoce.y,this.randomFoce.y),g=b.MathUtils.randomAToB(-this.randomFoce.z,this.randomFoce.z);a.a.addValue(e,f,g),this.time=0;}},b.RandomDrift=F,b.Util.inherits(G,b.Attraction),G.prototype.reset=function(a,b,c,d,e){G._super_.prototype.reset.call(this,a,b,c,d,e),this.force*=-1;},b.Repulsion=G,b.Util.inherits(H,b.Force),H.prototype.reset=function(a,b,c){H._super_.prototype.reset.call(this,0,-a,0,b,c);},b.Gravity=H,b.G=H,b.Util.inherits(I,b.Behaviour),I.prototype.reset=function(a,c,d,e,f){this.emitter=a,this.useMass=c,this.callback=d,this.particles=[],this.delta=new b.Vector3D,e&&I._super_.prototype.reset.call(this,e,f);},I.prototype.applyBehaviour=function(a,b,c){var d=this.emitter?this.emitter.particles.slice(c):this.particles.slice(c),e,f,g,h,i,j,k=d.length;while(k--){e=d[k];if(e==a)continue;this.delta.copy(e.p).sub(a.p),f=this.delta.lengthSq(),h=a.radius+e.radius,f<=h*h&&(g=h-Math.sqrt(f),g+=.5,i=this._getAverageMass(a,e),j=this._getAverageMass(e,a),a.p.add(this.delta.clone().normalize().scalar(g*-i)),e.p.add(this.delta.normalize().scalar(g*j)),this.callback&&this.callback(a,e));}},I.prototype._getAverageMass=function(a,b){return this.useMass?b.mass/(a.mass+b.mass):.5},b.Collision=I,b.Util.inherits(J,b.Behaviour),J.prototype.reset=function(a,c,d,e){var f,g;typeof a=="string"?(g=a,f=c):(g=c,f=a),this.zone=f,this.zone.crossType=b.Util.initValue(g,"dead"),d&&J._super_.prototype.reset.call(this,d,e);},J.prototype.applyBehaviour=function(a,b,c){J._super_.prototype.applyBehaviour.call(this,a,b,c),this.zone.crossing.call(this.zone,a);},b.CrossZone=J,b.Util.inherits(K,b.Behaviour),K.prototype.reset=function(a,c,d,e){c==null||c==undefined?this._same=!0:this._same=!1,this.a=b.createSpan(b.Util.initValue(a,1)),this.b=b.createSpan(c),d&&K._super_.prototype.reset.call(this,d,e);},K.prototype.initialize=function(a){a.useAlpha=!0,a.transform.alphaA=this.a.getValue(),this._same?a.transform.alphaB=a.transform.alphaA:a.transform.alphaB=this.b.getValue();},K.prototype.applyBehaviour=function(a,c,d){K._super_.prototype.applyBehaviour.call(this,a,c,d),a.alpha=b.MathUtils.lerp(a.transform.alphaA,a.transform.alphaB,this.energy),a.alpha<.002&&(a.alpha=0);},b.Alpha=K,b.Util.inherits(L,b.Behaviour),L.prototype.reset=function(a,c,d,e){c==null||c==undefined?this._same=!0:this._same=!1,this.a=b.createSpan(b.Util.initValue(a,1)),this.b=b.createSpan(c),d&&L._super_.prototype.reset.call(this,d,e);},L.prototype.initialize=function(a){a.transform.scaleA=this.a.getValue(),a.transform.oldRadius=a.radius,this._same?a.transform.scaleB=a.transform.scaleA:a.transform.scaleB=this.b.getValue();},L.prototype.applyBehaviour=function(a,c,d){L._super_.prototype.applyBehaviour.call(this,a,c,d),a.scale=b.MathUtils.lerp(a.transform.scaleA,a.transform.scaleB,this.energy),a.scale<5e-4&&(a.scale=0),a.radius=a.transform.oldRadius*a.scale;},b.Scale=L,b.Util.inherits(M,b.Behaviour),M.prototype.reset=function(a,c,d,e,f){this.a=a||0,this.b=c||0,this.c=d||0,a===undefined||a=="same"?this._type="same":c==undefined?this._type="set":d===undefined?this._type="to":(this._type="add",this.a=b.createSpan(this.a*b.DR),this.b=b.createSpan(this.b*b.DR),this.c=b.createSpan(this.c*b.DR)),e&&M._super_.prototype.reset.call(this,e,f);},M.prototype.initialize=function(a){switch(this._type){case"same":break;case"set":this._setRotation(a.rotation,this.a);break;case"to":a.transform.fR=a.transform.fR||new b.Vector3D,a.transform.tR=a.transform.tR||new b.Vector3D,this._setRotation(a.transform.fR,this.a),this._setRotation(a.transform.tR,this.b);break;case"add":a.transform.addR=new b.Vector3D(this.a.getValue(),this.b.getValue(),this.c.getValue());}},M.prototype._setRotation=function(a,c){a=a||new b.Vector3D;if(c=="random"){var d=b.MathUtils.randomAToB(-b.PI,b.PI),e=b.MathUtils.randomAToB(-b.PI,b.PI),f=b.MathUtils.randomAToB(-b.PI,b.PI);a.set(d,e,f);}else c instanceof b.Vector3D&&a.copy(c);},M.prototype.applyBehaviour=function(a,c,d){M._super_.prototype.applyBehaviour.call(this,a,c,d);switch(this._type){case"same":a.rotation||(a.rotation=new b.Vector3D),a.rotation.eulerFromDir(a.v);break;case"set":break;case"to":a.rotation.x=b.MathUtils.lerp(a.transform.fR.x,a.transform.tR.x,this.energy),a.rotation.y=b.MathUtils.lerp(a.transform.fR.y,a.transform.tR.y,this.energy),a.rotation.z=b.MathUtils.lerp(a.transform.fR.z,a.transform.tR.z,this.energy);break;case"add":a.rotation.add(a.transform.addR);}},b.Rotate=M,b.Util.inherits(N,b.Behaviour),N.prototype.reset=function(a,c,d,e){c==null||c==undefined?this._same=!0:this._same=!1,this.a=b.createArraySpan(a),this.b=b.createArraySpan(c),d&&N._super_.prototype.reset.call(this,d,e);},N.prototype.initialize=function(a){a.transform.colorA=b.ColorUtil.getRGB(this.a.getValue()),a.useColor=!0,this._same?a.transform.colorB=a.transform.colorA:a.transform.colorB=b.ColorUtil.getRGB(this.b.getValue());},N.prototype.applyBehaviour=function(a,c,d){N._super_.prototype.applyBehaviour.call(this,a,c,d),this._same?(a.color.r=a.transform.colorA.r,a.color.g=a.transform.colorA.g,a.color.b=a.transform.colorA.b):(a.color.r=b.MathUtils.lerp(a.transform.colorA.r,a.transform.colorB.r,this.energy),a.color.g=b.MathUtils.lerp(a.transform.colorA.g,a.transform.colorB.g,this.energy),a.color.b=b.MathUtils.lerp(a.transform.colorA.b,a.transform.colorB.b,this.energy));},b.Color=N,b.Util.inherits(O,b.Behaviour),O.prototype.reset=function(a,c,d,e,f){this.pos?this.pos.set(a,c,d):this.pos=new b.Vector3D(a,c,d),this.spring=e||.1,this.friction=f||.98;},O.prototype.applyBehaviour=function(a,b,c){O._super_.prototype.applyBehaviour.call(this,a,b,c),a.v.x+=(this.pos.x-a.p.x)*this.spring,a.v.y+=(this.pos.y-a.p.y)*this.spring,a.v.z+=(this.pos.z-a.p.z)*this.spring;},b.Spring=O,P.ID=0,b.Util.inherits(P,b.Particle),b.EventDispatcher.initialize(P.prototype),P.prototype.emit=function(a,c){this.currentEmitTime=0,this.totalEmitTimes=b.Util.initValue(a,Infinity),c==!0||c=="life"||c=="destroy"?this.life=a=="once"?1:this.totalEmitTimes:isNaN(c)||(this.life=c),this.rate.init();},P.prototype.stopEmit=function(){this.totalEmitTimes=-1,this.currentEmitTime=0;},P.prototype.removeAllParticles=function(){var a=this.particles.length;while(a--)this.particles[a].dead=!0;},P.prototype.createParticle=function(a,c){var d=this.parent.pool.get(b.Particle);this.setupParticle(d,a,c),this.parent&&this.parent.dispatchEvent("PARTICLE_CREATED",d),b.bindEmtterEvent&&this.dispatchEvent("PARTICLE_CREATED",d);return d},P.prototype.addSelfInitialize=function(a){a.init?a.init(this):this.initAll();},P.prototype.addInitialize=function(){var a=arguments.length;while(a--)this.initializes.push(arguments[a]);},P.prototype.removeInitialize=function(a){var b=this.initializes.indexOf(a);b>-1&&this.initializes.splice(b,1);},P.prototype.removeInitializers=function(){b.Util.destroyArray(this.initializes);},P.prototype.addBehaviour=function(){var a=arguments.length;while(a--)this.behaviours.push(arguments[a]);},P.prototype.removeBehaviour=function(a){var b=this.behaviours.indexOf(a);b>-1&&this.behaviours.splice(b,1);},P.prototype.removeAllBehaviours=function(){b.Util.destroyArray(this.behaviours);},P.prototype.integrate=function(a){var c=1-this.damping;b.integrator.integrate(this,a,c);var d=this.particles.length;while(d--){var e=this.particles[d];e.update(a,d),b.integrator.integrate(e,a,c),this.parent&&this.parent.dispatchEvent("PARTICLE_UPDATE",e),b.bindEmtterEvent&&this.dispatchEvent("PARTICLE_UPDATE",e);}},P.prototype.emitting=function(a){if(this.totalEmitTimes=="once"){var b=this.rate.getValue(99999);b>0&&(this.cID=b);while(b--)this.createParticle();this.totalEmitTimes="none";}else if(!isNaN(this.totalEmitTimes)){this.currentEmitTime+=a;if(this.currentEmitTime<this.totalEmitTimes){var b=this.rate.getValue(a);b>0&&(this.cID=b);while(b--)this.createParticle();}}},P.prototype.update=function(a){this.age+=a,(this.dead||this.age>=this.life)&&this.destroy(),this.emitting(a),this.integrate(a);var c,d=this.particles.length;while(d--)c=this.particles[d],c.dead&&(this.parent&&this.parent.dispatchEvent("PARTICLE_DEAD",c),b.bindEmtterEvent&&this.dispatchEvent("PARTICLE_DEAD",c),this.parent.pool.expire(c.reset()),this.particles.splice(d,1));},P.prototype.setupParticle=function(a,c,d){var e=this.initializes,f=this.behaviours;c&&(b.Util.isArray(c)?e=c:e=[c]),d&&(b.Util.isArray(d)?f=d:f=[d]),b.InitializeUtil.initialize(this,a,e),a.addBehaviours(f),a.parent=this,this.particles.push(a);},P.prototype.destroy=function(){this.dead=!0,this.energy=0,this.totalEmitTimes=-1,this.particles.length==0&&(this.removeInitializers(),this.removeAllBehaviours(),this.parent&&this.parent.removeEmitter(this));},b.Emitter=P,b.Util.inherits(Q,b.Emitter),Q.prototype.addSelfBehaviour=function(){var a=arguments.length,b;for(b=0;b<a;b++)this.selfBehaviours.push(arguments[b]);},Q.prototype.removeSelfBehaviour=function(a){var b=this.selfBehaviours.indexOf(a);b>-1&&this.selfBehaviours.splice(b,1);},Q.prototype.update=function(a){Q._super_.prototype.update.call(this,a);if(!this.sleep){var b=this.selfBehaviours.length,c;for(c=0;c<b;c++)this.selfBehaviours[c].applyBehaviour(this,a,c);}},b.BehaviourEmitter=Q,b.Util.inherits(R,b.Emitter),R.prototype.initEventHandler=function(){var a=this;this.mousemoveHandler=function(b){a.mousemove.call(a,b);},this.mousedownHandler=function(b){a.mousedown.call(a,b);},this.mouseupHandler=function(b){a.mouseup.call(a,b);},this.mouseTarget.addEventListener("mousemove",this.mousemoveHandler,!1);},R.prototype.emit=function(){this._allowEmitting=!0;},R.prototype.stopEmit=function(){this._allowEmitting=!1;},R.prototype.setCameraAndCanvas=function(a,b){this.camera=a,this.canvas=b;},R.prototype.setCameraAndRenderer=function(a,b){this.camera=a,this.renderer=b,this.canvas=b.domElement;},R.prototype.mousemove=function(a){var c=this.canvas.getBoundingClientRect(),d=a.clientX-c.left,e=a.clientY-c.top,f=this.renderer?this.renderer.getPixelRatio():1;d*=f,e*=f,this.mouse.x+=(d-this.mouse.x)*this.ease,this.mouse.y+=(e-this.mouse.y)*this.ease,this.p.copy(b.THREEUtil.toSpacePos(this.mouse,this.camera,this.canvas,this.renderer)),this._allowEmitting&&R._super_.prototype.emit.call(this,"once");},R.prototype.destroy=function(){R._super_.prototype.destroy.call(this),this.mouseTarget.removeEventListener("mousemove",this.mousemoveHandler,!1);},b.FollowEmitter=R;var S=S||{easeLinear:function(a){return a},easeInQuad:function(a){return Math.pow(a,2)},easeOutQuad:function(a){return -(Math.pow(a-1,2)-1)},easeInOutQuad:function(a){if((a/=.5)<1)return .5*Math.pow(a,2);return -0.5*((a-=2)*a-2)},easeInCubic:function(a){return Math.pow(a,3)},easeOutCubic:function(a){return Math.pow(a-1,3)+1},easeInOutCubic:function(a){if((a/=.5)<1)return .5*Math.pow(a,3);return .5*(Math.pow(a-2,3)+2)},easeInQuart:function(a){return Math.pow(a,4)},easeOutQuart:function(a){return -(Math.pow(a-1,4)-1)},easeInOutQuart:function(a){if((a/=.5)<1)return .5*Math.pow(a,4);return -0.5*((a-=2)*Math.pow(a,3)-2)},easeInSine:function(a){return -Math.cos(a*(b.PI/2))+1},easeOutSine:function(a){return Math.sin(a*(b.PI/2))},easeInOutSine:function(a){return -0.5*(Math.cos(b.PI*a)-1)},easeInExpo:function(a){return a===0?0:Math.pow(2,10*(a-1))},easeOutExpo:function(a){return a===1?1:-Math.pow(2,-10*a)+1},easeInOutExpo:function(a){if(a===0)return 0;if(a===1)return 1;if((a/=.5)<1)return .5*Math.pow(2,10*(a-1));return .5*(-Math.pow(2,-10*--a)+2)},easeInCirc:function(a){return -(Math.sqrt(1-a*a)-1)},easeOutCirc:function(a){return Math.sqrt(1-Math.pow(a-1,2))},easeInOutCirc:function(a){if((a/=.5)<1)return -0.5*(Math.sqrt(1-a*a)-1);return .5*(Math.sqrt(1-(a-=2)*a)+1)},easeInBack:function(a){var b=1.70158;return a*a*((b+1)*a-b)},easeOutBack:function(a){var b=1.70158;return (a=a-1)*a*((b+1)*a+b)+1},easeInOutBack:function(a){var b=1.70158;if((a/=.5)<1)return .5*a*a*(((b*=1.525)+1)*a-b);return .5*((a-=2)*a*(((b*=1.525)+1)*a+b)+2)},setEasingByName:function(a){return S[a]?S[a]:S.easeLinear}};for(var T in S)T!="setEasingByName"&&(b[T]=S[T]);b.ease=S,U.prototype={init:function(a){var b=this;this.proton=a,this.proton.addEventListener("PROTON_UPDATE",function(a){b.onProtonUpdate.call(b,a);}),this.proton.addEventListener("PARTICLE_CREATED",function(a){b.onParticleCreated.call(b,a);}),this.proton.addEventListener("PARTICLE_UPDATE",function(a){b.onParticleUpdate.call(b,a);}),this.proton.addEventListener("PARTICLE_DEAD",function(a){b.onParticleDead.call(b,a);});},remove:function(a){this.proton=null;},onParticleCreated:function(a){},onParticleUpdate:function(a){},onParticleDead:function(a){},onProtonUpdate:function(a){}},b.BaseRender=U,b.Util.inherits(V,b.BaseRender),V.prototype.onProtonUpdate=function(){},V.prototype.onParticleCreated=function(a){if(!a.target){a.body||(a.body=this._body),a.target=this._targetPool.get(a.body);if(a.useAlpha||a.useColor)a.target.material.__puid=b.PUID.id(a.body.material),a.target.material=this._materialPool.get(a.target.material);}a.target&&(a.target.position.copy(a.p),this.container.add(a.target));},V.prototype.onParticleUpdate=function(a){a.target&&(a.target.position.copy(a.p),a.target.rotation.set(a.rotation.x,a.rotation.y,a.rotation.z),this.scale(a),a.useAlpha&&(a.target.material.opacity=a.alpha,a.target.material.transparent=!0),a.useColor&&a.target.material.color.copy(a.color));},V.prototype.scale=function(a){a.target.scale.set(a.scale,a.scale,a.scale);},V.prototype.onParticleDead=function(a){a.target&&((a.useAlpha||a.useColor)&&this._materialPool.expire(a.target.material),this._targetPool.expire(a.target),this.container.remove(a.target),a.target=null);},b.MeshRender=V,b.Util.inherits(W,b.BaseRender),W.prototype.onProtonUpdate=function(){},W.prototype.onParticleCreated=function(b){b.target||(b.target=new a.Vector3),b.target.copy(b.p),this.points.geometry.vertices.push(b.target);},W.prototype.onParticleUpdate=function(a){a.target&&a.target.copy(a.p);},W.prototype.onParticleDead=function(a){if(a.target){var b=this.points.geometry.vertices.indexOf(a.target);b>-1&&this.points.geometry.vertices.splice(b,1),a.target=null;}},b.PointsRender=W,b.Util.inherits(X,b.MeshRender),X.prototype.scale=function(a){a.target.scale.set(a.scale*a.radius,a.scale*a.radius,1);},b.SpriteRender=X,b.Util.inherits(Y,b.BaseRender),Y.prototype.onProtonUpdate=function(){},Y.prototype.onParticleCreated=function(a){},Y.prototype.onParticleUpdate=function(a){},Y.prototype.onParticleDead=function(a){},b.CustomRender=Y,Z.prototype={getPosition:function(){return null},crossing:function(a){switch(this.crossType){case"bound":this._bound(a);break;case"cross":this._cross(a);break;case"dead":this._dead(a);}},_dead:function(a){},_bound:function(a){},_cross:function(a){}},b.Zone=Z,b.Util.inherits($,b.Zone),$.prototype.getPosition=function(){this.random=Math.random(),this.vector.x=this.x1+this.random*(this.x2-this.x1),this.vector.y=this.y1+this.random*(this.y2-this.y1),this.vector.z=this.z1+this.random*(this.z2-this.z1);return this.vector},$.prototype.crossing=function(a){this.log&&(console.error("Sorry LineZone does not support crossing method"),this.log=!1);},b.LineZone=$,b.Util.inherits(_,b.Zone),_.prototype.getPosition=function(){var a,c,d;return function(){this.random=Math.random(),d=this.random*this.radius,a=b.PI*Math.random(),c=b.PI*2*Math.random(),this.vector.x=this.x+d*Math.sin(a)*Math.cos(c),this.vector.y=this.y+d*Math.sin(c)*Math.sin(a),this.vector.z=this.z+d*Math.cos(a);return this.vector}}(),_.prototype._dead=function(a){var b=a.p.distanceTo(this);b-a.radius>this.radius&&(a.dead=!0);},_.prototype._bound=function(){var a=new b.Vector3D,c=new b.Vector3D,d;return function(b){var e=b.p.distanceTo(this);e+b.radius>=this.radius&&(a.copy(b.p).sub(this).normalize(),c.copy(b.v),d=2*c.dot(a),b.v.sub(a.scalar(d)));}}(),_.prototype._cross=function(a){this.log&&(console.error("Sorry SphereZone does not support _cross method"),this.log=!1);},b.SphereZone=_,b.Util.inherits(ba,b.Zone),ba.prototype.getPosition=function(){var a=this.geometry.vertices,b=a[a.length*Math.random()>>0];this.vector.x=b.x*this.scale,this.vector.y=b.y*this.scale,this.vector.z=b.z*this.scale;return this.vector},ba.prototype.crossing=function(a){this.log&&(console.error("Sorry MeshZone does not support crossing method"),this.log=!1);},b.MeshZone=ba,b.Util.inherits(bb,b.Zone),bb.prototype.getPosition=function(){this.vector.x=this.x,this.vector.y=this.y,this.vector.z=this.z;return this.vector},bb.prototype.crossing=function(a){this.log&&(console.error("Sorry PointZone does not support crossing method"),this.log=!1);},b.PointZone=bb,b.Util.inherits(bc,b.Zone),bc.prototype.getPosition=function(){this.vector.x=this.x+b.MathUtils.randomAToB(-0.5,.5)*this.width,this.vector.y=this.y+b.MathUtils.randomAToB(-0.5,.5)*this.height,this.vector.z=this.z+b.MathUtils.randomAToB(-0.5,.5)*this.depth;return this.vector},bc.prototype._dead=function(a){a.p.x+a.radius<this.x-this.width/2?a.dead=!0:a.p.x-a.radius>this.x+this.width/2&&(a.dead=!0),a.p.y+a.radius<this.y-this.height/2?a.dead=!0:a.p.y-a.radius>this.y+this.height/2&&(a.dead=!0),a.p.z+a.radius<this.z-this.depth/2?a.dead=!0:a.p.z-a.radius>this.z+this.depth/2&&(a.dead=!0);},bc.prototype._bound=function(a){a.p.x-a.radius<this.x-this.width/2?(a.p.x=this.x-this.width/2+a.radius,a.v.x*=-this.friction,this._static(a,"x")):a.p.x+a.radius>this.x+this.width/2&&(a.p.x=this.x+this.width/2-a.radius,a.v.x*=-this.friction,this._static(a,"x")),a.p.y-a.radius<this.y-this.height/2?(a.p.y=this.y-this.height/2+a.radius,a.v.y*=-this.friction,this._static(a,"y")):a.p.y+a.radius>this.y+this.height/2&&(a.p.y=this.y+this.height/2-a.radius,a.v.y*=-this.friction,this._static(a,"y")),a.p.z-a.radius<this.z-this.depth/2?(a.p.z=this.z-this.depth/2+a.radius,a.v.z*=-this.friction,this._static(a,"z")):a.p.z+a.radius>this.z+this.depth/2&&(a.p.z=this.z+this.depth/2-a.radius,a.v.z*=-this.friction,this._static(a,"z"));},bc.prototype._static=function(a,b){a.v[b]*a.a[b]>0||Math.abs(a.v[b])<Math.abs(a.a[b])*.0167*this.max&&(a.v[b]=0,a.a[b]=0);},bc.prototype._cross=function(a){a.p.x+a.radius<this.x-this.width/2&&a.v.x<=0?a.p.x=this.x+this.width/2+a.radius:a.p.x-a.radius>this.x+this.width/2&&a.v.x>=0&&(a.p.x=this.x-this.width/2-a.radius),a.p.y+a.radius<this.y-this.height/2&&a.v.y<=0?a.p.y=this.y+this.height/2+a.radius:a.p.y-a.radius>this.y+this.height/2&&a.v.y>=0&&(a.p.y=this.y-this.height/2-a.radius),a.p.z+a.radius<this.z-this.depth/2&&a.v.z<=0?a.p.z=this.z+this.depth/2+a.radius:a.p.z-a.radius>this.z+this.depth/2&&a.v.z>=0&&(a.p.z=this.z-this.depth/2-a.radius);},b.BoxZone=bc,b.Util.inherits(bd,b.Zone),bd.prototype.getPosition=function(){var a=new b.Vector3D,c;return function(){c=this.renderer.domElement,a.x=Math.random()*c.width,a.y=Math.random()*c.height,this.vector.copy(b.THREEUtil.toSpacePos(a,this.camera,c));return this.vector}}(),bd.prototype._dead=function(a){var c=b.THREEUtil.toScreenPos(a.p,this.camera,this.renderer.domElement),d=this.renderer.domElement;c.y+a.radius<-this.dis&&this.d1?a.dead=!0:c.y-a.radius>d.height+this.dis&&this.d3&&(a.dead=!0),c.x+a.radius<-this.dis&&this.d4?a.dead=!0:c.x-a.radius>d.width+this.dis&&this.d2&&(a.dead=!0);},bd.prototype._cross=function(){var a=new b.Vector3D;return function(c){var d=b.THREEUtil.toScreenPos(c.p,this.camera,this.renderer.domElement),e=this.renderer.domElement;d.y+c.radius<-this.dis?(a.x=d.x,a.y=e.height+this.dis+c.radius,c.p.y=b.THREEUtil.toSpacePos(a,this.camera,e).y):d.y-c.radius>e.height+this.dis&&(a.x=d.x,a.y=-this.dis-c.radius,c.p.y=b.THREEUtil.toSpacePos(a,this.camera,e).y),d.x+c.radius<-this.dis?(a.y=d.y,a.x=e.width+this.dis+c.radius,c.p.x=b.THREEUtil.toSpacePos(a,this.camera,e).x):d.x-c.radius>e.width+this.dis&&(a.y=d.y,a.x=-this.dis-c.radius,c.p.x=b.THREEUtil.toSpacePos(a,this.camera,e).x);}}(),bd.prototype._bound=function(a){var c=b.THREEUtil.toScreenPos(a.p,this.camera,this.renderer.domElement),d=this.renderer.domElement;c.y+a.radius<-this.dis?a.v.y*=-1:c.y-a.radius>d.height+this.dis&&(a.v.y*=-1),c.x+a.radius<-this.dis?a.v.y*=-1:c.x-a.radius>d.width+this.dis&&(a.v.y*=-1);},b.ScreenZone=bd;var be=function(){if(window.console&&window.console.trace){var a=Array.prototype.slice.call(arguments),b=arguments[0]+"";if(b.indexOf("+")==0){var c=parseInt(arguments[0]);be.once<c&&(a.shift(),console.trace.apply(console,a),be.once++);}else a.unshift("+15"),be.apply(console,a);}};be.once=0,b.log=be;var bf=bf||{addEventListener:function(a,b){a.addEventListener("PROTON_UPDATE",function(a){b(a);});},drawZone:function(c,d,e){var f,g,h;e instanceof b.PointZone?f=new a.SphereGeometry(15):e instanceof b.LineZone||(e instanceof b.BoxZone?f=new a.BoxGeometry(e.width,e.height,e.depth):e instanceof b.SphereZone?f=new a.SphereGeometry(e.radius,10,10):e instanceof b.MeshZone&&(e.geometry instanceof a.Geometry?f=e.geometry:f=e.geometry.geometry,f=new a.SphereGeometry(e.radius,10,10))),g=new a.MeshBasicMaterial({color:"#2194ce",wireframe:!0}),h=new a.Mesh(f,g),d.add(h),this.addEventListener(c,function(a){h.position.set(e.x,e.y,e.z);});},drawEmitter:function(b,c,d,e){var f=new a.OctahedronGeometry(15),g=new a.MeshBasicMaterial({color:e||"#aaa",wireframe:!0}),h=new a.Mesh(f,g);c.add(h),this.addEventListener(b,function(){h.position.copy(d.p),h.rotation.set(d.rotation.x,d.rotation.y,d.rotation.z);});},renderInfo:function(){function b(a){var b=a.emitters[0];return Math.round(b.p.x)+","+Math.round(b.p.y)+","+Math.round(b.p.z)}function a(a,b){var c=b=="material"?"_materialPool":"_targetPool",d=a.renderers[0];return d[c].cID}return function(c,d){this.addInfo(d);var e="";switch(this._infoType){case 2:e+="emitter:"+c.emitters.length+"<br>",e+="em speed:"+c.emitters[0].cID+"<br>",e+="pos:"+b(c);break;case 3:e+=c.renderers[0].name+"<br>",e+="target:"+a(c,"target")+"<br>",e+="material:"+a(c,"material");break;default:e+="particles:"+c.getCount()+"<br>",e+="pool:"+c.pool.getCount()+"<br>",e+="total:"+(c.getCount()+c.pool.getCount());}this._infoCon.innerHTML=e;}}(),addInfo:function(){return function(a){var b=this;if(!this._infoCon){this._infoCon=document.createElement("div"),this._infoCon.style.cssText=["position:fixed;bottom:0px;left:0;cursor:pointer;","opacity:0.9;z-index:10000;padding:10px;font-size:12px;","width:120px;height:50px;background-color:#002;color:#0ff;"].join(""),this._infoType=1,this._infoCon.addEventListener("click",function(a){b._infoType++,b._infoType>3&&(b._infoType=1);},!1);var c,d;switch(a){case 2:c="#201",d="#f08";break;case 3:c="#020",d="#0f0";break;default:c="#002",d="#0ff";}this._infoCon.style["background-color"]=c,this._infoCon.style.color=d;}this._infoCon.parentNode||document.body.appendChild(this._infoCon);}}()};b.Debug=bf;return b});
|
|
85869
|
+
}(three_proton_min));
|
|
85870
|
+
|
|
85871
|
+
var Proton = three_proton_min.exports;var ParticleEmitterGroup = /*#__PURE__*/function (_Entity) {
|
|
85492
85872
|
_inherits(ParticleEmitterGroup, _Entity);
|
|
85493
85873
|
|
|
85494
85874
|
var _super = _createSuper(ParticleEmitterGroup);
|
|
@@ -85667,7 +86047,7 @@ var index$1=/*#__PURE__*/Object.freeze({__proto__:null,Emitter:k,Particle:P,Part
|
|
|
85667
86047
|
}]);
|
|
85668
86048
|
|
|
85669
86049
|
return ParticleEmitterGroup;
|
|
85670
|
-
}(Entity);var _excluded$
|
|
86050
|
+
}(Entity);var _excluded$5 = ["initializers", "behaviours", "texture", "color", "rate"];
|
|
85671
86051
|
var DEFAULT_PARTICLE_COLOR = PALETTES.BASE.BLACK;
|
|
85672
86052
|
var SYSTEM_DISPOSE_TIMEOUT = 700;
|
|
85673
86053
|
|
|
@@ -85692,7 +86072,7 @@ var ProtonParticleEmitter = /*#__PURE__*/function (_ParticleEmitter) {
|
|
|
85692
86072
|
_options$color = options.color,
|
|
85693
86073
|
color = _options$color === void 0 ? DEFAULT_PARTICLE_COLOR : _options$color,
|
|
85694
86074
|
rate = options.rate,
|
|
85695
|
-
rest = _objectWithoutProperties(options, _excluded$
|
|
86075
|
+
rest = _objectWithoutProperties(options, _excluded$5);
|
|
85696
86076
|
|
|
85697
86077
|
var parsedOptions = _objectSpread2$1({
|
|
85698
86078
|
initializers: initializers,
|
|
@@ -85901,7 +86281,7 @@ var Explosion = /*#__PURE__*/function (_ParticleEmitterGroup) {
|
|
|
85901
86281
|
}
|
|
85902
86282
|
|
|
85903
86283
|
return Explosion;
|
|
85904
|
-
}(ParticleEmitterGroup);var _excluded$
|
|
86284
|
+
}(ParticleEmitterGroup);var _excluded$4 = ["texture", "direction", "size", "strength", "colors"];
|
|
85905
86285
|
|
|
85906
86286
|
var getFireRate = function getFireRate() {
|
|
85907
86287
|
return new Proton.Rate(new Proton.Span(10, 15), new Proton.Span(.05, .1));
|
|
@@ -85933,7 +86313,7 @@ var Fire = /*#__PURE__*/function (_ProtonParticleEmitte) {
|
|
|
85933
86313
|
_options$strength = options.strength,
|
|
85934
86314
|
strength = _options$strength === void 0 ? 100 : _options$strength,
|
|
85935
86315
|
colors = options.colors,
|
|
85936
|
-
rest = _objectWithoutProperties(options, _excluded$
|
|
86316
|
+
rest = _objectWithoutProperties(options, _excluded$4);
|
|
85937
86317
|
|
|
85938
86318
|
var fireOptions = _objectSpread2$1({
|
|
85939
86319
|
rate: getFireRate(),
|
|
@@ -90107,7 +90487,7 @@ var unmount = function unmount() {
|
|
|
90107
90487
|
render(null, container); // removing the container as well
|
|
90108
90488
|
|
|
90109
90489
|
removeElement(id);
|
|
90110
|
-
};var _excluded$
|
|
90490
|
+
};var _excluded$3 = ["Component", "format", "width", "height"];
|
|
90111
90491
|
|
|
90112
90492
|
var Label = /*#__PURE__*/function (_Element) {
|
|
90113
90493
|
_inherits(Label, _Element);
|
|
@@ -90122,7 +90502,7 @@ var Label = /*#__PURE__*/function (_Element) {
|
|
|
90122
90502
|
format = _ref$format === void 0 ? 'png' : _ref$format,
|
|
90123
90503
|
_width = _ref.width,
|
|
90124
90504
|
_height = _ref.height,
|
|
90125
|
-
options = _objectWithoutProperties(_ref, _excluded$
|
|
90505
|
+
options = _objectWithoutProperties(_ref, _excluded$3);
|
|
90126
90506
|
|
|
90127
90507
|
_classCallCheck(this, Label);
|
|
90128
90508
|
|
|
@@ -90316,34 +90696,109 @@ var Cone = /*#__PURE__*/function (_Element) {
|
|
|
90316
90696
|
}
|
|
90317
90697
|
|
|
90318
90698
|
return Cone;
|
|
90319
|
-
}(Element$1);var
|
|
90320
|
-
|
|
90321
|
-
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
90699
|
+
}(Element$1);var Sound = /*#__PURE__*/function (_Entity) {
|
|
90700
|
+
_inherits(Sound, _Entity);
|
|
90322
90701
|
|
|
90323
|
-
|
|
90702
|
+
var _super = _createSuper(Sound);
|
|
90324
90703
|
|
|
90325
|
-
|
|
90326
|
-
|
|
90327
|
-
|
|
90328
|
-
|
|
90329
|
-
|
|
90330
|
-
this
|
|
90331
|
-
|
|
90704
|
+
function Sound() {
|
|
90705
|
+
var _this;
|
|
90706
|
+
|
|
90707
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
90708
|
+
|
|
90709
|
+
_classCallCheck(this, Sound);
|
|
90710
|
+
|
|
90711
|
+
var source = options.source,
|
|
90712
|
+
_options$loop = options.loop,
|
|
90713
|
+
loop = _options$loop === void 0 ? false : _options$loop,
|
|
90714
|
+
loopStart = options.loopStart,
|
|
90715
|
+
loopEnd = options.loopEnd,
|
|
90716
|
+
autoplay = options.autoplay,
|
|
90717
|
+
reconnectOnReset = options.reconnectOnReset,
|
|
90718
|
+
_options$name = options.name,
|
|
90719
|
+
name = _options$name === void 0 ? generateRandomName('sound') : _options$name;
|
|
90720
|
+
_this = _super.call(this, _objectSpread2$1(_objectSpread2$1({}, options), {}, {
|
|
90721
|
+
source: source,
|
|
90722
|
+
loop: loop,
|
|
90723
|
+
loopStart: loopStart,
|
|
90724
|
+
loopEnd: loopEnd,
|
|
90725
|
+
autoplay: autoplay,
|
|
90726
|
+
reconnectOnReset: reconnectOnReset,
|
|
90727
|
+
name: name
|
|
90728
|
+
}));
|
|
90729
|
+
|
|
90730
|
+
_defineProperty$1(_assertThisInitialized(_this), "reset", function () {
|
|
90731
|
+
_this.playing = false;
|
|
90732
|
+
|
|
90733
|
+
_this.disconnect();
|
|
90734
|
+
|
|
90735
|
+
_this.setupAudio();
|
|
90736
|
+
|
|
90737
|
+
_this.connect();
|
|
90738
|
+
});
|
|
90739
|
+
|
|
90740
|
+
_this.source = source;
|
|
90741
|
+
_this.loop = loop;
|
|
90742
|
+
_this.loopStart = loopStart;
|
|
90743
|
+
_this.loopEnd = loopEnd;
|
|
90744
|
+
_this.autoplay = autoplay;
|
|
90745
|
+
_this.reconnectOnReset = reconnectOnReset;
|
|
90746
|
+
_this.name = name;
|
|
90747
|
+
_this.connected = false;
|
|
90748
|
+
_this.playing = false;
|
|
90749
|
+
_this.hasPlayed = false;
|
|
90750
|
+
_this.buffer = null;
|
|
90751
|
+
_this.audioNode = null;
|
|
90752
|
+
_this.volumeNode = null;
|
|
90753
|
+
|
|
90754
|
+
_this.setupAudio();
|
|
90755
|
+
|
|
90756
|
+
_this.setName(name);
|
|
90757
|
+
|
|
90758
|
+
_this.setBody({
|
|
90759
|
+
body: new Object3D()
|
|
90760
|
+
});
|
|
90761
|
+
|
|
90762
|
+
_this.setEntityType(ENTITY_TYPES.AUDIO.DEFAULT);
|
|
90763
|
+
|
|
90764
|
+
Audio$1.add(_assertThisInitialized(_this));
|
|
90765
|
+
return _this;
|
|
90332
90766
|
}
|
|
90333
90767
|
|
|
90334
|
-
_createClass(
|
|
90335
|
-
key: "
|
|
90336
|
-
value: function
|
|
90337
|
-
this.
|
|
90768
|
+
_createClass(Sound, [{
|
|
90769
|
+
key: "setupAudio",
|
|
90770
|
+
value: function setupAudio() {
|
|
90771
|
+
this.createAudioNode();
|
|
90338
90772
|
this.createVolumeNode();
|
|
90339
90773
|
this.setBuffer();
|
|
90340
|
-
this.
|
|
90774
|
+
this.setupAudioNodeLoop();
|
|
90775
|
+
this.audioNode.removeEventListener(ENTITY_EVENTS.AUDIO.ENDED, this.onSoundEnded.bind(this));
|
|
90776
|
+
this.audioNode.addEventListener(ENTITY_EVENTS.AUDIO.ENDED, this.onSoundEnded.bind(this));
|
|
90777
|
+
}
|
|
90778
|
+
}, {
|
|
90779
|
+
key: "createAudioNode",
|
|
90780
|
+
value: function createAudioNode() {
|
|
90781
|
+
this.audioNode = Audio$1.context.createBufferSource();
|
|
90782
|
+
}
|
|
90783
|
+
}, {
|
|
90784
|
+
key: "setupAudioNodeLoop",
|
|
90785
|
+
value: function setupAudioNodeLoop() {
|
|
90786
|
+
this.audioNode.loop = this.loop;
|
|
90787
|
+
this.audioNode.loopEnd = this.loopEnd === undefined ? this.duration : this.loopEnd;
|
|
90788
|
+
this.audioNode.loopStart = this.loopStart === undefined ? this.duration : this.loopStart;
|
|
90341
90789
|
}
|
|
90342
90790
|
}, {
|
|
90343
90791
|
key: "createVolumeNode",
|
|
90344
90792
|
value: function createVolumeNode() {
|
|
90345
90793
|
this.volumeNode = Audio$1.context.createGain();
|
|
90346
|
-
this.volumeNode.gain.value =
|
|
90794
|
+
this.volumeNode.gain.value = DEFAULT_AUDIO_NODE_VOLUME;
|
|
90795
|
+
}
|
|
90796
|
+
}, {
|
|
90797
|
+
key: "tryAutoplay",
|
|
90798
|
+
value: function tryAutoplay() {
|
|
90799
|
+
if (this.autoplay && !this.hasPlayed) {
|
|
90800
|
+
this.play();
|
|
90801
|
+
}
|
|
90347
90802
|
}
|
|
90348
90803
|
}, {
|
|
90349
90804
|
key: "connect",
|
|
@@ -90353,33 +90808,24 @@ var Cone = /*#__PURE__*/function (_Element) {
|
|
|
90353
90808
|
}
|
|
90354
90809
|
|
|
90355
90810
|
this.volumeNode.connect(Audio$1.getMasterVolumeNode());
|
|
90356
|
-
this.
|
|
90811
|
+
this.audioNode.connect(this.volumeNode);
|
|
90357
90812
|
this.connected = true;
|
|
90813
|
+
this.tryAutoplay();
|
|
90358
90814
|
}
|
|
90359
90815
|
}, {
|
|
90360
90816
|
key: "disconnect",
|
|
90361
90817
|
value: function disconnect() {
|
|
90362
90818
|
if (this.connected) {
|
|
90363
90819
|
this.volumeNode.disconnect();
|
|
90364
|
-
this.
|
|
90820
|
+
this.audioNode.disconnect();
|
|
90365
90821
|
this.connected = false;
|
|
90366
90822
|
}
|
|
90367
90823
|
}
|
|
90368
|
-
}, {
|
|
90369
|
-
key: "reset",
|
|
90370
|
-
value: function reset() {
|
|
90371
|
-
this.playing = false;
|
|
90372
|
-
var reconnectOnReset = this.options.reconnectOnReset;
|
|
90373
|
-
this.disconnect();
|
|
90374
|
-
|
|
90375
|
-
if (reconnectOnReset) {
|
|
90376
|
-
this.init();
|
|
90377
|
-
this.connect();
|
|
90378
|
-
}
|
|
90379
|
-
}
|
|
90380
90824
|
}, {
|
|
90381
90825
|
key: "dispose",
|
|
90382
90826
|
value: function dispose() {
|
|
90827
|
+
_get(_getPrototypeOf(Sound.prototype), "dispose", this).call(this);
|
|
90828
|
+
|
|
90383
90829
|
this.stop();
|
|
90384
90830
|
this.disconnect();
|
|
90385
90831
|
}
|
|
@@ -90390,7 +90836,8 @@ var Cone = /*#__PURE__*/function (_Element) {
|
|
|
90390
90836
|
}
|
|
90391
90837
|
}, {
|
|
90392
90838
|
key: "setVolume",
|
|
90393
|
-
value: function setVolume(
|
|
90839
|
+
value: function setVolume() {
|
|
90840
|
+
var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DEFAULT_AUDIO_NODE_VOLUME;
|
|
90394
90841
|
this.volumeNode.gain.setValueAtTime(value, Audio$1.context.currentTime);
|
|
90395
90842
|
}
|
|
90396
90843
|
}, {
|
|
@@ -90401,7 +90848,7 @@ var Cone = /*#__PURE__*/function (_Element) {
|
|
|
90401
90848
|
}, {
|
|
90402
90849
|
key: "setBuffer",
|
|
90403
90850
|
value: function setBuffer() {
|
|
90404
|
-
var buffer = Audio$1.get(this.
|
|
90851
|
+
var buffer = Audio$1.get(this.source);
|
|
90405
90852
|
|
|
90406
90853
|
if (!buffer) {
|
|
90407
90854
|
console.error(AUDIO_UNABLE_TO_LOAD_SOUND);
|
|
@@ -90409,107 +90856,60 @@ var Cone = /*#__PURE__*/function (_Element) {
|
|
|
90409
90856
|
}
|
|
90410
90857
|
|
|
90411
90858
|
this.buffer = buffer;
|
|
90412
|
-
this.
|
|
90859
|
+
this.audioNode.buffer = buffer;
|
|
90413
90860
|
}
|
|
90414
90861
|
}, {
|
|
90415
90862
|
key: "play",
|
|
90416
90863
|
value: function play() {
|
|
90417
90864
|
var volume = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.getVolume();
|
|
90418
|
-
var delay = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] :
|
|
90865
|
+
var delay = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : DEFAULT_AUDIO_NODE_RAMP_TIME;
|
|
90419
90866
|
var ramp = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : AUDIO_RAMPS.LINEAR;
|
|
90420
|
-
if (this.playing) return;
|
|
90867
|
+
if (this.playing) return Promise.resolve();
|
|
90421
90868
|
this.setVolume(0);
|
|
90422
|
-
this.
|
|
90869
|
+
this.audioNode.start();
|
|
90870
|
+
this.hasPlayed = true;
|
|
90423
90871
|
this.playing = true;
|
|
90872
|
+
var audioDelay = delay / 1000; // linearRampToValueAtTime/exponentialRampToValueAtTime requires time to be expressed in seconds
|
|
90424
90873
|
|
|
90425
90874
|
if (ramp === AUDIO_RAMPS.LINEAR) {
|
|
90426
|
-
this.volumeNode.gain.linearRampToValueAtTime(volume, Audio$1.context.currentTime +
|
|
90875
|
+
this.volumeNode.gain.linearRampToValueAtTime(volume, Audio$1.context.currentTime + audioDelay);
|
|
90427
90876
|
} else {
|
|
90428
|
-
this.volumeNode.gain.exponentialRampToValueAtTime(volume, Audio$1.context.currentTime +
|
|
90877
|
+
this.volumeNode.gain.exponentialRampToValueAtTime(volume, Audio$1.context.currentTime + audioDelay);
|
|
90429
90878
|
}
|
|
90879
|
+
|
|
90880
|
+
return this;
|
|
90430
90881
|
}
|
|
90431
90882
|
}, {
|
|
90432
90883
|
key: "onSoundEnded",
|
|
90433
90884
|
value: function onSoundEnded() {
|
|
90434
90885
|
this.reset();
|
|
90886
|
+
this.dispatchEvent({
|
|
90887
|
+
type: ENTITY_EVENTS.AUDIO.ENDED
|
|
90888
|
+
});
|
|
90435
90889
|
}
|
|
90436
90890
|
}, {
|
|
90437
90891
|
key: "stop",
|
|
90438
90892
|
value: function stop() {
|
|
90439
|
-
var
|
|
90440
|
-
|
|
90441
|
-
var delay = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0.1;
|
|
90893
|
+
var delay = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DEFAULT_AUDIO_NODE_RAMP_TIME;
|
|
90442
90894
|
var ramp = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : AUDIO_RAMPS.LINEAR;
|
|
90895
|
+
var audioDelay = delay / 1000; // linearRampToValueAtTime/exponentialRampToValueAtTime requires time to be expressed in seconds
|
|
90443
90896
|
|
|
90444
90897
|
if (ramp === AUDIO_RAMPS.LINEAR) {
|
|
90445
|
-
this.volumeNode.gain.linearRampToValueAtTime(
|
|
90898
|
+
this.volumeNode.gain.linearRampToValueAtTime(ALMOST_ZERO, Audio$1.context.currentTime + audioDelay);
|
|
90446
90899
|
} else {
|
|
90447
|
-
this.volumeNode.gain.exponentialRampToValueAtTime(
|
|
90900
|
+
this.volumeNode.gain.exponentialRampToValueAtTime(ALMOST_ZERO, Audio$1.context.currentTime + audioDelay);
|
|
90448
90901
|
}
|
|
90449
90902
|
|
|
90450
|
-
setTimeout(
|
|
90451
|
-
|
|
90452
|
-
}, delay);
|
|
90903
|
+
setTimeout(this.reset, delay);
|
|
90904
|
+
return this;
|
|
90453
90905
|
}
|
|
90454
90906
|
}, {
|
|
90455
90907
|
key: "detune",
|
|
90456
90908
|
value: function detune(value) {
|
|
90457
|
-
if (this.
|
|
90458
|
-
this.
|
|
90909
|
+
if (this.audioNode) {
|
|
90910
|
+
this.audioNode.detune.value = value;
|
|
90459
90911
|
}
|
|
90460
90912
|
}
|
|
90461
|
-
}]);
|
|
90462
|
-
|
|
90463
|
-
return Beat;
|
|
90464
|
-
}();var Sound$1 = /*#__PURE__*/function (_Beat) {
|
|
90465
|
-
_inherits(Sound, _Beat);
|
|
90466
|
-
|
|
90467
|
-
var _super = _createSuper(Sound);
|
|
90468
|
-
|
|
90469
|
-
function Sound(name) {
|
|
90470
|
-
var _this;
|
|
90471
|
-
|
|
90472
|
-
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
90473
|
-
|
|
90474
|
-
_classCallCheck(this, Sound);
|
|
90475
|
-
|
|
90476
|
-
var _options$loop = options.loop,
|
|
90477
|
-
loop = _options$loop === void 0 ? false : _options$loop,
|
|
90478
|
-
_options$autoplay = options.autoplay,
|
|
90479
|
-
autoplay = _options$autoplay === void 0 ? false : _options$autoplay,
|
|
90480
|
-
_options$reconnectOnR = options.reconnectOnReset,
|
|
90481
|
-
reconnectOnReset = _options$reconnectOnR === void 0 ? false : _options$reconnectOnR;
|
|
90482
|
-
_this = _super.call(this, name, {
|
|
90483
|
-
loop: loop,
|
|
90484
|
-
autoplay: autoplay,
|
|
90485
|
-
reconnectOnReset: reconnectOnReset
|
|
90486
|
-
});
|
|
90487
|
-
_this.source.loop = loop;
|
|
90488
|
-
_this.target = null;
|
|
90489
|
-
_this.pannerNode = null;
|
|
90490
|
-
_this.convolverNode = null;
|
|
90491
|
-
|
|
90492
|
-
if (autoplay) {
|
|
90493
|
-
_this.play();
|
|
90494
|
-
}
|
|
90495
|
-
|
|
90496
|
-
Audio$1.add(_assertThisInitialized(_this));
|
|
90497
|
-
return _this;
|
|
90498
|
-
}
|
|
90499
|
-
|
|
90500
|
-
_createClass(Sound, [{
|
|
90501
|
-
key: "createPannerNode",
|
|
90502
|
-
value: function createPannerNode() {
|
|
90503
|
-
this.pannerNode = Audio$1.context.createPanner();
|
|
90504
|
-
this.volumeNode.disconnect();
|
|
90505
|
-
this.volumeNode.connect(this.pannerNode);
|
|
90506
|
-
this.pannerNode.connect(Audio$1.getMasterVolumeNode());
|
|
90507
|
-
}
|
|
90508
|
-
}, {
|
|
90509
|
-
key: "hasEffect",
|
|
90510
|
-
value: function hasEffect() {
|
|
90511
|
-
return !!this.convolverNode;
|
|
90512
|
-
}
|
|
90513
90913
|
}, {
|
|
90514
90914
|
key: "addEffect",
|
|
90515
90915
|
value: function addEffect(effect) {
|
|
@@ -90539,279 +90939,180 @@ var Cone = /*#__PURE__*/function (_Element) {
|
|
|
90539
90939
|
}
|
|
90540
90940
|
}
|
|
90541
90941
|
}, {
|
|
90542
|
-
key: "
|
|
90543
|
-
|
|
90544
|
-
return
|
|
90545
|
-
}
|
|
90546
|
-
}, {
|
|
90547
|
-
key: "hasTarget",
|
|
90548
|
-
value: function hasTarget() {
|
|
90549
|
-
return !!this.target;
|
|
90550
|
-
}
|
|
90551
|
-
}, {
|
|
90552
|
-
key: "getTarget",
|
|
90553
|
-
value: function getTarget() {
|
|
90554
|
-
return this.target;
|
|
90942
|
+
key: "sampleRate",
|
|
90943
|
+
get: function get() {
|
|
90944
|
+
return this.buffer.sampleRate;
|
|
90555
90945
|
}
|
|
90556
90946
|
}, {
|
|
90557
|
-
key: "
|
|
90558
|
-
|
|
90559
|
-
this.
|
|
90560
|
-
this.createPannerNode();
|
|
90947
|
+
key: "duration",
|
|
90948
|
+
get: function get() {
|
|
90949
|
+
return this.buffer.duration * 1000;
|
|
90561
90950
|
}
|
|
90562
90951
|
}, {
|
|
90563
|
-
key: "
|
|
90564
|
-
|
|
90565
|
-
|
|
90566
|
-
var p = new Vector3$1();
|
|
90567
|
-
p.setFromMatrixPosition(this.target.getBody().matrixWorld);
|
|
90568
|
-
var px = p.x,
|
|
90569
|
-
py = p.y,
|
|
90570
|
-
pz = p.z;
|
|
90571
|
-
this.target.getBody().updateMatrixWorld();
|
|
90572
|
-
var q = new Vector3$1();
|
|
90573
|
-
q.setFromMatrixPosition(this.target.getBody().matrixWorld);
|
|
90574
|
-
var dx = q.x - px,
|
|
90575
|
-
dy = q.y - py,
|
|
90576
|
-
dz = q.z - pz; //setting panner position and velocity using doppler effect.
|
|
90577
|
-
|
|
90578
|
-
try {
|
|
90579
|
-
this.panner.setPosition(q.x, q.y, q.z);
|
|
90580
|
-
this.panner.setVelocity(dx / dt, dy / dt, dz / dt);
|
|
90581
|
-
} catch (e) {// quick and dirty solution.
|
|
90582
|
-
}
|
|
90583
|
-
}
|
|
90952
|
+
key: "numberOfChannels",
|
|
90953
|
+
get: function get() {
|
|
90954
|
+
return this.buffer.numberOfChannels;
|
|
90584
90955
|
}
|
|
90585
90956
|
}]);
|
|
90586
90957
|
|
|
90587
90958
|
return Sound;
|
|
90588
|
-
}(
|
|
90589
|
-
_inherits(BackgroundSound, _Sound);
|
|
90590
|
-
|
|
90591
|
-
var _super = _createSuper(BackgroundSound);
|
|
90592
|
-
|
|
90593
|
-
function BackgroundSound() {
|
|
90594
|
-
_classCallCheck(this, BackgroundSound);
|
|
90959
|
+
}(Entity);var _excluded$2 = ["name"];
|
|
90595
90960
|
|
|
90596
|
-
|
|
90597
|
-
|
|
90961
|
+
var AmbientSound = /*#__PURE__*/function (_Sound) {
|
|
90962
|
+
_inherits(AmbientSound, _Sound);
|
|
90598
90963
|
|
|
90599
|
-
|
|
90600
|
-
key: "update",
|
|
90601
|
-
value: function update(dt) {}
|
|
90602
|
-
}, {
|
|
90603
|
-
key: "createPannerNode",
|
|
90604
|
-
value: function createPannerNode() {
|
|
90605
|
-
console.log(METHOD_NOT_SUPPORTED);
|
|
90606
|
-
}
|
|
90607
|
-
}, {
|
|
90608
|
-
key: "hasPannerNode",
|
|
90609
|
-
value: function hasPannerNode() {
|
|
90610
|
-
console.log(METHOD_NOT_SUPPORTED);
|
|
90611
|
-
}
|
|
90612
|
-
}, {
|
|
90613
|
-
key: "hasTarget",
|
|
90614
|
-
value: function hasTarget() {
|
|
90615
|
-
console.log(METHOD_NOT_SUPPORTED);
|
|
90616
|
-
}
|
|
90617
|
-
}, {
|
|
90618
|
-
key: "getTarget",
|
|
90619
|
-
value: function getTarget() {
|
|
90620
|
-
console.log(METHOD_NOT_SUPPORTED);
|
|
90621
|
-
}
|
|
90622
|
-
}, {
|
|
90623
|
-
key: "setTarget",
|
|
90624
|
-
value: function setTarget() {
|
|
90625
|
-
console.log(METHOD_NOT_SUPPORTED);
|
|
90626
|
-
}
|
|
90627
|
-
}]);
|
|
90628
|
-
|
|
90629
|
-
return BackgroundSound;
|
|
90630
|
-
}(Sound$1);var DirectionalSound = /*#__PURE__*/function (_Sound) {
|
|
90631
|
-
_inherits(DirectionalSound, _Sound);
|
|
90964
|
+
var _super = _createSuper(AmbientSound);
|
|
90632
90965
|
|
|
90633
|
-
|
|
90634
|
-
|
|
90635
|
-
function DirectionalSound(name, angles, options) {
|
|
90966
|
+
function AmbientSound(source) {
|
|
90636
90967
|
var _this;
|
|
90637
90968
|
|
|
90638
|
-
|
|
90969
|
+
var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
|
|
90970
|
+
_ref$name = _ref.name,
|
|
90971
|
+
name = _ref$name === void 0 ? generateRandomName('AmbientSound') : _ref$name,
|
|
90972
|
+
options = _objectWithoutProperties(_ref, _excluded$2);
|
|
90639
90973
|
|
|
90640
|
-
|
|
90641
|
-
var target = options.target;
|
|
90974
|
+
_classCallCheck(this, AmbientSound);
|
|
90642
90975
|
|
|
90643
|
-
|
|
90644
|
-
|
|
90976
|
+
_this = _super.call(this, _objectSpread2$1({
|
|
90977
|
+
source: source,
|
|
90978
|
+
name: name
|
|
90979
|
+
}, options));
|
|
90645
90980
|
|
|
90646
|
-
|
|
90647
|
-
|
|
90981
|
+
_this.setEntityType(ENTITY_TYPES.AUDIO.AMBIENT);
|
|
90982
|
+
|
|
90983
|
+
_this.connect();
|
|
90648
90984
|
|
|
90649
90985
|
return _this;
|
|
90650
90986
|
}
|
|
90651
90987
|
|
|
90652
|
-
|
|
90653
|
-
|
|
90654
|
-
value: function setPannerAngles(angles) {
|
|
90655
|
-
this.pannerNode.coneInnerAngle = angles.innerAngleInDegrees;
|
|
90656
|
-
this.pannerNode.coneOuterAngle = angles.outerAngleInDegrees;
|
|
90657
|
-
this.pannerNode.coneOuterGain = angles.outerGainFactor;
|
|
90658
|
-
}
|
|
90659
|
-
}, {
|
|
90660
|
-
key: "setPannerOrientation",
|
|
90661
|
-
value: function setPannerOrientation() {
|
|
90662
|
-
if (this.hasPannerNode()) {
|
|
90663
|
-
var vec = new Vector3$1(0, 0, 1);
|
|
90664
|
-
var m = this.target.getBody().matrixWorld; // Save the translation column and zero it.
|
|
90988
|
+
return AmbientSound;
|
|
90989
|
+
}(Sound);var _excluded$1 = ["name"];
|
|
90665
90990
|
|
|
90666
|
-
|
|
90667
|
-
|
|
90668
|
-
mz = m.elements[14];
|
|
90669
|
-
m.elements[12] = m.elements[13] = m.elements[14] = 0; // Multiply the 0,0,1 vector by the world matrix and normalize the result.
|
|
90670
|
-
|
|
90671
|
-
vec.applyProjection(m);
|
|
90672
|
-
vec.normalize();
|
|
90673
|
-
this.pannerNode.setOrientation(vec.x, vec.y, vec.z); // Restore the translation column.
|
|
90674
|
-
|
|
90675
|
-
m.elements[12] = mx;
|
|
90676
|
-
m.elements[13] = my;
|
|
90677
|
-
m.elements[14] = mz;
|
|
90678
|
-
}
|
|
90679
|
-
}
|
|
90680
|
-
}, {
|
|
90681
|
-
key: "update",
|
|
90682
|
-
value: function update(dt) {
|
|
90683
|
-
_get(_getPrototypeOf(DirectionalSound.prototype), "update", this).call(this, dt);
|
|
90991
|
+
var DirectionalSound = /*#__PURE__*/function (_Sound) {
|
|
90992
|
+
_inherits(DirectionalSound, _Sound);
|
|
90684
90993
|
|
|
90685
|
-
|
|
90686
|
-
}
|
|
90687
|
-
}]);
|
|
90994
|
+
var _super = _createSuper(DirectionalSound);
|
|
90688
90995
|
|
|
90689
|
-
|
|
90690
|
-
|
|
90691
|
-
_inherits(Sound, _Beat);
|
|
90996
|
+
function DirectionalSound(source) {
|
|
90997
|
+
var _this;
|
|
90692
90998
|
|
|
90693
|
-
|
|
90999
|
+
var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
|
|
91000
|
+
_ref$name = _ref.name,
|
|
91001
|
+
name = _ref$name === void 0 ? generateRandomName('DirectionalSound') : _ref$name,
|
|
91002
|
+
options = _objectWithoutProperties(_ref, _excluded$1);
|
|
90694
91003
|
|
|
90695
|
-
|
|
90696
|
-
var _this;
|
|
91004
|
+
_classCallCheck(this, DirectionalSound);
|
|
90697
91005
|
|
|
90698
|
-
|
|
91006
|
+
_this = _super.call(this, _objectSpread2$1({
|
|
91007
|
+
source: source,
|
|
91008
|
+
name: name
|
|
91009
|
+
}, options));
|
|
90699
91010
|
|
|
90700
|
-
|
|
91011
|
+
_this.setEntityType(ENTITY_TYPES.AUDIO.DIRECTIONAL);
|
|
90701
91012
|
|
|
90702
|
-
|
|
90703
|
-
loop = _options$loop === void 0 ? false : _options$loop,
|
|
90704
|
-
_options$autoplay = options.autoplay,
|
|
90705
|
-
autoplay = _options$autoplay === void 0 ? false : _options$autoplay,
|
|
90706
|
-
_options$reconnectOnR = options.reconnectOnReset,
|
|
90707
|
-
reconnectOnReset = _options$reconnectOnR === void 0 ? false : _options$reconnectOnR;
|
|
90708
|
-
_this = _super.call(this, name, {
|
|
90709
|
-
loop: loop,
|
|
90710
|
-
autoplay: autoplay,
|
|
90711
|
-
reconnectOnReset: reconnectOnReset
|
|
90712
|
-
});
|
|
90713
|
-
_this.source.loop = loop;
|
|
90714
|
-
_this.target = null;
|
|
90715
|
-
_this.pannerNode = null;
|
|
90716
|
-
_this.convolverNode = null;
|
|
91013
|
+
_this.createPannerNode(options);
|
|
90717
91014
|
|
|
90718
|
-
|
|
90719
|
-
_this.play();
|
|
90720
|
-
}
|
|
91015
|
+
_this.connect();
|
|
90721
91016
|
|
|
90722
|
-
Audio$1.add(_assertThisInitialized(_this));
|
|
90723
91017
|
return _this;
|
|
90724
91018
|
}
|
|
90725
91019
|
|
|
90726
|
-
_createClass(
|
|
91020
|
+
_createClass(DirectionalSound, [{
|
|
91021
|
+
key: "hasPannerNode",
|
|
91022
|
+
value: function hasPannerNode() {
|
|
91023
|
+
return !!this.pannerNode;
|
|
91024
|
+
}
|
|
91025
|
+
}, {
|
|
90727
91026
|
key: "createPannerNode",
|
|
90728
91027
|
value: function createPannerNode() {
|
|
91028
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
91029
|
+
var _options$coneInnerAng = options.coneInnerAngleDegrees,
|
|
91030
|
+
coneInnerAngleDegrees = _options$coneInnerAng === void 0 ? 360 : _options$coneInnerAng,
|
|
91031
|
+
_options$coneOuterAng = options.coneOuterAngleDegrees,
|
|
91032
|
+
coneOuterAngleDegrees = _options$coneOuterAng === void 0 ? 0 : _options$coneOuterAng,
|
|
91033
|
+
_options$coneOuterGai = options.coneOuterGain,
|
|
91034
|
+
coneOuterGain = _options$coneOuterGai === void 0 ? 0 : _options$coneOuterGai,
|
|
91035
|
+
_options$maxDistance = options.maxDistance,
|
|
91036
|
+
maxDistance = _options$maxDistance === void 0 ? 10000 : _options$maxDistance,
|
|
91037
|
+
_options$rolloffFacto = options.rolloffFactor,
|
|
91038
|
+
rolloffFactor = _options$rolloffFacto === void 0 ? 1 : _options$rolloffFacto,
|
|
91039
|
+
_options$refDistance = options.refDistance,
|
|
91040
|
+
refDistance = _options$refDistance === void 0 ? 1 : _options$refDistance;
|
|
90729
91041
|
this.pannerNode = Audio$1.context.createPanner();
|
|
90730
|
-
this.
|
|
90731
|
-
this.
|
|
90732
|
-
this.pannerNode.
|
|
90733
|
-
|
|
90734
|
-
|
|
90735
|
-
|
|
90736
|
-
|
|
90737
|
-
|
|
91042
|
+
this.pannerNode.panningModel = 'HRTF';
|
|
91043
|
+
this.pannerNode.distanceModel = 'inverse';
|
|
91044
|
+
this.pannerNode.refDistance = refDistance;
|
|
91045
|
+
this.pannerNode.maxDistance = maxDistance;
|
|
91046
|
+
this.pannerNode.rolloffFactor = rolloffFactor;
|
|
91047
|
+
this.pannerNode.coneInnerAngle = coneInnerAngleDegrees;
|
|
91048
|
+
this.pannerNode.coneOuterAngle = coneOuterAngleDegrees;
|
|
91049
|
+
this.pannerNode.coneOuterGain = coneOuterGain;
|
|
90738
91050
|
}
|
|
90739
91051
|
}, {
|
|
90740
|
-
key: "
|
|
90741
|
-
value: function
|
|
90742
|
-
if (
|
|
90743
|
-
this.
|
|
90744
|
-
this.mixerNode = Audio$1.createGain();
|
|
90745
|
-
|
|
90746
|
-
if (this.hasPannerNode()) {
|
|
90747
|
-
this.pannerNode.disconnect();
|
|
90748
|
-
this.pannerNode.connect(this.mixerNode);
|
|
90749
|
-
} else {
|
|
90750
|
-
this.volumeNode.disconnect();
|
|
90751
|
-
this.volumeNode.connect(this.mixerNode);
|
|
90752
|
-
} //creating gains
|
|
90753
|
-
|
|
90754
|
-
|
|
90755
|
-
this.plainGainNode = Audio$1.context.createGain();
|
|
90756
|
-
this.convolverGainNode = Audio$1.context.createGain(); //connect mixer to new gains
|
|
90757
|
-
|
|
90758
|
-
this.mixerNode.connect(this.plainGainNode);
|
|
90759
|
-
this.mixerNode.connect(this.convolverGainNode);
|
|
90760
|
-
this.plainGainNode.connect(Audio$1.getMasterVolumeNode());
|
|
90761
|
-
this.convolverGainNode.connect(Audio$1.getMasterVolumeNode());
|
|
90762
|
-
this.convolverNode.buffer = Audio$1.get(effect);
|
|
90763
|
-
this.convolverGainNode.gain.setValueAtTime(0.7, Audio$1.context.currentTime);
|
|
90764
|
-
this.plainGainNode.gain.setValueAtTime(0.3, Audio$1.context.currentTime);
|
|
91052
|
+
key: "connect",
|
|
91053
|
+
value: function connect() {
|
|
91054
|
+
if (this.connected) {
|
|
91055
|
+
this.disconnect();
|
|
90765
91056
|
}
|
|
91057
|
+
|
|
91058
|
+
this.volumeNode.connect(Audio$1.getMasterVolumeNode());
|
|
91059
|
+
this.pannerNode.connect(this.volumeNode);
|
|
91060
|
+
this.audioNode.connect(this.pannerNode);
|
|
91061
|
+
this.connected = true;
|
|
91062
|
+
this.tryAutoplay();
|
|
90766
91063
|
}
|
|
90767
91064
|
}, {
|
|
90768
|
-
key: "
|
|
90769
|
-
value: function
|
|
90770
|
-
|
|
90771
|
-
|
|
90772
|
-
|
|
90773
|
-
|
|
90774
|
-
|
|
90775
|
-
|
|
91065
|
+
key: "disconnect",
|
|
91066
|
+
value: function disconnect() {
|
|
91067
|
+
if (this.connected) {
|
|
91068
|
+
this.volumeNode.disconnect();
|
|
91069
|
+
this.pannerNode.disconnect();
|
|
91070
|
+
this.audioNode.disconnect();
|
|
91071
|
+
this.connected = false;
|
|
91072
|
+
}
|
|
90776
91073
|
}
|
|
90777
91074
|
}, {
|
|
90778
|
-
key: "
|
|
90779
|
-
value: function
|
|
90780
|
-
|
|
91075
|
+
key: "updatePannerOrientation",
|
|
91076
|
+
value: function updatePannerOrientation() {
|
|
91077
|
+
var vec = new Vector3$1(0, 0, 1);
|
|
91078
|
+
var m = this.getBody().matrixWorld;
|
|
91079
|
+
var mx = m.elements[12],
|
|
91080
|
+
my = m.elements[13],
|
|
91081
|
+
mz = m.elements[14];
|
|
91082
|
+
m.elements[12] = m.elements[13] = m.elements[14] = 0;
|
|
91083
|
+
vec.applyMatrix4(m);
|
|
91084
|
+
vec.normalize();
|
|
91085
|
+
this.pannerNode.orientationX.setValueAtTime(vec.x, Audio$1.context.currentTime);
|
|
91086
|
+
this.pannerNode.orientationY.setValueAtTime(vec.y, Audio$1.context.currentTime);
|
|
91087
|
+
this.pannerNode.orientationZ.setValueAtTime(vec.z, Audio$1.context.currentTime);
|
|
91088
|
+
m.elements[12] = mx;
|
|
91089
|
+
m.elements[13] = my;
|
|
91090
|
+
m.elements[14] = mz;
|
|
90781
91091
|
}
|
|
90782
91092
|
}, {
|
|
90783
|
-
key: "
|
|
90784
|
-
value: function
|
|
90785
|
-
this.
|
|
90786
|
-
|
|
91093
|
+
key: "updatePannerPosition",
|
|
91094
|
+
value: function updatePannerPosition() {
|
|
91095
|
+
this.getBody().updateMatrixWorld();
|
|
91096
|
+
var position = new Vector3$1();
|
|
91097
|
+
position.setFromMatrixPosition(this.getBody().matrixWorld);
|
|
91098
|
+
this.pannerNode.positionX.setValueAtTime(position.x, Audio$1.context.currentTime);
|
|
91099
|
+
this.pannerNode.positionY.setValueAtTime(position.y, Audio$1.context.currentTime);
|
|
91100
|
+
this.pannerNode.positionZ.setValueAtTime(position.z, Audio$1.context.currentTime);
|
|
90787
91101
|
}
|
|
90788
91102
|
}, {
|
|
90789
91103
|
key: "update",
|
|
90790
91104
|
value: function update(dt) {
|
|
90791
|
-
|
|
90792
|
-
var p = new Vector3$1();
|
|
90793
|
-
p.setFromMatrixPosition(this.target.getBody().matrixWorld);
|
|
90794
|
-
var px = p.x,
|
|
90795
|
-
py = p.y,
|
|
90796
|
-
pz = p.z;
|
|
90797
|
-
this.target.getBody().updateMatrixWorld();
|
|
90798
|
-
var q = new Vector3$1();
|
|
90799
|
-
q.setFromMatrixPosition(this.target.getBody().matrixWorld);
|
|
90800
|
-
var dx = q.x - px,
|
|
90801
|
-
dy = q.y - py,
|
|
90802
|
-
dz = q.z - pz; //setting panner position and velocity using doppler effect.
|
|
91105
|
+
_get(_getPrototypeOf(DirectionalSound.prototype), "update", this).call(this, dt);
|
|
90803
91106
|
|
|
90804
|
-
|
|
90805
|
-
|
|
90806
|
-
|
|
90807
|
-
} catch (e) {// quick and dirty solution.
|
|
90808
|
-
}
|
|
91107
|
+
if (this.hasPannerNode()) {
|
|
91108
|
+
this.updatePannerOrientation();
|
|
91109
|
+
this.updatePannerPosition();
|
|
90809
91110
|
}
|
|
90810
91111
|
}
|
|
90811
91112
|
}]);
|
|
90812
91113
|
|
|
90813
|
-
return
|
|
90814
|
-
}(
|
|
91114
|
+
return DirectionalSound;
|
|
91115
|
+
}(Sound);var BLOB_TYPE = 'application/javascript';
|
|
90815
91116
|
var createBlob = function createBlob(task) {
|
|
90816
91117
|
return new Blob(['(', task.toString(), ')()'], {
|
|
90817
91118
|
type: BLOB_TYPE
|
|
@@ -92780,4 +93081,4 @@ var Shaders$1 = new Shaders();var Shader = function Shader(name, attributes, uni
|
|
|
92780
93081
|
} else {
|
|
92781
93082
|
this.instance = this.shader.instance;
|
|
92782
93083
|
}
|
|
92783
|
-
};var constants = _objectSpread2$1(_objectSpread2$1({}, lib_constants), light_contants);export{AUDIO_RAMPS,AmbientLight,Atmosphere,Audio$1 as Audio,Axes,BUILTIN,
|
|
93084
|
+
};var constants = _objectSpread2$1(_objectSpread2$1({}, lib_constants), light_contants);export{AUDIO_RAMPS,AmbientLight,AmbientSound,Atmosphere,Audio$1 as Audio,Axes,BUILTIN,BaseScript,Box,Camera,Color,Cone,Config$1 as Config,Controls$1 as Controls,Cube,CurveLine,Cylinder,DirectionalSound,ENTITY_EVENTS,ENTITY_TYPES,Element$1 as Element,Entity,EventDispatcher,FEATURES,Features$1 as Features,GameRunner$1 as GameRunner,Grid,HemisphereLight,INPUT_EVENTS,Images$1 as Images,Input$1 as Input,Label,LabelComponent,Level,LightLoader$1 as LightLoader,Lights$1 as Lights,Line,MeshLoader$1 as MeshLoader,Mirror,Models$1 as Models,Ocean,PALETTES,PARTICLES,constants$1 as PHYSICS_CONSTANTS,PHYSICS_EVENTS,ParticleEmitter,ParticleEmitterGroup,Particles$1 as Particles,index$1 as Partykals,Physics$1 as Physics,Plane,PointLight,PostProcessing$1 as PostProcessing,Proton,ProtonParticleEmitter,Provider,Router$1 as Router,Scene$1 as Scene,Scripts$1 as Scripts,Shader,Sky,Skybox,Sound,Sphere,SpotLight,Sprite,Stats$1 as Stats,SunLight,three_module as THREE,Universe$1 as Universe,Vector3$1 as Vector3,Water,author,connect,constants,createElement,easing,functions,hitbox as hitboxUtils,index_esm as inferno,math,utils as physicsUtils,index$2 as rxjs,index as store,strings,uuid$1 as uuid,workers,index$3 as xstate};
|