3d-marquee 0.1.7 → 0.1.9

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.
Files changed (2) hide show
  1. package/README.md +110 -30
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,6 +1,89 @@
1
- # LED Marquee Orb
1
+ # 3D Marquee
2
2
 
3
- A React + Vite single-page application featuring a 3D rotating orb with a scrolling LED marquee effect. The word scrolls horizontally across the center band of the sphere, creating a seamless ticker display.
3
+ A React library featuring a 3D rotating orb with a scrolling LED marquee effect. The word scrolls horizontally across the center band of the sphere, creating a seamless ticker display.
4
+
5
+ ![3D Marquee Preview](./assets/preview.png)
6
+
7
+ ## Installation
8
+
9
+ Install the package and its peer dependencies:
10
+
11
+ ```bash
12
+ npm install 3d-marquee @react-three/fiber @react-three/drei @react-three/postprocessing react react-dom three
13
+ ```
14
+
15
+ ### Peer Dependencies
16
+
17
+ - `react`: `^18.2.0 || ^19.0.0`
18
+ - `react-dom`: `^18.2.0 || ^19.0.0`
19
+ - `three`: `>=0.158.0`
20
+ - `@react-three/fiber`: `^8.15.11 || ^9.0.0`
21
+ - `@react-three/drei`: `^9.92.7 || ^10.0.0`
22
+ - `@react-three/postprocessing`: `^2.15.9 || ^3.0.0`
23
+
24
+ ## Usage
25
+
26
+ Import and use the `LedMarqueeOrbContainer` component:
27
+
28
+ ```tsx
29
+ import { LedMarqueeOrbContainer } from '3d-marquee'
30
+
31
+ function App() {
32
+ return (
33
+ <div style={{ width: '100vw', height: '100vh' }}>
34
+ <LedMarqueeOrbContainer
35
+ word="Hello World"
36
+ speed={0.1}
37
+ dimColor="red"
38
+ brightColor="blue"
39
+ />
40
+ </div>
41
+ )
42
+ }
43
+ ```
44
+
45
+ ### Vite Configuration
46
+
47
+ If you're using Vite, add this to your `vite.config.ts` to ensure React is properly deduplicated:
48
+
49
+ ```ts
50
+ import { defineConfig } from 'vite'
51
+ import react from '@vitejs/plugin-react'
52
+
53
+ export default defineConfig({
54
+ plugins: [react()],
55
+ resolve: {
56
+ dedupe: ['react', 'react-dom'],
57
+ },
58
+ optimizeDeps: {
59
+ include: ['react', 'react-dom', '@react-three/fiber', '@react-three/drei', '@react-three/postprocessing'],
60
+ },
61
+ })
62
+ ```
63
+
64
+ ## Component API
65
+
66
+ ### `LedMarqueeOrbContainer`
67
+
68
+ The main component that includes the Canvas, lighting, controls, and post-processing effects.
69
+
70
+ **Props:**
71
+
72
+ - `word` (string, **required**): The text to display on the marquee
73
+ - `speed` (number, **required**): Scroll speed multiplier (higher = faster)
74
+ - `dimColor` (string, **required**): Color for inactive LEDs (e.g., `"#1a261a"` or `"red"`)
75
+ - `brightColor` (string, **required**): Color for active LEDs (e.g., `"#00ff4d"` or `"blue"`)
76
+ - `radius` (number, optional, default: `1`): Sphere radius
77
+ - `ledSpacing` (number, optional, default: `0.0075`): Spacing between LED dots
78
+ - `columnSpacing` (number, optional, default: `0.005`): Spacing between columns
79
+
80
+ ### `LedMarqueeOrb`
81
+
82
+ The core orb component (used internally by `LedMarqueeOrbContainer`). You can use this directly if you need more control over the Canvas setup.
83
+
84
+ **Props:**
85
+
86
+ Same as `LedMarqueeOrbContainer`, but all props are optional with defaults.
4
87
 
5
88
  ## Features
