@stackvibe-studio/three 0.3.0 → 0.3.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/components/wave-canvas.d.ts +9 -2
- package/dist/index.cjs +34 -14
- package/dist/index.js +34 -14
- package/package.json +19 -1
|
@@ -1,6 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
interface WaveMeshProps {
|
|
2
2
|
color?: string;
|
|
3
3
|
wireframe?: boolean;
|
|
4
|
+
speed?: number;
|
|
5
|
+
amplitude?: number;
|
|
6
|
+
roughness?: number;
|
|
7
|
+
metalness?: number;
|
|
8
|
+
}
|
|
9
|
+
export interface WaveCanvasProps extends WaveMeshProps {
|
|
4
10
|
className?: string;
|
|
5
11
|
}
|
|
6
|
-
export declare function WaveCanvas({ color, wireframe, className }: WaveCanvasProps): import("react").JSX.Element;
|
|
12
|
+
export declare function WaveCanvas({ color, wireframe, speed, amplitude, roughness, metalness, className, }: WaveCanvasProps): import("react").JSX.Element;
|
|
13
|
+
export {};
|
package/dist/index.cjs
CHANGED
|
@@ -148,26 +148,28 @@ var import_fiber4 = require("@react-three/fiber");
|
|
|
148
148
|
var import_react = require("react");
|
|
149
149
|
var THREE = __toESM(require("three"), 1);
|
|
150
150
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
151
|
-
function WaveMesh({
|
|
151
|
+
function WaveMesh({
|
|
152
|
+
color = "#8b5cf6",
|
|
153
|
+
wireframe = false,
|
|
154
|
+
speed = 1.5,
|
|
155
|
+
amplitude = 0.25,
|
|
156
|
+
roughness = 0.3,
|
|
157
|
+
metalness = 0.5
|
|
158
|
+
}) {
|
|
152
159
|
const meshRef = (0, import_react.useRef)(null);
|
|
153
|
-
const { positions
|
|
160
|
+
const { positions } = (0, import_react.useMemo)(() => {
|
|
154
161
|
const geo = new THREE.PlaneGeometry(6, 6, 32, 32);
|
|
155
|
-
|
|
156
|
-
const orig = new Float32Array(pos.count);
|
|
157
|
-
for (let i = 0; i < pos.count; i++) {
|
|
158
|
-
orig[i] = pos.getZ(i);
|
|
159
|
-
}
|
|
160
|
-
return { positions: pos, originalZ: orig };
|
|
162
|
+
return { positions: geo.attributes.position };
|
|
161
163
|
}, []);
|
|
162
164
|
(0, import_fiber4.useFrame)(({ clock }) => {
|
|
163
165
|
if (!meshRef.current) return;
|
|
164
|
-
const t = clock.getElapsedTime() *
|
|
166
|
+
const t = clock.getElapsedTime() * speed;
|
|
165
167
|
const geom = meshRef.current.geometry;
|
|
166
168
|
const pos = geom.attributes.position;
|
|
167
169
|
for (let i = 0; i < pos.count; i++) {
|
|
168
170
|
const u = pos.getX(i);
|
|
169
171
|
const v = pos.getY(i);
|
|
170
|
-
const z = Math.sin(u * 1.5 + t) *
|
|
172
|
+
const z = Math.sin(u * 1.5 + t) * amplitude + Math.cos(v * 1.5 + t) * amplitude;
|
|
171
173
|
pos.setZ(i, z);
|
|
172
174
|
}
|
|
173
175
|
pos.needsUpdate = true;
|
|
@@ -179,19 +181,37 @@ function WaveMesh({ color = "#8b5cf6", wireframe = false }) {
|
|
|
179
181
|
{
|
|
180
182
|
color,
|
|
181
183
|
wireframe,
|
|
182
|
-
roughness
|
|
183
|
-
metalness
|
|
184
|
+
roughness,
|
|
185
|
+
metalness,
|
|
184
186
|
side: THREE.DoubleSide
|
|
185
187
|
}
|
|
186
188
|
)
|
|
187
189
|
] });
|
|
188
190
|
}
|
|
189
|
-
function WaveCanvas({
|
|
191
|
+
function WaveCanvas({
|
|
192
|
+
color = "#8b5cf6",
|
|
193
|
+
wireframe = false,
|
|
194
|
+
speed = 1.5,
|
|
195
|
+
amplitude = 0.25,
|
|
196
|
+
roughness = 0.3,
|
|
197
|
+
metalness = 0.5,
|
|
198
|
+
className = ""
|
|
199
|
+
}) {
|
|
190
200
|
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: ["h-64 w-full rounded-3xl overflow-hidden bg-slate-950/50", className].join(" "), children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_fiber4.Canvas, { camera: { position: [0, -1, 3], fov: 60 }, children: [
|
|
191
201
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("ambientLight", { intensity: 0.8 }),
|
|
192
202
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("directionalLight", { position: [3, 5, 4], intensity: 1.5 }),
|
|
193
203
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("pointLight", { position: [-3, -3, 2], intensity: 0.5, color: "#22d3ee" }),
|
|
194
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
204
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
205
|
+
WaveMesh,
|
|
206
|
+
{
|
|
207
|
+
color,
|
|
208
|
+
wireframe,
|
|
209
|
+
speed,
|
|
210
|
+
amplitude,
|
|
211
|
+
roughness,
|
|
212
|
+
metalness
|
|
213
|
+
}
|
|
214
|
+
)
|
|
195
215
|
] }) });
|
|
196
216
|
}
|
|
197
217
|
// Annotate the CommonJS export names for ESM import in node:
|
package/dist/index.js
CHANGED
|
@@ -110,26 +110,28 @@ import { Canvas as Canvas4, useFrame } from "@react-three/fiber";
|
|
|
110
110
|
import { useRef, useMemo } from "react";
|
|
111
111
|
import * as THREE from "three";
|
|
112
112
|
import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
113
|
-
function WaveMesh({
|
|
113
|
+
function WaveMesh({
|
|
114
|
+
color = "#8b5cf6",
|
|
115
|
+
wireframe = false,
|
|
116
|
+
speed = 1.5,
|
|
117
|
+
amplitude = 0.25,
|
|
118
|
+
roughness = 0.3,
|
|
119
|
+
metalness = 0.5
|
|
120
|
+
}) {
|
|
114
121
|
const meshRef = useRef(null);
|
|
115
|
-
const { positions
|
|
122
|
+
const { positions } = useMemo(() => {
|
|
116
123
|
const geo = new THREE.PlaneGeometry(6, 6, 32, 32);
|
|
117
|
-
|
|
118
|
-
const orig = new Float32Array(pos.count);
|
|
119
|
-
for (let i = 0; i < pos.count; i++) {
|
|
120
|
-
orig[i] = pos.getZ(i);
|
|
121
|
-
}
|
|
122
|
-
return { positions: pos, originalZ: orig };
|
|
124
|
+
return { positions: geo.attributes.position };
|
|
123
125
|
}, []);
|
|
124
126
|
useFrame(({ clock }) => {
|
|
125
127
|
if (!meshRef.current) return;
|
|
126
|
-
const t = clock.getElapsedTime() *
|
|
128
|
+
const t = clock.getElapsedTime() * speed;
|
|
127
129
|
const geom = meshRef.current.geometry;
|
|
128
130
|
const pos = geom.attributes.position;
|
|
129
131
|
for (let i = 0; i < pos.count; i++) {
|
|
130
132
|
const u = pos.getX(i);
|
|
131
133
|
const v = pos.getY(i);
|
|
132
|
-
const z = Math.sin(u * 1.5 + t) *
|
|
134
|
+
const z = Math.sin(u * 1.5 + t) * amplitude + Math.cos(v * 1.5 + t) * amplitude;
|
|
133
135
|
pos.setZ(i, z);
|
|
134
136
|
}
|
|
135
137
|
pos.needsUpdate = true;
|
|
@@ -141,19 +143,37 @@ function WaveMesh({ color = "#8b5cf6", wireframe = false }) {
|
|
|
141
143
|
{
|
|
142
144
|
color,
|
|
143
145
|
wireframe,
|
|
144
|
-
roughness
|
|
145
|
-
metalness
|
|
146
|
+
roughness,
|
|
147
|
+
metalness,
|
|
146
148
|
side: THREE.DoubleSide
|
|
147
149
|
}
|
|
148
150
|
)
|
|
149
151
|
] });
|
|
150
152
|
}
|
|
151
|
-
function WaveCanvas({
|
|
153
|
+
function WaveCanvas({
|
|
154
|
+
color = "#8b5cf6",
|
|
155
|
+
wireframe = false,
|
|
156
|
+
speed = 1.5,
|
|
157
|
+
amplitude = 0.25,
|
|
158
|
+
roughness = 0.3,
|
|
159
|
+
metalness = 0.5,
|
|
160
|
+
className = ""
|
|
161
|
+
}) {
|
|
152
162
|
return /* @__PURE__ */ jsx4("div", { className: ["h-64 w-full rounded-3xl overflow-hidden bg-slate-950/50", className].join(" "), children: /* @__PURE__ */ jsxs4(Canvas4, { camera: { position: [0, -1, 3], fov: 60 }, children: [
|
|
153
163
|
/* @__PURE__ */ jsx4("ambientLight", { intensity: 0.8 }),
|
|
154
164
|
/* @__PURE__ */ jsx4("directionalLight", { position: [3, 5, 4], intensity: 1.5 }),
|
|
155
165
|
/* @__PURE__ */ jsx4("pointLight", { position: [-3, -3, 2], intensity: 0.5, color: "#22d3ee" }),
|
|
156
|
-
/* @__PURE__ */ jsx4(
|
|
166
|
+
/* @__PURE__ */ jsx4(
|
|
167
|
+
WaveMesh,
|
|
168
|
+
{
|
|
169
|
+
color,
|
|
170
|
+
wireframe,
|
|
171
|
+
speed,
|
|
172
|
+
amplitude,
|
|
173
|
+
roughness,
|
|
174
|
+
metalness
|
|
175
|
+
}
|
|
176
|
+
)
|
|
157
177
|
] }) });
|
|
158
178
|
}
|
|
159
179
|
export {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stackvibe-studio/three",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "3D component layer for StackVibe UI.",
|
|
6
6
|
"repository": {
|
|
@@ -12,6 +12,24 @@
|
|
|
12
12
|
"url": "https://github.com/StackVibe-Studio/stackvibe-ui/issues"
|
|
13
13
|
},
|
|
14
14
|
"license": "MIT",
|
|
15
|
+
"keywords": [
|
|
16
|
+
"react",
|
|
17
|
+
"react-19",
|
|
18
|
+
"three",
|
|
19
|
+
"threejs",
|
|
20
|
+
"webgl",
|
|
21
|
+
"react-three-fiber",
|
|
22
|
+
"drei",
|
|
23
|
+
"3d",
|
|
24
|
+
"canvas",
|
|
25
|
+
"wave-canvas",
|
|
26
|
+
"floating-sphere",
|
|
27
|
+
"glassmorphism",
|
|
28
|
+
"glass-card",
|
|
29
|
+
"orb-cluster",
|
|
30
|
+
"shaders",
|
|
31
|
+
"stackvibe"
|
|
32
|
+
],
|
|
15
33
|
"main": "./dist/index.js",
|
|
16
34
|
"types": "./dist/index.d.ts",
|
|
17
35
|
"exports": {
|