@canvas3/nuxt 0.1.23 → 0.1.25
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
|
@@ -7,6 +7,7 @@ import Scroll from '#canvas3-nuxt/utils/canvas3/scroll';
|
|
|
7
7
|
import type { AnimationCallbacks, Canvas3OptionsType, ScrollActionBinding, MeshMaterialUniform, MeshType, myEffectType, AnimationCallSetup } from '#canvas3-nuxt/types/types';
|
|
8
8
|
declare class Canvas3Class {
|
|
9
9
|
canvasInitiated: import("vue").Ref<boolean, boolean>;
|
|
10
|
+
renderDisabled: boolean;
|
|
10
11
|
mouseMoveInProgress: boolean;
|
|
11
12
|
animationsRender: boolean;
|
|
12
13
|
documentVisibility: boolean;
|
|
@@ -40,6 +41,7 @@ declare class Canvas3Class {
|
|
|
40
41
|
yPrev: number;
|
|
41
42
|
};
|
|
42
43
|
init(canvasElement: HTMLElement, scrollableContent: HTMLElement, canvas3Options: Canvas3OptionsType): Promise<void>;
|
|
44
|
+
setRenderDisabled(status: boolean): void;
|
|
43
45
|
setCanvasAndCamera(): void;
|
|
44
46
|
resizeOnChange(): void;
|
|
45
47
|
resizeImageStore(): void;
|
|
@@ -12,8 +12,10 @@ 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;
|
|
18
|
+
renderDisabled = false;
|
|
17
19
|
mouseMoveInProgress = false;
|
|
18
20
|
animationsRender = false;
|
|
19
21
|
documentVisibility = true;
|
|
@@ -89,6 +91,13 @@ class Canvas3Class {
|
|
|
89
91
|
this.canvasInitiated.value = true;
|
|
90
92
|
studio783log();
|
|
91
93
|
}
|
|
94
|
+
setRenderDisabled(status) {
|
|
95
|
+
if (!status && this.renderDisabled) {
|
|
96
|
+
this.renderDisabled = false;
|
|
97
|
+
this.render();
|
|
98
|
+
}
|
|
99
|
+
this.renderDisabled = status;
|
|
100
|
+
}
|
|
92
101
|
setCanvasAndCamera() {
|
|
93
102
|
this.width = this.canvasContainer?.offsetWidth ?? 0;
|
|
94
103
|
this.height = this.canvasContainer?.offsetHeight ?? 0;
|
|
@@ -375,7 +384,13 @@ class Canvas3Class {
|
|
|
375
384
|
this.meshPositionsUpdate = state;
|
|
376
385
|
}
|
|
377
386
|
setAnimationsToRender(state) {
|
|
378
|
-
|
|
387
|
+
if (state) {
|
|
388
|
+
this.animationsRender = state;
|
|
389
|
+
} else {
|
|
390
|
+
setTimeout(() => {
|
|
391
|
+
this.animationsRender = state;
|
|
392
|
+
}, ANIMATION_FALSE_STATE_DELAY);
|
|
393
|
+
}
|
|
379
394
|
}
|
|
380
395
|
setAnimationToRender(callBackName, state, animationId) {
|
|
381
396
|
const animationToUpdate = this.animations.get(callBackName);
|
|
@@ -385,7 +400,14 @@ class Canvas3Class {
|
|
|
385
400
|
} else {
|
|
386
401
|
animationToUpdate.animationIds.splice(animationToUpdate.animationIds.indexOf(animationId), 1);
|
|
387
402
|
}
|
|
388
|
-
|
|
403
|
+
const newState = animationToUpdate.animationIds.length > 0;
|
|
404
|
+
if (newState) {
|
|
405
|
+
animationToUpdate.render = newState;
|
|
406
|
+
} else {
|
|
407
|
+
setTimeout(() => {
|
|
408
|
+
animationToUpdate.render = newState;
|
|
409
|
+
}, ANIMATION_FALSE_STATE_DELAY);
|
|
410
|
+
}
|
|
389
411
|
}
|
|
390
412
|
externalAnimationsRender() {
|
|
391
413
|
for (const [_key, callbackOption] of this.animations.entries()) {
|
|
@@ -439,6 +461,7 @@ class Canvas3Class {
|
|
|
439
461
|
}
|
|
440
462
|
try {
|
|
441
463
|
if (!this.documentVisibility) return;
|
|
464
|
+
if (this.renderDisabled) return;
|
|
442
465
|
requestAnimationFrame(this.render.bind(this));
|
|
443
466
|
} catch (e) {
|
|
444
467
|
console.error(e);
|
|
@@ -10,6 +10,7 @@ export declare const Canvas3: {
|
|
|
10
10
|
removeMesh: (id: string) => void;
|
|
11
11
|
setAnimationsToRender: (state: boolean) => void;
|
|
12
12
|
setAnimationToRender: (callBackName: string, state: boolean, animationId: string) => void;
|
|
13
|
+
setRenderDisabled: (status: boolean) => void;
|
|
13
14
|
resizeOnChange: () => void;
|
|
14
15
|
scrollToElBySelector: (elQuerySelector: string, delay?: number, margin?: number) => void;
|
|
15
16
|
setMeshPositionsUpdate: (state: boolean) => void;
|
|
@@ -14,6 +14,7 @@ export const Canvas3 = {
|
|
|
14
14
|
removeMesh: mainClass.removeMesh.bind(mainClass),
|
|
15
15
|
setAnimationsToRender: mainClass.setAnimationsToRender.bind(mainClass),
|
|
16
16
|
setAnimationToRender: mainClass.setAnimationToRender.bind(mainClass),
|
|
17
|
+
setRenderDisabled: mainClass.setRenderDisabled.bind(mainClass),
|
|
17
18
|
resizeOnChange: mainClass.resizeOnChange.bind(mainClass),
|
|
18
19
|
scrollToElBySelector: mainClass.scrollToElBySelector.bind(mainClass),
|
|
19
20
|
setMeshPositionsUpdate: mainClass.setMeshPositionsUpdate.bind(mainClass),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@canvas3/nuxt",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.25",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -41,11 +41,13 @@
|
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"@nuxt/kit": "^4.0.0",
|
|
44
|
-
"gsap": "^3.13.0",
|
|
45
|
-
"three": "^0.178.0",
|
|
46
44
|
"vite-plugin-glsl": "^1.5.1",
|
|
47
45
|
"vue": "^3.5.18"
|
|
48
46
|
},
|
|
47
|
+
"peerDependencies": {
|
|
48
|
+
"gsap": "^3.13.0",
|
|
49
|
+
"three": "^0.178.0"
|
|
50
|
+
},
|
|
49
51
|
"devDependencies": {
|
|
50
52
|
"@nuxt/devtools": "2.6.4",
|
|
51
53
|
"@nuxt/eslint-config": "^1.2.0",
|
|
@@ -58,6 +60,8 @@
|
|
|
58
60
|
"nuxt": "^4.4.6",
|
|
59
61
|
"typescript": "~5.8.3",
|
|
60
62
|
"vitest": "^3.2.4",
|
|
61
|
-
"vue-tsc": "^3.0.1"
|
|
63
|
+
"vue-tsc": "^3.0.1",
|
|
64
|
+
"gsap": "^3.13.0",
|
|
65
|
+
"three": "^0.178.0"
|
|
62
66
|
}
|
|
63
67
|
}
|