@canvas3/nuxt 0.1.14 → 0.1.15

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
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "canvas-nuxt-layout",
3
3
  "configKey": "canvas3Layout",
4
- "version": "0.1.14",
4
+ "version": "0.1.15",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "3.6.0"
@@ -486,19 +486,21 @@ class Canvas3Class {
486
486
  if (this.animateImageMesh) {
487
487
  this.resizeImageStore();
488
488
  }
489
- for (const material of this.materials) {
490
- if (material.uniforms.uTime)
491
- material.uniforms.uTime.value = this.time;
492
- if (material.uniforms.uMouse)
493
- material.uniforms.uMouse.value = new THREE.Vector2(
494
- this.mouse.x,
495
- this.mouse.y
496
- );
497
- if (material.uniforms.uMouseMovement)
498
- material.uniforms.uMouseMovement.value = new THREE.Vector2(
499
- this.mouse.movementX,
500
- this.mouse.movementY
501
- );
489
+ if (this.materials.length > 0) {
490
+ for (const material of this.materials) {
491
+ if (material.uniforms.uTime)
492
+ material.uniforms.uTime.value = this.time;
493
+ if (material.uniforms.uMouse)
494
+ material.uniforms.uMouse.value.set(
495
+ this.mouse.x,
496
+ this.mouse.y
497
+ );
498
+ if (material.uniforms.uMouseMovement)
499
+ material.uniforms.uMouseMovement.value.set(
500
+ this.mouse.movementX,
501
+ this.mouse.movementY
502
+ );
503
+ }
502
504
  }
503
505
  for (const [_key, callback] of this.animations.entries()) {
504
506
  callback?.();
@@ -13,6 +13,7 @@ export declare const Canvas3: {
13
13
  setMeshPositionsUpdate: (state: boolean) => void;
14
14
  scrollToTop: (delay?: number) => void;
15
15
  scrollTo: (position: number, delay?: number) => void;
16
+ getScrollPosition: () => number | null;
16
17
  getScrollSpeed: () => number | null;
17
18
  getCamera: () => import("three").PerspectiveCamera | null;
18
19
  getRenderer: () => import("three").WebGLRenderer | null;
@@ -17,6 +17,9 @@ export const Canvas3 = {
17
17
  setMeshPositionsUpdate: mainClass.setMeshPositionsUpdate.bind(mainClass),
18
18
  scrollToTop: mainClass.scrollToTop.bind(mainClass),
19
19
  scrollTo: mainClass.scrollTo.bind(mainClass),
20
+ getScrollPosition: () => {
21
+ return mainClass.scroll?.scrollRendered ?? null;
22
+ },
20
23
  getScrollSpeed: () => {
21
24
  return mainClass.scroll?.speed ?? null;
22
25
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@canvas3/nuxt",
3
- "version": "0.1.14",
3
+ "version": "0.1.15",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },