@canvas3/nuxt 0.1.22 → 0.1.24
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/module.json
CHANGED
|
@@ -12,6 +12,7 @@ import Scroll from "#canvas3-nuxt/utils/canvas3/scroll";
|
|
|
12
12
|
import { defaultCanvas3Options } from "#canvas3-nuxt/constants/default-canvas3-options";
|
|
13
13
|
import { studio783log } from "#canvas3-nuxt/constants/studio783Log";
|
|
14
14
|
const canvasInitiated = ref(false);
|
|
15
|
+
const ANIMATION_FALSE_STATE_DELAY = 0;
|
|
15
16
|
class Canvas3Class {
|
|
16
17
|
canvasInitiated = canvasInitiated;
|
|
17
18
|
mouseMoveInProgress = false;
|
|
@@ -375,7 +376,13 @@ class Canvas3Class {
|
|
|
375
376
|
this.meshPositionsUpdate = state;
|
|
376
377
|
}
|
|
377
378
|
setAnimationsToRender(state) {
|
|
378
|
-
|
|
379
|
+
if (state) {
|
|
380
|
+
this.animationsRender = state;
|
|
381
|
+
} else {
|
|
382
|
+
setTimeout(() => {
|
|
383
|
+
this.animationsRender = state;
|
|
384
|
+
}, ANIMATION_FALSE_STATE_DELAY);
|
|
385
|
+
}
|
|
379
386
|
}
|
|
380
387
|
setAnimationToRender(callBackName, state, animationId) {
|
|
381
388
|
const animationToUpdate = this.animations.get(callBackName);
|
|
@@ -385,7 +392,14 @@ class Canvas3Class {
|
|
|
385
392
|
} else {
|
|
386
393
|
animationToUpdate.animationIds.splice(animationToUpdate.animationIds.indexOf(animationId), 1);
|
|
387
394
|
}
|
|
388
|
-
|
|
395
|
+
const newState = animationToUpdate.animationIds.length > 0;
|
|
396
|
+
if (newState) {
|
|
397
|
+
animationToUpdate.render = newState;
|
|
398
|
+
} else {
|
|
399
|
+
setTimeout(() => {
|
|
400
|
+
animationToUpdate.render = newState;
|
|
401
|
+
}, ANIMATION_FALSE_STATE_DELAY);
|
|
402
|
+
}
|
|
389
403
|
}
|
|
390
404
|
externalAnimationsRender() {
|
|
391
405
|
for (const [_key, callbackOption] of this.animations.entries()) {
|
|
@@ -412,21 +426,24 @@ class Canvas3Class {
|
|
|
412
426
|
if (this.meshPositionsUpdate) {
|
|
413
427
|
this.resizeImageStore();
|
|
414
428
|
}
|
|
415
|
-
this.
|
|
429
|
+
if (this.animations.size > 0)
|
|
430
|
+
this.externalAnimationsRender();
|
|
416
431
|
if (this.materials.length > 0) {
|
|
417
432
|
for (const material of this.materials) {
|
|
418
433
|
if (material.uniforms.uTime)
|
|
419
434
|
material.uniforms.uTime.value = this.time;
|
|
420
|
-
if (
|
|
421
|
-
material.uniforms.uMouse
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
material.uniforms.uMouseMovement
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
435
|
+
if (this.mouseMoveInProgress) {
|
|
436
|
+
if (material.uniforms.uMouse)
|
|
437
|
+
material.uniforms.uMouse.value.set(
|
|
438
|
+
this.mouse.x,
|
|
439
|
+
this.mouse.y
|
|
440
|
+
);
|
|
441
|
+
if (material.uniforms.uMouseMovement)
|
|
442
|
+
material.uniforms.uMouseMovement.value.set(
|
|
443
|
+
this.mouse.movementX,
|
|
444
|
+
this.mouse.movementY
|
|
445
|
+
);
|
|
446
|
+
}
|
|
430
447
|
}
|
|
431
448
|
}
|
|
432
449
|
if (this.composer) {
|