arcanumcube 0.1.3 → 0.1.4

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.
@@ -60,7 +60,8 @@ __export(arcanumcube_exports, {
60
60
  getNextStickerColors: () => getNextStickerColors,
61
61
  getRandomTwistList: () => getRandomTwistList,
62
62
  getStickerIndex: () => getStickerIndex,
63
- getStickerPermutationGroup: () => getStickerPermutationGroup
63
+ getStickerPermutationGroup: () => getStickerPermutationGroup,
64
+ loadDefaultLogoTexture: () => loadDefaultLogoTexture
64
65
  });
65
66
  module.exports = __toCommonJS(arcanumcube_exports);
66
67
 
@@ -728,7 +729,9 @@ function getStickerPermutationGroup(position, position2, twists, reverse = false
728
729
 
729
730
  // src/skins.ts
730
731
  var THREE = __toESM(require("three"), 1);
731
- function createDefaultLogoTexture() {
732
+ var DefaultLogoTextures;
733
+ function loadDefaultLogoTexture() {
734
+ if (DefaultLogoTextures) return DefaultLogoTextures;
732
735
  const image = document.createElementNS("http://www.w3.org/1999/xhtml", "img");
733
736
  image.src = DefaultLogo;
734
737
  const texture = new THREE.Texture(image);
@@ -792,10 +795,6 @@ var standardSkin = {
792
795
  ];
793
796
  const col = ColorList[color];
794
797
  let texture = void 0;
795
- if (x === SIDE_MIDDLE && y === SIDE_MAX && z === SIDE_MIDDLE) {
796
- texture = createDefaultLogoTexture();
797
- texture.flipY = false;
798
- }
799
798
  const mat = new THREE.MeshStandardMaterial({
800
799
  color: col,
801
800
  metalness: 0.4,
@@ -872,10 +871,6 @@ var metalicSkin = {
872
871
  ];
873
872
  const col = ColorList[color];
874
873
  let texture = void 0;
875
- if (x === SIDE_MIDDLE && y === SIDE_MAX && z === SIDE_MIDDLE) {
876
- texture = createDefaultLogoTexture();
877
- texture.flipY = false;
878
- }
879
874
  const mat = new THREE.MeshStandardMaterial({
880
875
  color: col,
881
876
  metalness: 0.7,
@@ -949,10 +944,6 @@ var goldSkin = {
949
944
  ];
950
945
  const col = ColorList[color];
951
946
  let texture = void 0;
952
- if (x === SIDE_MIDDLE && y === SIDE_MAX && z === SIDE_MIDDLE) {
953
- texture = createDefaultLogoTexture();
954
- texture.flipY = false;
955
- }
956
947
  const mat = new THREE.MeshStandardMaterial({
957
948
  color: col,
958
949
  metalness: 1,
@@ -1026,10 +1017,6 @@ var acrylicSkin = {
1026
1017
  ];
1027
1018
  const col = ColorList[color];
1028
1019
  let texture = void 0;
1029
- if (x === SIDE_MIDDLE && y === SIDE_MAX && z === SIDE_MIDDLE) {
1030
- texture = createDefaultLogoTexture();
1031
- texture.flipY = false;
1032
- }
1033
1020
  const mat = new THREE.MeshStandardMaterial({
1034
1021
  color: col,
1035
1022
  metalness: 1,
@@ -1104,10 +1091,6 @@ var crystalSkin = {
1104
1091
  ];
1105
1092
  const col = ColorList[color];
1106
1093
  let texture = void 0;
1107
- if (x === SIDE_MIDDLE && y === SIDE_MAX && z === SIDE_MIDDLE) {
1108
- texture = createDefaultLogoTexture();
1109
- texture.flipY = false;
1110
- }
1111
1094
  const mat = new THREE.MeshBasicMaterial({
1112
1095
  color: col,
1113
1096
  refractionRatio: 0.75,
@@ -1151,7 +1134,838 @@ var DefaultLogo = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAABAAAAAQACAIAAAD
1151
1134
  var THREE3 = __toESM(require("three"), 1);
1152
1135
  var import_GLTFLoader = require("three/examples/jsm/loaders/GLTFLoader.js");
1153
1136
  var BufferGeometryUtils = __toESM(require("three/examples/jsm/utils/BufferGeometryUtils.js"), 1);
1154
- var TWEEN = __toESM(require("@tweenjs/tween.js"), 1);
1137
+
1138
+ // node_modules/@tweenjs/tween.js/dist/tween.esm.js
1139
+ var Easing = Object.freeze({
1140
+ Linear: Object.freeze({
1141
+ None: function(amount) {
1142
+ return amount;
1143
+ },
1144
+ In: function(amount) {
1145
+ return amount;
1146
+ },
1147
+ Out: function(amount) {
1148
+ return amount;
1149
+ },
1150
+ InOut: function(amount) {
1151
+ return amount;
1152
+ }
1153
+ }),
1154
+ Quadratic: Object.freeze({
1155
+ In: function(amount) {
1156
+ return amount * amount;
1157
+ },
1158
+ Out: function(amount) {
1159
+ return amount * (2 - amount);
1160
+ },
1161
+ InOut: function(amount) {
1162
+ if ((amount *= 2) < 1) {
1163
+ return 0.5 * amount * amount;
1164
+ }
1165
+ return -0.5 * (--amount * (amount - 2) - 1);
1166
+ }
1167
+ }),
1168
+ Cubic: Object.freeze({
1169
+ In: function(amount) {
1170
+ return amount * amount * amount;
1171
+ },
1172
+ Out: function(amount) {
1173
+ return --amount * amount * amount + 1;
1174
+ },
1175
+ InOut: function(amount) {
1176
+ if ((amount *= 2) < 1) {
1177
+ return 0.5 * amount * amount * amount;
1178
+ }
1179
+ return 0.5 * ((amount -= 2) * amount * amount + 2);
1180
+ }
1181
+ }),
1182
+ Quartic: Object.freeze({
1183
+ In: function(amount) {
1184
+ return amount * amount * amount * amount;
1185
+ },
1186
+ Out: function(amount) {
1187
+ return 1 - --amount * amount * amount * amount;
1188
+ },
1189
+ InOut: function(amount) {
1190
+ if ((amount *= 2) < 1) {
1191
+ return 0.5 * amount * amount * amount * amount;
1192
+ }
1193
+ return -0.5 * ((amount -= 2) * amount * amount * amount - 2);
1194
+ }
1195
+ }),
1196
+ Quintic: Object.freeze({
1197
+ In: function(amount) {
1198
+ return amount * amount * amount * amount * amount;
1199
+ },
1200
+ Out: function(amount) {
1201
+ return --amount * amount * amount * amount * amount + 1;
1202
+ },
1203
+ InOut: function(amount) {
1204
+ if ((amount *= 2) < 1) {
1205
+ return 0.5 * amount * amount * amount * amount * amount;
1206
+ }
1207
+ return 0.5 * ((amount -= 2) * amount * amount * amount * amount + 2);
1208
+ }
1209
+ }),
1210
+ Sinusoidal: Object.freeze({
1211
+ In: function(amount) {
1212
+ return 1 - Math.sin((1 - amount) * Math.PI / 2);
1213
+ },
1214
+ Out: function(amount) {
1215
+ return Math.sin(amount * Math.PI / 2);
1216
+ },
1217
+ InOut: function(amount) {
1218
+ return 0.5 * (1 - Math.sin(Math.PI * (0.5 - amount)));
1219
+ }
1220
+ }),
1221
+ Exponential: Object.freeze({
1222
+ In: function(amount) {
1223
+ return amount === 0 ? 0 : Math.pow(1024, amount - 1);
1224
+ },
1225
+ Out: function(amount) {
1226
+ return amount === 1 ? 1 : 1 - Math.pow(2, -10 * amount);
1227
+ },
1228
+ InOut: function(amount) {
1229
+ if (amount === 0) {
1230
+ return 0;
1231
+ }
1232
+ if (amount === 1) {
1233
+ return 1;
1234
+ }
1235
+ if ((amount *= 2) < 1) {
1236
+ return 0.5 * Math.pow(1024, amount - 1);
1237
+ }
1238
+ return 0.5 * (-Math.pow(2, -10 * (amount - 1)) + 2);
1239
+ }
1240
+ }),
1241
+ Circular: Object.freeze({
1242
+ In: function(amount) {
1243
+ return 1 - Math.sqrt(1 - amount * amount);
1244
+ },
1245
+ Out: function(amount) {
1246
+ return Math.sqrt(1 - --amount * amount);
1247
+ },
1248
+ InOut: function(amount) {
1249
+ if ((amount *= 2) < 1) {
1250
+ return -0.5 * (Math.sqrt(1 - amount * amount) - 1);
1251
+ }
1252
+ return 0.5 * (Math.sqrt(1 - (amount -= 2) * amount) + 1);
1253
+ }
1254
+ }),
1255
+ Elastic: Object.freeze({
1256
+ In: function(amount) {
1257
+ if (amount === 0) {
1258
+ return 0;
1259
+ }
1260
+ if (amount === 1) {
1261
+ return 1;
1262
+ }
1263
+ return -Math.pow(2, 10 * (amount - 1)) * Math.sin((amount - 1.1) * 5 * Math.PI);
1264
+ },
1265
+ Out: function(amount) {
1266
+ if (amount === 0) {
1267
+ return 0;
1268
+ }
1269
+ if (amount === 1) {
1270
+ return 1;
1271
+ }
1272
+ return Math.pow(2, -10 * amount) * Math.sin((amount - 0.1) * 5 * Math.PI) + 1;
1273
+ },
1274
+ InOut: function(amount) {
1275
+ if (amount === 0) {
1276
+ return 0;
1277
+ }
1278
+ if (amount === 1) {
1279
+ return 1;
1280
+ }
1281
+ amount *= 2;
1282
+ if (amount < 1) {
1283
+ return -0.5 * Math.pow(2, 10 * (amount - 1)) * Math.sin((amount - 1.1) * 5 * Math.PI);
1284
+ }
1285
+ return 0.5 * Math.pow(2, -10 * (amount - 1)) * Math.sin((amount - 1.1) * 5 * Math.PI) + 1;
1286
+ }
1287
+ }),
1288
+ Back: Object.freeze({
1289
+ In: function(amount) {
1290
+ var s = 1.70158;
1291
+ return amount === 1 ? 1 : amount * amount * ((s + 1) * amount - s);
1292
+ },
1293
+ Out: function(amount) {
1294
+ var s = 1.70158;
1295
+ return amount === 0 ? 0 : --amount * amount * ((s + 1) * amount + s) + 1;
1296
+ },
1297
+ InOut: function(amount) {
1298
+ var s = 1.70158 * 1.525;
1299
+ if ((amount *= 2) < 1) {
1300
+ return 0.5 * (amount * amount * ((s + 1) * amount - s));
1301
+ }
1302
+ return 0.5 * ((amount -= 2) * amount * ((s + 1) * amount + s) + 2);
1303
+ }
1304
+ }),
1305
+ Bounce: Object.freeze({
1306
+ In: function(amount) {
1307
+ return 1 - Easing.Bounce.Out(1 - amount);
1308
+ },
1309
+ Out: function(amount) {
1310
+ if (amount < 1 / 2.75) {
1311
+ return 7.5625 * amount * amount;
1312
+ } else if (amount < 2 / 2.75) {
1313
+ return 7.5625 * (amount -= 1.5 / 2.75) * amount + 0.75;
1314
+ } else if (amount < 2.5 / 2.75) {
1315
+ return 7.5625 * (amount -= 2.25 / 2.75) * amount + 0.9375;
1316
+ } else {
1317
+ return 7.5625 * (amount -= 2.625 / 2.75) * amount + 0.984375;
1318
+ }
1319
+ },
1320
+ InOut: function(amount) {
1321
+ if (amount < 0.5) {
1322
+ return Easing.Bounce.In(amount * 2) * 0.5;
1323
+ }
1324
+ return Easing.Bounce.Out(amount * 2 - 1) * 0.5 + 0.5;
1325
+ }
1326
+ }),
1327
+ generatePow: function(power) {
1328
+ if (power === void 0) {
1329
+ power = 4;
1330
+ }
1331
+ power = power < Number.EPSILON ? Number.EPSILON : power;
1332
+ power = power > 1e4 ? 1e4 : power;
1333
+ return {
1334
+ In: function(amount) {
1335
+ return Math.pow(amount, power);
1336
+ },
1337
+ Out: function(amount) {
1338
+ return 1 - Math.pow(1 - amount, power);
1339
+ },
1340
+ InOut: function(amount) {
1341
+ if (amount < 0.5) {
1342
+ return Math.pow(amount * 2, power) / 2;
1343
+ }
1344
+ return (1 - Math.pow(2 - amount * 2, power)) / 2 + 0.5;
1345
+ }
1346
+ };
1347
+ }
1348
+ });
1349
+ var now = function() {
1350
+ return performance.now();
1351
+ };
1352
+ var Group = (
1353
+ /** @class */
1354
+ function() {
1355
+ function Group3() {
1356
+ var tweens = [];
1357
+ for (var _i = 0; _i < arguments.length; _i++) {
1358
+ tweens[_i] = arguments[_i];
1359
+ }
1360
+ this._tweens = {};
1361
+ this._tweensAddedDuringUpdate = {};
1362
+ this.add.apply(this, tweens);
1363
+ }
1364
+ Group3.prototype.getAll = function() {
1365
+ var _this = this;
1366
+ return Object.keys(this._tweens).map(function(tweenId) {
1367
+ return _this._tweens[tweenId];
1368
+ });
1369
+ };
1370
+ Group3.prototype.removeAll = function() {
1371
+ this._tweens = {};
1372
+ };
1373
+ Group3.prototype.add = function() {
1374
+ var _a;
1375
+ var tweens = [];
1376
+ for (var _i = 0; _i < arguments.length; _i++) {
1377
+ tweens[_i] = arguments[_i];
1378
+ }
1379
+ for (var _b = 0, tweens_1 = tweens; _b < tweens_1.length; _b++) {
1380
+ var tween = tweens_1[_b];
1381
+ (_a = tween._group) === null || _a === void 0 ? void 0 : _a.remove(tween);
1382
+ tween._group = this;
1383
+ this._tweens[tween.getId()] = tween;
1384
+ this._tweensAddedDuringUpdate[tween.getId()] = tween;
1385
+ }
1386
+ };
1387
+ Group3.prototype.remove = function() {
1388
+ var tweens = [];
1389
+ for (var _i = 0; _i < arguments.length; _i++) {
1390
+ tweens[_i] = arguments[_i];
1391
+ }
1392
+ for (var _a = 0, tweens_2 = tweens; _a < tweens_2.length; _a++) {
1393
+ var tween = tweens_2[_a];
1394
+ tween._group = void 0;
1395
+ delete this._tweens[tween.getId()];
1396
+ delete this._tweensAddedDuringUpdate[tween.getId()];
1397
+ }
1398
+ };
1399
+ Group3.prototype.allStopped = function() {
1400
+ return this.getAll().every(function(tween) {
1401
+ return !tween.isPlaying();
1402
+ });
1403
+ };
1404
+ Group3.prototype.update = function(time, preserve) {
1405
+ if (time === void 0) {
1406
+ time = now();
1407
+ }
1408
+ if (preserve === void 0) {
1409
+ preserve = true;
1410
+ }
1411
+ var tweenIds = Object.keys(this._tweens);
1412
+ if (tweenIds.length === 0)
1413
+ return;
1414
+ while (tweenIds.length > 0) {
1415
+ this._tweensAddedDuringUpdate = {};
1416
+ for (var i = 0; i < tweenIds.length; i++) {
1417
+ var tween = this._tweens[tweenIds[i]];
1418
+ var autoStart = !preserve;
1419
+ if (tween && tween.update(time, autoStart) === false && !preserve)
1420
+ this.remove(tween);
1421
+ }
1422
+ tweenIds = Object.keys(this._tweensAddedDuringUpdate);
1423
+ }
1424
+ };
1425
+ return Group3;
1426
+ }()
1427
+ );
1428
+ var Interpolation = {
1429
+ Linear: function(v, k) {
1430
+ var m = v.length - 1;
1431
+ var f = m * k;
1432
+ var i = Math.floor(f);
1433
+ var fn = Interpolation.Utils.Linear;
1434
+ if (k < 0) {
1435
+ return fn(v[0], v[1], f);
1436
+ }
1437
+ if (k > 1) {
1438
+ return fn(v[m], v[m - 1], m - f);
1439
+ }
1440
+ return fn(v[i], v[i + 1 > m ? m : i + 1], f - i);
1441
+ },
1442
+ Bezier: function(v, k) {
1443
+ var b = 0;
1444
+ var n = v.length - 1;
1445
+ var pw = Math.pow;
1446
+ var bn = Interpolation.Utils.Bernstein;
1447
+ for (var i = 0; i <= n; i++) {
1448
+ b += pw(1 - k, n - i) * pw(k, i) * v[i] * bn(n, i);
1449
+ }
1450
+ return b;
1451
+ },
1452
+ CatmullRom: function(v, k) {
1453
+ var m = v.length - 1;
1454
+ var f = m * k;
1455
+ var i = Math.floor(f);
1456
+ var fn = Interpolation.Utils.CatmullRom;
1457
+ if (v[0] === v[m]) {
1458
+ if (k < 0) {
1459
+ i = Math.floor(f = m * (1 + k));
1460
+ }
1461
+ return fn(v[(i - 1 + m) % m], v[i], v[(i + 1) % m], v[(i + 2) % m], f - i);
1462
+ } else {
1463
+ if (k < 0) {
1464
+ return v[0] - (fn(v[0], v[0], v[1], v[1], -f) - v[0]);
1465
+ }
1466
+ if (k > 1) {
1467
+ return v[m] - (fn(v[m], v[m], v[m - 1], v[m - 1], f - m) - v[m]);
1468
+ }
1469
+ return fn(v[i ? i - 1 : 0], v[i], v[m < i + 1 ? m : i + 1], v[m < i + 2 ? m : i + 2], f - i);
1470
+ }
1471
+ },
1472
+ Utils: {
1473
+ Linear: function(p0, p1, t) {
1474
+ return (p1 - p0) * t + p0;
1475
+ },
1476
+ Bernstein: function(n, i) {
1477
+ var fc = Interpolation.Utils.Factorial;
1478
+ return fc(n) / fc(i) / fc(n - i);
1479
+ },
1480
+ Factorial: /* @__PURE__ */ function() {
1481
+ var a = [1];
1482
+ return function(n) {
1483
+ var s = 1;
1484
+ if (a[n]) {
1485
+ return a[n];
1486
+ }
1487
+ for (var i = n; i > 1; i--) {
1488
+ s *= i;
1489
+ }
1490
+ a[n] = s;
1491
+ return s;
1492
+ };
1493
+ }(),
1494
+ CatmullRom: function(p0, p1, p2, p3, t) {
1495
+ var v0 = (p2 - p0) * 0.5;
1496
+ var v1 = (p3 - p1) * 0.5;
1497
+ var t2 = t * t;
1498
+ var t3 = t * t2;
1499
+ return (2 * p1 - 2 * p2 + v0 + v1) * t3 + (-3 * p1 + 3 * p2 - 2 * v0 - v1) * t2 + v0 * t + p1;
1500
+ }
1501
+ }
1502
+ };
1503
+ var Sequence = (
1504
+ /** @class */
1505
+ function() {
1506
+ function Sequence2() {
1507
+ }
1508
+ Sequence2.nextId = function() {
1509
+ return Sequence2._nextId++;
1510
+ };
1511
+ Sequence2._nextId = 0;
1512
+ return Sequence2;
1513
+ }()
1514
+ );
1515
+ var mainGroup = new Group();
1516
+ var Tween = (
1517
+ /** @class */
1518
+ function() {
1519
+ function Tween2(object, group) {
1520
+ this._isPaused = false;
1521
+ this._pauseStart = 0;
1522
+ this._valuesStart = {};
1523
+ this._valuesEnd = {};
1524
+ this._valuesStartRepeat = {};
1525
+ this._duration = 1e3;
1526
+ this._isDynamic = false;
1527
+ this._initialRepeat = 0;
1528
+ this._repeat = 0;
1529
+ this._yoyo = false;
1530
+ this._isPlaying = false;
1531
+ this._reversed = false;
1532
+ this._delayTime = 0;
1533
+ this._startTime = 0;
1534
+ this._easingFunction = Easing.Linear.None;
1535
+ this._interpolationFunction = Interpolation.Linear;
1536
+ this._chainedTweens = [];
1537
+ this._onStartCallbackFired = false;
1538
+ this._onEveryStartCallbackFired = false;
1539
+ this._id = Sequence.nextId();
1540
+ this._isChainStopped = false;
1541
+ this._propertiesAreSetUp = false;
1542
+ this._goToEnd = false;
1543
+ this._object = object;
1544
+ if (typeof group === "object") {
1545
+ this._group = group;
1546
+ group.add(this);
1547
+ } else if (group === true) {
1548
+ this._group = mainGroup;
1549
+ mainGroup.add(this);
1550
+ }
1551
+ }
1552
+ Tween2.prototype.getId = function() {
1553
+ return this._id;
1554
+ };
1555
+ Tween2.prototype.isPlaying = function() {
1556
+ return this._isPlaying;
1557
+ };
1558
+ Tween2.prototype.isPaused = function() {
1559
+ return this._isPaused;
1560
+ };
1561
+ Tween2.prototype.getDuration = function() {
1562
+ return this._duration;
1563
+ };
1564
+ Tween2.prototype.to = function(target, duration) {
1565
+ if (duration === void 0) {
1566
+ duration = 1e3;
1567
+ }
1568
+ if (this._isPlaying)
1569
+ throw new Error("Can not call Tween.to() while Tween is already started or paused. Stop the Tween first.");
1570
+ this._valuesEnd = target;
1571
+ this._propertiesAreSetUp = false;
1572
+ this._duration = duration < 0 ? 0 : duration;
1573
+ return this;
1574
+ };
1575
+ Tween2.prototype.duration = function(duration) {
1576
+ if (duration === void 0) {
1577
+ duration = 1e3;
1578
+ }
1579
+ this._duration = duration < 0 ? 0 : duration;
1580
+ return this;
1581
+ };
1582
+ Tween2.prototype.dynamic = function(dynamic) {
1583
+ if (dynamic === void 0) {
1584
+ dynamic = false;
1585
+ }
1586
+ this._isDynamic = dynamic;
1587
+ return this;
1588
+ };
1589
+ Tween2.prototype.start = function(time, overrideStartingValues) {
1590
+ if (time === void 0) {
1591
+ time = now();
1592
+ }
1593
+ if (overrideStartingValues === void 0) {
1594
+ overrideStartingValues = false;
1595
+ }
1596
+ if (this._isPlaying) {
1597
+ return this;
1598
+ }
1599
+ this._repeat = this._initialRepeat;
1600
+ if (this._reversed) {
1601
+ this._reversed = false;
1602
+ for (var property in this._valuesStartRepeat) {
1603
+ this._swapEndStartRepeatValues(property);
1604
+ this._valuesStart[property] = this._valuesStartRepeat[property];
1605
+ }
1606
+ }
1607
+ this._isPlaying = true;
1608
+ this._isPaused = false;
1609
+ this._onStartCallbackFired = false;
1610
+ this._onEveryStartCallbackFired = false;
1611
+ this._isChainStopped = false;
1612
+ this._startTime = time;
1613
+ this._startTime += this._delayTime;
1614
+ if (!this._propertiesAreSetUp || overrideStartingValues) {
1615
+ this._propertiesAreSetUp = true;
1616
+ if (!this._isDynamic) {
1617
+ var tmp = {};
1618
+ for (var prop in this._valuesEnd)
1619
+ tmp[prop] = this._valuesEnd[prop];
1620
+ this._valuesEnd = tmp;
1621
+ }
1622
+ this._setupProperties(this._object, this._valuesStart, this._valuesEnd, this._valuesStartRepeat, overrideStartingValues);
1623
+ }
1624
+ return this;
1625
+ };
1626
+ Tween2.prototype.startFromCurrentValues = function(time) {
1627
+ return this.start(time, true);
1628
+ };
1629
+ Tween2.prototype._setupProperties = function(_object, _valuesStart, _valuesEnd, _valuesStartRepeat, overrideStartingValues) {
1630
+ for (var property in _valuesEnd) {
1631
+ var startValue = _object[property];
1632
+ var startValueIsArray = Array.isArray(startValue);
1633
+ var propType = startValueIsArray ? "array" : typeof startValue;
1634
+ var isInterpolationList = !startValueIsArray && Array.isArray(_valuesEnd[property]);
1635
+ if (propType === "undefined" || propType === "function") {
1636
+ continue;
1637
+ }
1638
+ if (isInterpolationList) {
1639
+ var endValues = _valuesEnd[property];
1640
+ if (endValues.length === 0) {
1641
+ continue;
1642
+ }
1643
+ var temp = [startValue];
1644
+ for (var i = 0, l = endValues.length; i < l; i += 1) {
1645
+ var value = this._handleRelativeValue(startValue, endValues[i]);
1646
+ if (isNaN(value)) {
1647
+ isInterpolationList = false;
1648
+ console.warn("Found invalid interpolation list. Skipping.");
1649
+ break;
1650
+ }
1651
+ temp.push(value);
1652
+ }
1653
+ if (isInterpolationList) {
1654
+ _valuesEnd[property] = temp;
1655
+ }
1656
+ }
1657
+ if ((propType === "object" || startValueIsArray) && startValue && !isInterpolationList) {
1658
+ _valuesStart[property] = startValueIsArray ? [] : {};
1659
+ var nestedObject = startValue;
1660
+ for (var prop in nestedObject) {
1661
+ _valuesStart[property][prop] = nestedObject[prop];
1662
+ }
1663
+ _valuesStartRepeat[property] = startValueIsArray ? [] : {};
1664
+ var endValues = _valuesEnd[property];
1665
+ if (!this._isDynamic) {
1666
+ var tmp = {};
1667
+ for (var prop in endValues)
1668
+ tmp[prop] = endValues[prop];
1669
+ _valuesEnd[property] = endValues = tmp;
1670
+ }
1671
+ this._setupProperties(nestedObject, _valuesStart[property], endValues, _valuesStartRepeat[property], overrideStartingValues);
1672
+ } else {
1673
+ if (typeof _valuesStart[property] === "undefined" || overrideStartingValues) {
1674
+ _valuesStart[property] = startValue;
1675
+ }
1676
+ if (!startValueIsArray) {
1677
+ _valuesStart[property] *= 1;
1678
+ }
1679
+ if (isInterpolationList) {
1680
+ _valuesStartRepeat[property] = _valuesEnd[property].slice().reverse();
1681
+ } else {
1682
+ _valuesStartRepeat[property] = _valuesStart[property] || 0;
1683
+ }
1684
+ }
1685
+ }
1686
+ };
1687
+ Tween2.prototype.stop = function() {
1688
+ if (!this._isChainStopped) {
1689
+ this._isChainStopped = true;
1690
+ this.stopChainedTweens();
1691
+ }
1692
+ if (!this._isPlaying) {
1693
+ return this;
1694
+ }
1695
+ this._isPlaying = false;
1696
+ this._isPaused = false;
1697
+ if (this._onStopCallback) {
1698
+ this._onStopCallback(this._object);
1699
+ }
1700
+ return this;
1701
+ };
1702
+ Tween2.prototype.end = function() {
1703
+ this._goToEnd = true;
1704
+ this.update(this._startTime + this._duration);
1705
+ return this;
1706
+ };
1707
+ Tween2.prototype.pause = function(time) {
1708
+ if (time === void 0) {
1709
+ time = now();
1710
+ }
1711
+ if (this._isPaused || !this._isPlaying) {
1712
+ return this;
1713
+ }
1714
+ this._isPaused = true;
1715
+ this._pauseStart = time;
1716
+ return this;
1717
+ };
1718
+ Tween2.prototype.resume = function(time) {
1719
+ if (time === void 0) {
1720
+ time = now();
1721
+ }
1722
+ if (!this._isPaused || !this._isPlaying) {
1723
+ return this;
1724
+ }
1725
+ this._isPaused = false;
1726
+ this._startTime += time - this._pauseStart;
1727
+ this._pauseStart = 0;
1728
+ return this;
1729
+ };
1730
+ Tween2.prototype.stopChainedTweens = function() {
1731
+ for (var i = 0, numChainedTweens = this._chainedTweens.length; i < numChainedTweens; i++) {
1732
+ this._chainedTweens[i].stop();
1733
+ }
1734
+ return this;
1735
+ };
1736
+ Tween2.prototype.group = function(group) {
1737
+ if (!group) {
1738
+ console.warn("tween.group() without args has been removed, use group.add(tween) instead.");
1739
+ return this;
1740
+ }
1741
+ group.add(this);
1742
+ return this;
1743
+ };
1744
+ Tween2.prototype.remove = function() {
1745
+ var _a;
1746
+ (_a = this._group) === null || _a === void 0 ? void 0 : _a.remove(this);
1747
+ return this;
1748
+ };
1749
+ Tween2.prototype.delay = function(amount) {
1750
+ if (amount === void 0) {
1751
+ amount = 0;
1752
+ }
1753
+ this._delayTime = amount;
1754
+ return this;
1755
+ };
1756
+ Tween2.prototype.repeat = function(times) {
1757
+ if (times === void 0) {
1758
+ times = 0;
1759
+ }
1760
+ this._initialRepeat = times;
1761
+ this._repeat = times;
1762
+ return this;
1763
+ };
1764
+ Tween2.prototype.repeatDelay = function(amount) {
1765
+ this._repeatDelayTime = amount;
1766
+ return this;
1767
+ };
1768
+ Tween2.prototype.yoyo = function(yoyo) {
1769
+ if (yoyo === void 0) {
1770
+ yoyo = false;
1771
+ }
1772
+ this._yoyo = yoyo;
1773
+ return this;
1774
+ };
1775
+ Tween2.prototype.easing = function(easingFunction) {
1776
+ if (easingFunction === void 0) {
1777
+ easingFunction = Easing.Linear.None;
1778
+ }
1779
+ this._easingFunction = easingFunction;
1780
+ return this;
1781
+ };
1782
+ Tween2.prototype.interpolation = function(interpolationFunction) {
1783
+ if (interpolationFunction === void 0) {
1784
+ interpolationFunction = Interpolation.Linear;
1785
+ }
1786
+ this._interpolationFunction = interpolationFunction;
1787
+ return this;
1788
+ };
1789
+ Tween2.prototype.chain = function() {
1790
+ var tweens = [];
1791
+ for (var _i = 0; _i < arguments.length; _i++) {
1792
+ tweens[_i] = arguments[_i];
1793
+ }
1794
+ this._chainedTweens = tweens;
1795
+ return this;
1796
+ };
1797
+ Tween2.prototype.onStart = function(callback) {
1798
+ this._onStartCallback = callback;
1799
+ return this;
1800
+ };
1801
+ Tween2.prototype.onEveryStart = function(callback) {
1802
+ this._onEveryStartCallback = callback;
1803
+ return this;
1804
+ };
1805
+ Tween2.prototype.onUpdate = function(callback) {
1806
+ this._onUpdateCallback = callback;
1807
+ return this;
1808
+ };
1809
+ Tween2.prototype.onRepeat = function(callback) {
1810
+ this._onRepeatCallback = callback;
1811
+ return this;
1812
+ };
1813
+ Tween2.prototype.onComplete = function(callback) {
1814
+ this._onCompleteCallback = callback;
1815
+ return this;
1816
+ };
1817
+ Tween2.prototype.onStop = function(callback) {
1818
+ this._onStopCallback = callback;
1819
+ return this;
1820
+ };
1821
+ Tween2.prototype.update = function(time, autoStart) {
1822
+ var _this = this;
1823
+ var _a;
1824
+ if (time === void 0) {
1825
+ time = now();
1826
+ }
1827
+ if (autoStart === void 0) {
1828
+ autoStart = Tween2.autoStartOnUpdate;
1829
+ }
1830
+ if (this._isPaused)
1831
+ return true;
1832
+ var property;
1833
+ if (!this._goToEnd && !this._isPlaying) {
1834
+ if (autoStart)
1835
+ this.start(time, true);
1836
+ else
1837
+ return false;
1838
+ }
1839
+ this._goToEnd = false;
1840
+ if (time < this._startTime) {
1841
+ return true;
1842
+ }
1843
+ if (this._onStartCallbackFired === false) {
1844
+ if (this._onStartCallback) {
1845
+ this._onStartCallback(this._object);
1846
+ }
1847
+ this._onStartCallbackFired = true;
1848
+ }
1849
+ if (this._onEveryStartCallbackFired === false) {
1850
+ if (this._onEveryStartCallback) {
1851
+ this._onEveryStartCallback(this._object);
1852
+ }
1853
+ this._onEveryStartCallbackFired = true;
1854
+ }
1855
+ var elapsedTime = time - this._startTime;
1856
+ var durationAndDelay = this._duration + ((_a = this._repeatDelayTime) !== null && _a !== void 0 ? _a : this._delayTime);
1857
+ var totalTime = this._duration + this._repeat * durationAndDelay;
1858
+ var calculateElapsedPortion = function() {
1859
+ if (_this._duration === 0)
1860
+ return 1;
1861
+ if (elapsedTime > totalTime) {
1862
+ return 1;
1863
+ }
1864
+ var timesRepeated = Math.trunc(elapsedTime / durationAndDelay);
1865
+ var timeIntoCurrentRepeat = elapsedTime - timesRepeated * durationAndDelay;
1866
+ var portion = Math.min(timeIntoCurrentRepeat / _this._duration, 1);
1867
+ if (portion === 0 && elapsedTime === _this._duration) {
1868
+ return 1;
1869
+ }
1870
+ return portion;
1871
+ };
1872
+ var elapsed = calculateElapsedPortion();
1873
+ var value = this._easingFunction(elapsed);
1874
+ this._updateProperties(this._object, this._valuesStart, this._valuesEnd, value);
1875
+ if (this._onUpdateCallback) {
1876
+ this._onUpdateCallback(this._object, elapsed);
1877
+ }
1878
+ if (this._duration === 0 || elapsedTime >= this._duration) {
1879
+ if (this._repeat > 0) {
1880
+ var completeCount = Math.min(Math.trunc((elapsedTime - this._duration) / durationAndDelay) + 1, this._repeat);
1881
+ if (isFinite(this._repeat)) {
1882
+ this._repeat -= completeCount;
1883
+ }
1884
+ for (property in this._valuesStartRepeat) {
1885
+ if (!this._yoyo && typeof this._valuesEnd[property] === "string") {
1886
+ this._valuesStartRepeat[property] = // eslint-disable-next-line
1887
+ // @ts-ignore FIXME?
1888
+ this._valuesStartRepeat[property] + parseFloat(this._valuesEnd[property]);
1889
+ }
1890
+ if (this._yoyo) {
1891
+ this._swapEndStartRepeatValues(property);
1892
+ }
1893
+ this._valuesStart[property] = this._valuesStartRepeat[property];
1894
+ }
1895
+ if (this._yoyo) {
1896
+ this._reversed = !this._reversed;
1897
+ }
1898
+ this._startTime += durationAndDelay * completeCount;
1899
+ if (this._onRepeatCallback) {
1900
+ this._onRepeatCallback(this._object);
1901
+ }
1902
+ this._onEveryStartCallbackFired = false;
1903
+ return true;
1904
+ } else {
1905
+ if (this._onCompleteCallback) {
1906
+ this._onCompleteCallback(this._object);
1907
+ }
1908
+ for (var i = 0, numChainedTweens = this._chainedTweens.length; i < numChainedTweens; i++) {
1909
+ this._chainedTweens[i].start(this._startTime + this._duration, false);
1910
+ }
1911
+ this._isPlaying = false;
1912
+ return false;
1913
+ }
1914
+ }
1915
+ return true;
1916
+ };
1917
+ Tween2.prototype._updateProperties = function(_object, _valuesStart, _valuesEnd, value) {
1918
+ for (var property in _valuesEnd) {
1919
+ if (_valuesStart[property] === void 0) {
1920
+ continue;
1921
+ }
1922
+ var start = _valuesStart[property] || 0;
1923
+ var end = _valuesEnd[property];
1924
+ var startIsArray = Array.isArray(_object[property]);
1925
+ var endIsArray = Array.isArray(end);
1926
+ var isInterpolationList = !startIsArray && endIsArray;
1927
+ if (isInterpolationList) {
1928
+ _object[property] = this._interpolationFunction(end, value);
1929
+ } else if (typeof end === "object" && end) {
1930
+ this._updateProperties(_object[property], start, end, value);
1931
+ } else {
1932
+ end = this._handleRelativeValue(start, end);
1933
+ if (typeof end === "number") {
1934
+ _object[property] = start + (end - start) * value;
1935
+ }
1936
+ }
1937
+ }
1938
+ };
1939
+ Tween2.prototype._handleRelativeValue = function(start, end) {
1940
+ if (typeof end !== "string") {
1941
+ return end;
1942
+ }
1943
+ if (end.charAt(0) === "+" || end.charAt(0) === "-") {
1944
+ return start + parseFloat(end);
1945
+ }
1946
+ return parseFloat(end);
1947
+ };
1948
+ Tween2.prototype._swapEndStartRepeatValues = function(property) {
1949
+ var tmp = this._valuesStartRepeat[property];
1950
+ var endValue = this._valuesEnd[property];
1951
+ if (typeof endValue === "string") {
1952
+ this._valuesStartRepeat[property] = this._valuesStartRepeat[property] + parseFloat(endValue);
1953
+ } else {
1954
+ this._valuesStartRepeat[property] = this._valuesEnd[property];
1955
+ }
1956
+ this._valuesEnd[property] = tmp;
1957
+ };
1958
+ Tween2.autoStartOnUpdate = false;
1959
+ return Tween2;
1960
+ }()
1961
+ );
1962
+ var nextId = Sequence.nextId;
1963
+ var TWEEN = mainGroup;
1964
+ var getAll = TWEEN.getAll.bind(TWEEN);
1965
+ var removeAll = TWEEN.removeAll.bind(TWEEN);
1966
+ var add = TWEEN.add.bind(TWEEN);
1967
+ var remove = TWEEN.remove.bind(TWEEN);
1968
+ var update = TWEEN.update.bind(TWEEN);
1155
1969
 
1156
1970
  // src/materials.ts
1157
1971
  var THREE2 = __toESM(require("three"), 1);
@@ -1413,8 +2227,8 @@ var WebGLArcanumCube = class extends ArcanumCube {
1413
2227
  _draggingTwist;
1414
2228
  /** max degree to cancel the dragging */
1415
2229
  _cancelDragDeg;
1416
- /** tween group */
1417
- _tweens;
2230
+ /** easing group */
2231
+ _easings;
1418
2232
  /** light at the center of cube */
1419
2233
  _coreLights;
1420
2234
  /** status of locking the twist */
@@ -1442,7 +2256,7 @@ var WebGLArcanumCube = class extends ArcanumCube {
1442
2256
  this._cubeObjectList = [];
1443
2257
  this._cubeMap = {};
1444
2258
  this._cancelDragDeg = 15;
1445
- this._tweens = new TWEEN.Group();
2259
+ this._easings = new Group();
1446
2260
  this._coreLights = [];
1447
2261
  this._lockTwist = false;
1448
2262
  if (options) {
@@ -1545,7 +2359,7 @@ var WebGLArcanumCube = class extends ArcanumCube {
1545
2359
  this._lockTwist = flag;
1546
2360
  }
1547
2361
  isTwisting() {
1548
- return this._tweens.getAll().length > 0;
2362
+ return this._easings.getAll().length > 0;
1549
2363
  }
1550
2364
  reset(duration = 1800) {
1551
2365
  if (this._lockTwist || this.isTwisting()) return;
@@ -1567,34 +2381,34 @@ var WebGLArcanumCube = class extends ArcanumCube {
1567
2381
  qa.push(cube.getGroup().quaternion.clone());
1568
2382
  });
1569
2383
  const params = { t: 0 };
1570
- const tweenExplode = new TWEEN.Tween(params).to({ t: 1 }, duration * 5 / 18).easing(TWEEN.Easing.Quartic.Out).onUpdate(() => {
2384
+ const easingExplode = new Tween(params).to({ t: 1 }, duration * 5 / 18).easing(Easing.Quartic.Out).onUpdate(() => {
1571
2385
  cubeList.forEach((cube) => {
1572
2386
  cube.stretch(stretchSize * params.t);
1573
2387
  });
1574
2388
  }).onComplete(() => {
1575
- this._tweens.remove(tweenExplode);
2389
+ this._easings.remove(easingExplode);
1576
2390
  });
1577
2391
  const params2 = { t: 0 };
1578
- const tweenReset = new TWEEN.Tween(params2).to({ t: 1 }, duration * 8 / 18).easing(TWEEN.Easing.Quartic.Out).onUpdate(() => {
2392
+ const easingReset = new Tween(params2).to({ t: 1 }, duration * 8 / 18).easing(Easing.Quartic.Out).onUpdate(() => {
1579
2393
  cubeList.forEach((cube, index) => {
1580
2394
  cube.getGroup().quaternion.slerpQuaternions(qa[index], qb, params2.t);
1581
2395
  });
1582
2396
  }).onComplete(() => {
1583
2397
  super.reset();
1584
- this._tweens.remove(tweenReset);
2398
+ this._easings.remove(easingReset);
1585
2399
  });
1586
2400
  const params3 = { t: 1 };
1587
- const tweenContract = new TWEEN.Tween(params3).to({ t: 0 }, duration * 5 / 18).easing(TWEEN.Easing.Quartic.Out).onUpdate(() => {
2401
+ const easingContract = new Tween(params3).to({ t: 0 }, duration * 5 / 18).easing(Easing.Quartic.Out).onUpdate(() => {
1588
2402
  cubeList.forEach((cube) => {
1589
2403
  cube.stretch(stretchSize * params3.t);
1590
2404
  });
1591
2405
  }).onComplete(() => {
1592
- this._tweens.remove(tweenContract);
2406
+ this._easings.remove(easingContract);
1593
2407
  });
1594
- tweenExplode.chain(tweenReset);
1595
- tweenReset.chain(tweenContract);
1596
- this._tweens.add(tweenExplode, tweenReset, tweenContract);
1597
- tweenExplode.start();
2408
+ easingExplode.chain(easingReset);
2409
+ easingReset.chain(easingContract);
2410
+ this._easings.add(easingExplode, easingReset, easingContract);
2411
+ easingExplode.start();
1598
2412
  }
1599
2413
  }
1600
2414
  selectedCube() {
@@ -1754,24 +2568,24 @@ var WebGLArcanumCube = class extends ArcanumCube {
1754
2568
  if (this._draggingTwist) {
1755
2569
  const deg = this._draggingTwist.rad * 180 / Math.PI;
1756
2570
  if (deg > this._cancelDragDeg) {
1757
- this.tweenTwist(this._draggingTwist.twist);
2571
+ this.easingTwist(this._draggingTwist.twist);
1758
2572
  } else {
1759
- this.tweenTwist(this._draggingTwist.twist, false, 100, true);
2573
+ this.easingTwist(this._draggingTwist.twist, false, 100, true);
1760
2574
  }
1761
2575
  }
1762
2576
  }
1763
2577
  // twist randomly several steps
1764
2578
  scramble(steps = 0, duration = 3e3) {
1765
2579
  const list = getRandomTwistList(steps);
1766
- this.tweenTwist(list, false, duration, false);
2580
+ this.easingTwist(list, false, duration, false);
1767
2581
  }
1768
2582
  undo(steps = 1, duration = 300) {
1769
2583
  const list = this.getUndoList(steps);
1770
- this.tweenTwist(list, true, duration, false);
2584
+ this.easingTwist(list, true, duration, false);
1771
2585
  }
1772
2586
  // twisting(複数回対応)
1773
- // durationを0にするとTweenなしとなる
1774
- tweenTwist(twist, reverse = false, duration = 500, cancel = false, options) {
2587
+ // durationを0にするとEasingなしとなる
2588
+ easingTwist(twist, reverse = false, duration = 500, cancel = false, options) {
1775
2589
  if (this._lockTwist || this.isTwisting()) return;
1776
2590
  options = { ...this._config.twistOptions, ...options };
1777
2591
  if (duration === 0) {
@@ -1792,8 +2606,8 @@ var WebGLArcanumCube = class extends ArcanumCube {
1792
2606
  options?.onComplete && options.onComplete(this);
1793
2607
  return;
1794
2608
  }
1795
- let firstTween = void 0;
1796
- let tween = void 0;
2609
+ let firstEasing = void 0;
2610
+ let easing = void 0;
1797
2611
  if (Array.isArray(twist)) {
1798
2612
  if (twist.length == 0) return;
1799
2613
  const lap = duration / twist.length;
@@ -1805,22 +2619,22 @@ var WebGLArcanumCube = class extends ArcanumCube {
1805
2619
  if (ontwisted)
1806
2620
  opts.onTwisted = (self, twist2, n1, n2) => ontwisted(this, twist2, i + 1, len);
1807
2621
  if (i === len - 1 && options?.onComplete) opts.onComplete = options.onComplete;
1808
- const t = this._tweenTwist(c, reverse, lap, cancel, opts);
1809
- this._tweens.add(t);
1810
- if (!tween) {
1811
- firstTween = tween = t;
2622
+ const t = this._easingTwist(c, reverse, lap, cancel, opts);
2623
+ this._easings.add(t);
2624
+ if (!easing) {
2625
+ firstEasing = easing = t;
1812
2626
  } else {
1813
- tween.chain(t);
1814
- tween = t;
2627
+ easing.chain(t);
2628
+ easing = t;
1815
2629
  }
1816
2630
  }
1817
2631
  } else {
1818
- firstTween = this._tweenTwist(twist, reverse, duration, cancel, options);
1819
- this._tweens.add(firstTween);
2632
+ firstEasing = this._easingTwist(twist, reverse, duration, cancel, options);
2633
+ this._easings.add(firstEasing);
1820
2634
  }
1821
- if (firstTween) {
2635
+ if (firstEasing) {
1822
2636
  options?.onStart && options.onStart(this);
1823
- firstTween.start();
2637
+ firstEasing.start();
1824
2638
  }
1825
2639
  }
1826
2640
  // twist immediately
@@ -1840,8 +2654,8 @@ var WebGLArcanumCube = class extends ArcanumCube {
1840
2654
  this._twistGroup = void 0;
1841
2655
  super.twist(twist, reverse);
1842
2656
  }
1843
- // twist with tween
1844
- _tweenTwist(twist, reverse, duration, cancel, options = {}) {
2657
+ // twist with easing
2658
+ _easingTwist(twist, reverse, duration, cancel, options = {}) {
1845
2659
  let qa;
1846
2660
  if (this._draggingTwist) {
1847
2661
  this._twistGroup = this._draggingTwist.group;
@@ -1857,7 +2671,7 @@ var WebGLArcanumCube = class extends ArcanumCube {
1857
2671
  qb.setFromAxisAngle(new THREE3.Vector3(axis[0], axis[1], axis[2]), rad);
1858
2672
  }
1859
2673
  const params = { t: 0 };
1860
- const tween = new TWEEN.Tween(params).to({ t: 1 }, duration).easing(TWEEN.Easing.Quartic.Out).onUpdate(() => {
2674
+ const easing = new Tween(params).to({ t: 1 }, duration).easing(Easing.Quartic.Out).onUpdate(() => {
1861
2675
  if (!this._twistGroup) {
1862
2676
  this._twistGroup = this._reconstructGroups(twist);
1863
2677
  }
@@ -1877,17 +2691,17 @@ var WebGLArcanumCube = class extends ArcanumCube {
1877
2691
  if (!cancel) {
1878
2692
  super.twist(twist, reverse);
1879
2693
  }
1880
- this._tweens.remove(tween);
2694
+ this._easings.remove(easing);
1881
2695
  options.onTwisted && options.onTwisted(this, twist, 1, 1);
1882
2696
  options.onComplete && options.onComplete(this);
1883
2697
  if (options.onSolved && this.isSolved()) {
1884
2698
  options.onSolved(this);
1885
2699
  }
1886
2700
  });
1887
- return tween;
2701
+ return easing;
1888
2702
  }
1889
- updateTweens() {
1890
- this._tweens.update();
2703
+ update() {
2704
+ this._easings.update();
1891
2705
  }
1892
2706
  // set color of core lights
1893
2707
  setCoreLightColor(color) {
@@ -1935,5 +2749,6 @@ var WebGLArcanumCube = class extends ArcanumCube {
1935
2749
  getNextStickerColors,
1936
2750
  getRandomTwistList,
1937
2751
  getStickerIndex,
1938
- getStickerPermutationGroup
2752
+ getStickerPermutationGroup,
2753
+ loadDefaultLogoTexture
1939
2754
  });