@stackvibe-studio/three 0.2.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/README.md +60 -15
- package/dist/components/wave-canvas.d.ts +13 -0
- package/dist/index.cjs +86 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.js +74 -1
- package/package.json +19 -1
package/README.md
CHANGED
|
@@ -1,36 +1,81 @@
|
|
|
1
1
|
# @stackvibe-studio/three
|
|
2
2
|
|
|
3
|
-
3D visual primitives
|
|
3
|
+
Product-grade 3D visual primitives, canvas environments, and WebGL components built with Three.js and React Three Fiber.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Designed for immersive hero sections, interactive landing page surfaces, and futuristic product cards with smooth 60fps animations.
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
-
|
|
9
|
-
- React Three Fiber powered with lightweight presets
|
|
10
|
-
- New in v0.2.0: OrbCluster for layered hero artwork
|
|
7
|
+
[](https://www.npmjs.com/package/@stackvibe-studio/three)
|
|
8
|
+
[](https://opensource.org/licenses/MIT)
|
|
11
9
|
|
|
12
|
-
##
|
|
10
|
+
## Features
|
|
11
|
+
|
|
12
|
+
- **WaveCanvas**: WebGL undulating sinusoidal mesh and wave canvas with dynamic light physics.
|
|
13
|
+
- **Glass3DCard**: Glassmorphism-style 3D card wrapper with realistic specular reflection and tilt.
|
|
14
|
+
- **FloatingSphere**: Physics-based floating sphere with ambient lighting and rotation.
|
|
15
|
+
- **OrbCluster**: Multi-layered 3D orb cluster designed for ambient hero backgrounds.
|
|
16
|
+
- **Zero layout shift**: Fully responsive canvas containers with graceful fallback rendering.
|
|
17
|
+
- **Framework agnostic**: Works with Next.js (App Router & Pages Router), Vite, Remix, and Gatsby.
|
|
18
|
+
|
|
19
|
+
## Installation
|
|
13
20
|
|
|
14
21
|
```bash
|
|
22
|
+
pnpm add @stackvibe-studio/three three @react-three/fiber @react-three/drei
|
|
23
|
+
# or
|
|
15
24
|
npm install @stackvibe-studio/three three @react-three/fiber @react-three/drei
|
|
16
25
|
```
|
|
17
26
|
|
|
18
|
-
##
|
|
27
|
+
## Usage
|
|
28
|
+
|
|
29
|
+
### WaveCanvas (Hero Backgrounds)
|
|
30
|
+
|
|
31
|
+
```tsx
|
|
32
|
+
import { WaveCanvas } from '@stackvibe-studio/three';
|
|
33
|
+
|
|
34
|
+
export function HeroSection() {
|
|
35
|
+
return (
|
|
36
|
+
<div className="relative h-[500px] w-full overflow-hidden rounded-2xl bg-zinc-950">
|
|
37
|
+
<WaveCanvas
|
|
38
|
+
wireframe={false}
|
|
39
|
+
speed={1.2}
|
|
40
|
+
color="#6366f1"
|
|
41
|
+
className="absolute inset-0"
|
|
42
|
+
/>
|
|
43
|
+
<div className="relative z-10 flex h-full flex-col items-center justify-center text-center p-8">
|
|
44
|
+
<h1 className="text-4xl font-bold text-white">Next-Gen Interface Canvas</h1>
|
|
45
|
+
<p className="mt-2 text-zinc-400">Interactive 3D surfaces rendered in real-time WebGL.</p>
|
|
46
|
+
</div>
|
|
47
|
+
</div>
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### Glass3DCard & OrbCluster
|
|
19
53
|
|
|
20
54
|
```tsx
|
|
21
55
|
import { Glass3DCard, OrbCluster } from '@stackvibe-studio/three';
|
|
22
56
|
|
|
23
|
-
export function
|
|
57
|
+
export function FeatureCard() {
|
|
24
58
|
return (
|
|
25
|
-
<div>
|
|
26
|
-
<
|
|
27
|
-
<
|
|
59
|
+
<div className="relative flex items-center justify-center p-12">
|
|
60
|
+
<OrbCluster className="absolute inset-0 pointer-events-none opacity-60" />
|
|
61
|
+
<Glass3DCard className="w-80 h-96 p-6">
|
|
62
|
+
<h3 className="text-xl font-bold text-white">Pro Access</h3>
|
|
63
|
+
<p className="text-zinc-400 mt-2">Enterprise-grade WebGL rendering primitives.</p>
|
|
64
|
+
</Glass3DCard>
|
|
28
65
|
</div>
|
|
29
66
|
);
|
|
30
67
|
}
|
|
31
68
|
```
|
|
32
69
|
|
|
33
|
-
##
|
|
70
|
+
## Components Reference
|
|
71
|
+
|
|
72
|
+
| Component | Description | Props |
|
|
73
|
+
| :--- | :--- | :--- |
|
|
74
|
+
| `WaveCanvas` | Real-time undulating 3D sine-wave plane | `wireframe?: boolean`, `speed?: number`, `color?: string`, `className?: string` |
|
|
75
|
+
| `Glass3DCard` | 3D glass card with reflective lighting | `children?: ReactNode`, `className?: string` |
|
|
76
|
+
| `FloatingSphere` | Autonomous 3D floating orb with glow | `color?: string`, `wireframe?: boolean`, `className?: string` |
|
|
77
|
+
| `OrbCluster` | Ambient particle cluster with floating orbs | `count?: number`, `className?: string` |
|
|
78
|
+
|
|
79
|
+
## License
|
|
34
80
|
|
|
35
|
-
-
|
|
36
|
-
- @stackvibe-studio/motion
|
|
81
|
+
MIT © [StackVibe Studio](https://github.com/StackVibe-Studio/stackvibe-ui)
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
interface WaveMeshProps {
|
|
2
|
+
color?: string;
|
|
3
|
+
wireframe?: boolean;
|
|
4
|
+
speed?: number;
|
|
5
|
+
amplitude?: number;
|
|
6
|
+
roughness?: number;
|
|
7
|
+
metalness?: number;
|
|
8
|
+
}
|
|
9
|
+
export interface WaveCanvasProps extends WaveMeshProps {
|
|
10
|
+
className?: string;
|
|
11
|
+
}
|
|
12
|
+
export declare function WaveCanvas({ color, wireframe, speed, amplitude, roughness, metalness, className, }: WaveCanvasProps): import("react").JSX.Element;
|
|
13
|
+
export {};
|
package/dist/index.cjs
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
"use client";
|
|
3
|
+
var __create = Object.create;
|
|
3
4
|
var __defProp = Object.defineProperty;
|
|
4
5
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
6
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
8
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
9
|
var __export = (target, all) => {
|
|
8
10
|
for (var name in all)
|
|
@@ -16,6 +18,14 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
18
|
}
|
|
17
19
|
return to;
|
|
18
20
|
};
|
|
21
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
22
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
23
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
24
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
25
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
26
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
27
|
+
mod
|
|
28
|
+
));
|
|
19
29
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
30
|
|
|
21
31
|
// src/index.ts
|
|
@@ -23,7 +33,8 @@ var index_exports = {};
|
|
|
23
33
|
__export(index_exports, {
|
|
24
34
|
FloatingSphere: () => FloatingSphere,
|
|
25
35
|
Glass3DCard: () => Glass3DCard,
|
|
26
|
-
OrbCluster: () => OrbCluster
|
|
36
|
+
OrbCluster: () => OrbCluster,
|
|
37
|
+
WaveCanvas: () => WaveCanvas
|
|
27
38
|
});
|
|
28
39
|
module.exports = __toCommonJS(index_exports);
|
|
29
40
|
|
|
@@ -131,9 +142,82 @@ function OrbCluster({
|
|
|
131
142
|
))
|
|
132
143
|
] }) });
|
|
133
144
|
}
|
|
145
|
+
|
|
146
|
+
// src/components/wave-canvas.tsx
|
|
147
|
+
var import_fiber4 = require("@react-three/fiber");
|
|
148
|
+
var import_react = require("react");
|
|
149
|
+
var THREE = __toESM(require("three"), 1);
|
|
150
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
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
|
+
}) {
|
|
159
|
+
const meshRef = (0, import_react.useRef)(null);
|
|
160
|
+
const { positions } = (0, import_react.useMemo)(() => {
|
|
161
|
+
const geo = new THREE.PlaneGeometry(6, 6, 32, 32);
|
|
162
|
+
return { positions: geo.attributes.position };
|
|
163
|
+
}, []);
|
|
164
|
+
(0, import_fiber4.useFrame)(({ clock }) => {
|
|
165
|
+
if (!meshRef.current) return;
|
|
166
|
+
const t = clock.getElapsedTime() * speed;
|
|
167
|
+
const geom = meshRef.current.geometry;
|
|
168
|
+
const pos = geom.attributes.position;
|
|
169
|
+
for (let i = 0; i < pos.count; i++) {
|
|
170
|
+
const u = pos.getX(i);
|
|
171
|
+
const v = pos.getY(i);
|
|
172
|
+
const z = Math.sin(u * 1.5 + t) * amplitude + Math.cos(v * 1.5 + t) * amplitude;
|
|
173
|
+
pos.setZ(i, z);
|
|
174
|
+
}
|
|
175
|
+
pos.needsUpdate = true;
|
|
176
|
+
});
|
|
177
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("mesh", { ref: meshRef, rotation: [-Math.PI / 3, 0, 0], children: [
|
|
178
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("planeGeometry", { args: [6, 6, 32, 32] }),
|
|
179
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
180
|
+
"meshStandardMaterial",
|
|
181
|
+
{
|
|
182
|
+
color,
|
|
183
|
+
wireframe,
|
|
184
|
+
roughness,
|
|
185
|
+
metalness,
|
|
186
|
+
side: THREE.DoubleSide
|
|
187
|
+
}
|
|
188
|
+
)
|
|
189
|
+
] });
|
|
190
|
+
}
|
|
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
|
+
}) {
|
|
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: [
|
|
201
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("ambientLight", { intensity: 0.8 }),
|
|
202
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("directionalLight", { position: [3, 5, 4], intensity: 1.5 }),
|
|
203
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("pointLight", { position: [-3, -3, 2], intensity: 0.5, color: "#22d3ee" }),
|
|
204
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
205
|
+
WaveMesh,
|
|
206
|
+
{
|
|
207
|
+
color,
|
|
208
|
+
wireframe,
|
|
209
|
+
speed,
|
|
210
|
+
amplitude,
|
|
211
|
+
roughness,
|
|
212
|
+
metalness
|
|
213
|
+
}
|
|
214
|
+
)
|
|
215
|
+
] }) });
|
|
216
|
+
}
|
|
134
217
|
// Annotate the CommonJS export names for ESM import in node:
|
|
135
218
|
0 && (module.exports = {
|
|
136
219
|
FloatingSphere,
|
|
137
220
|
Glass3DCard,
|
|
138
|
-
OrbCluster
|
|
221
|
+
OrbCluster,
|
|
222
|
+
WaveCanvas
|
|
139
223
|
});
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -104,8 +104,81 @@ function OrbCluster({
|
|
|
104
104
|
))
|
|
105
105
|
] }) });
|
|
106
106
|
}
|
|
107
|
+
|
|
108
|
+
// src/components/wave-canvas.tsx
|
|
109
|
+
import { Canvas as Canvas4, useFrame } from "@react-three/fiber";
|
|
110
|
+
import { useRef, useMemo } from "react";
|
|
111
|
+
import * as THREE from "three";
|
|
112
|
+
import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
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
|
+
}) {
|
|
121
|
+
const meshRef = useRef(null);
|
|
122
|
+
const { positions } = useMemo(() => {
|
|
123
|
+
const geo = new THREE.PlaneGeometry(6, 6, 32, 32);
|
|
124
|
+
return { positions: geo.attributes.position };
|
|
125
|
+
}, []);
|
|
126
|
+
useFrame(({ clock }) => {
|
|
127
|
+
if (!meshRef.current) return;
|
|
128
|
+
const t = clock.getElapsedTime() * speed;
|
|
129
|
+
const geom = meshRef.current.geometry;
|
|
130
|
+
const pos = geom.attributes.position;
|
|
131
|
+
for (let i = 0; i < pos.count; i++) {
|
|
132
|
+
const u = pos.getX(i);
|
|
133
|
+
const v = pos.getY(i);
|
|
134
|
+
const z = Math.sin(u * 1.5 + t) * amplitude + Math.cos(v * 1.5 + t) * amplitude;
|
|
135
|
+
pos.setZ(i, z);
|
|
136
|
+
}
|
|
137
|
+
pos.needsUpdate = true;
|
|
138
|
+
});
|
|
139
|
+
return /* @__PURE__ */ jsxs4("mesh", { ref: meshRef, rotation: [-Math.PI / 3, 0, 0], children: [
|
|
140
|
+
/* @__PURE__ */ jsx4("planeGeometry", { args: [6, 6, 32, 32] }),
|
|
141
|
+
/* @__PURE__ */ jsx4(
|
|
142
|
+
"meshStandardMaterial",
|
|
143
|
+
{
|
|
144
|
+
color,
|
|
145
|
+
wireframe,
|
|
146
|
+
roughness,
|
|
147
|
+
metalness,
|
|
148
|
+
side: THREE.DoubleSide
|
|
149
|
+
}
|
|
150
|
+
)
|
|
151
|
+
] });
|
|
152
|
+
}
|
|
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
|
+
}) {
|
|
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: [
|
|
163
|
+
/* @__PURE__ */ jsx4("ambientLight", { intensity: 0.8 }),
|
|
164
|
+
/* @__PURE__ */ jsx4("directionalLight", { position: [3, 5, 4], intensity: 1.5 }),
|
|
165
|
+
/* @__PURE__ */ jsx4("pointLight", { position: [-3, -3, 2], intensity: 0.5, color: "#22d3ee" }),
|
|
166
|
+
/* @__PURE__ */ jsx4(
|
|
167
|
+
WaveMesh,
|
|
168
|
+
{
|
|
169
|
+
color,
|
|
170
|
+
wireframe,
|
|
171
|
+
speed,
|
|
172
|
+
amplitude,
|
|
173
|
+
roughness,
|
|
174
|
+
metalness
|
|
175
|
+
}
|
|
176
|
+
)
|
|
177
|
+
] }) });
|
|
178
|
+
}
|
|
107
179
|
export {
|
|
108
180
|
FloatingSphere,
|
|
109
181
|
Glass3DCard,
|
|
110
|
-
OrbCluster
|
|
182
|
+
OrbCluster,
|
|
183
|
+
WaveCanvas
|
|
111
184
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stackvibe-studio/three",
|
|
3
|
-
"version": "0.
|
|
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": {
|