6
89
 
@@ -8,55 +91,53 @@ A React + Vite single-page application featuring a 3D rotating orb with a scroll
8
91
  - **LED Marquee Effect**: Text scrolls horizontally across the center band
9
92
  - **Shader-Based Rendering**: High-performance GPU-accelerated LED matrix effect
10
93
  - **Bloom Post-Processing**: Glowing LED effect with bloom shader
94
+ - **Customizable Colors**: Set dim and bright LED colors via props
11
95
  - **Responsive Design**: Full viewport canvas that adapts to screen size
12
96
 
13
- ## Installation
97
+ ## Controls
98
+
99
+ - **Mouse Drag**: Rotate the camera around the orb
100
+ - **Scroll**: Zoom in/out
101
+
102
+ ## Development
103
+
104
+ ### Building the Library
105
+
106
+ To build the library for distribution:
14
107
 
15
- 1. Install dependencies:
16
108
  ```bash
17
- npm install
109
+ npm run build:lib
18
110
  ```
19
111
 
20
- ## Running the Application
112
+ This creates the distribution files in the `dist/` directory.
113
+
114
+ ### Running the Demo
115
+
116
+ To run the demo/example application:
21
117
 
22
- Start the development server:
23
118
  ```bash
24
119
  npm run dev
25
120
  ```
26
121
 
27
122
  The application will be available at `http://localhost:5173` (or the port shown in the terminal).
28
123
 
29
- ## Building for Production
124
+ ### Building for Production
30
125
 
31
126
  Build the production bundle:
127
+
32
128
  ```bash
33
129
  npm run build
34
130
  ```
35
131
 
36
132
  Preview the production build:
133
+
37
134
  ```bash
38
135
  npm run preview
39
136
  ```
40
137
 
41
- ## Component API
42
-
43
- The `LedMarqueeOrb` component accepts the following props:
44
-
45
- - `word` (string, required): The text to display on the marquee
46
- - `speed` (number, optional, default: 0.25): Scroll speed multiplier
47
- - `radius` (number, optional, default: 1): Sphere radius
48
- - `bandHeight` (number, optional, default: 0.2): Height of the LED band (0-1)
49
- - `ledSpacing` (number, optional, default: 0.05): Spacing between LED dots
50
-
51
- ## Example Usage
52
-
53
- ```tsx
54
- <LedMarqueeOrb word="ROADHERO" speed={0.3} radius={1.2} />
55
- ```
56
-
57
138
  ## Technologies
58
139
 
59
- - **React 18**: UI framework
140
+ - **React 18/19**: UI framework
60
141
  - **Vite**: Build tool and dev server
61
142
  - **TypeScript**: Type safety
62
143
  - **Three.js**: 3D graphics library
@@ -64,17 +145,16 @@ The `LedMarqueeOrb` component accepts the following props:
64
145
  - **@react-three/drei**: Useful helpers and abstractions
65
146
  - **@react-three/postprocessing**: Post-processing effects (bloom)
66
147
 
67
- ## Controls
68
-
69
- - **Mouse Drag**: Rotate the camera around the orb
70
- - **Scroll**: Zoom in/out (if enabled)
71
-
72
148
  ## Implementation Details
73
149
 
74
150
  The LED marquee effect is implemented using a custom shader material that:
151
+
75
152
  1. Samples a canvas texture containing the repeated word
76
153
  2. Constrains rendering to a horizontal band around the sphere's equator
77
154
  3. Quantizes UV coordinates into a grid for the LED dot matrix effect
78
155
  4. Applies scrolling offset for the marquee animation
79
156
  5. Uses emissive colors and bloom post-processing for the glow effect
80
157
 
158
+ ## License
159
+
160
+ MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "3d-marquee",
3
- "version": "0.1.7",
3
+ "version": "0.1.9",
4
4
  "type": "module",
5
5
  "main": "./dist/3d-marquee.umd.js",
6
6
  "module": "./dist/3d-marquee.es.js",