3d-spinner 0.9.1 → 0.9.2
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 +30 -7
- package/dist/cjs/animations/object-motion.cjs +1368 -0
- package/dist/cjs/animations/spin.cjs +1299 -0
- package/dist/cjs/engines/little-3d-engine/little-3d-engine.cjs +1324 -0
- package/dist/cjs/engines/little-3d-engine/loaders/obj.cjs +58 -0
- package/dist/cjs/engines/little-tween-engine/little-tween-engine.cjs +279 -0
- package/dist/cjs/index.cjs +120 -0
- package/dist/cjs/motion/motion.cjs +140 -0
- package/dist/cjs/motion/transitions.cjs +80 -0
- package/dist/engines/little-3d-engine/loaders/obj.d.ts +2 -2
- package/dist/engines/little-3d-engine/loaders/obj.js +2 -2
- package/dist/umd/spinner.global.js +2408 -0
- package/dist/umd/spinner.global.min.js +58 -0
- package/package.json +26 -11
package/README.md
CHANGED
|
@@ -5,8 +5,9 @@
|
|
|
5
5
|
[](LICENSE)
|
|
6
6
|
|
|
7
7
|
A zero-dependency 3D spinner, loader, and progress indicator for the browser. It renders to a
|
|
8
|
-
canvas and ships as ES modules split across separate import paths, so a consumer loads
|
|
9
|
-
animation, motion path, and rendering backend they actually use - nothing else is pulled
|
|
8
|
+
canvas and ships primarily as ES modules split across separate import paths, so a consumer loads
|
|
9
|
+
only the animation, motion path, and rendering backend they actually use - nothing else is pulled
|
|
10
|
+
in. CommonJS and a browser-global build are also published; see [Module formats](#module-formats).
|
|
10
11
|
|
|
11
12
|
## Install
|
|
12
13
|
|
|
@@ -175,17 +176,39 @@ directly:
|
|
|
175
176
|
|
|
176
177
|
Each has no dependencies of its own.
|
|
177
178
|
|
|
178
|
-
## Module
|
|
179
|
+
## Module formats
|
|
179
180
|
|
|
180
|
-
ES modules
|
|
181
|
-
|
|
182
|
-
|
|
181
|
+
Every example above is **ES modules** - the primary, tree-shakeable format. Use a bundler or native `<script type="module">`; the engine draws to a canvas, so
|
|
182
|
+
there is no server-side rendering. ES modules do not load over `file://`, so serve the page over
|
|
183
|
+
HTTP rather than opening the file directly.
|
|
184
|
+
|
|
185
|
+
Two other formats are published for cases where ESM isn't an option:
|
|
186
|
+
|
|
187
|
+
**CommonJS** (`require`), for older Node tooling:
|
|
188
|
+
|
|
189
|
+
```js
|
|
190
|
+
const { createSpinner } = require("3d-spinner");
|
|
191
|
+
const { SpinAnimation } = require("3d-spinner/animations/spin");
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
**Browser global** (IIFE), for a plain `<script>` tag with no bundler or module loader. This build
|
|
195
|
+
bundles the whole public API onto one `window.Spinner3D` object:
|
|
196
|
+
|
|
197
|
+
```html
|
|
198
|
+
<script src="https://unpkg.com/3d-spinner"></script>
|
|
199
|
+
<script>
|
|
200
|
+
const spinner = Spinner3D.createSpinner(document.getElementById("app"), {
|
|
201
|
+
type: "indeterminate",
|
|
202
|
+
animation: new Spinner3D.SpinAnimation(),
|
|
203
|
+
});
|
|
204
|
+
</script>
|
|
205
|
+
```
|
|
183
206
|
|
|
184
207
|
## Development
|
|
185
208
|
|
|
186
209
|
```sh
|
|
187
210
|
npm install
|
|
188
|
-
npm run build # compile src/ to dist/ (ESM + type declarations)
|
|
211
|
+
npm run build # compile src/ to dist/ (ESM + type declarations, CJS, and a browser-global build)
|
|
189
212
|
npm test # build, then run the unit tests
|
|
190
213
|
npm run dev # serve this folder; open /examples/index.html
|
|
191
214
|
```
|