fluxo-animation 1.0.0
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/LICENSE +21 -0
- package/README.md +151 -0
- package/dist/index.cjs +1265 -0
- package/dist/index.d.cts +261 -0
- package/dist/index.d.ts +261 -0
- package/dist/index.global.js +1248 -0
- package/dist/index.js +1223 -0
- package/package.json +39 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Luis
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
# Fluxo Engine
|
|
2
|
+
|
|
3
|
+
A lightweight, high-performance, and buttery-smooth TypeScript animation library. Coordinate tweening, timelines, scroll binds, staggers, and vector drawing with 0% idle CPU and zero scroll lag.
|
|
4
|
+
|
|
5
|
+
Fluxo runs all animations through a centralized frame-rate independent Ticker loop using `requestAnimationFrame`, preventing layout thrashing and minimizing browser paint overhead.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Features
|
|
10
|
+
|
|
11
|
+
- **Centralized Ticker**: Unified animation loop preventing layout thrashing and synchronizing all elements.
|
|
12
|
+
- **Multi-Format Distribution**: Compiles to native ES Modules (ESM), CommonJS (CJS), and IIFE (browser global script).
|
|
13
|
+
- **Core Tweens**: `.to()`, `.from()`, and `.fromTo()` interpolators with support for custom CSS units and optimized 3D transforms.
|
|
14
|
+
- **Timelines**: Complex sequencing with relative position offsets (`+=`, `-=`, `<`) and timeline-wide flow controls.
|
|
15
|
+
- **Scroll Binds**: Sync animations to scroll progress (`scrub: true`) or trigger them when entering customizable viewport thresholds.
|
|
16
|
+
- **Interactive Staggers**: Sequenced animations with stagger delays on element collections.
|
|
17
|
+
- **Text & SVG Helpers**: Out-of-the-box `splitText` (for typography reveals) and `drawSVG` (for outline path tracing).
|
|
18
|
+
- **Looping & Controls**: Flow management via `.play()`, `.pause()`, and `.reverse()`, coupled with `.repeat` and `.alternate` bounce loops.
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## Installation
|
|
23
|
+
|
|
24
|
+
Install the library using your package manager of choice:
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
# npm
|
|
28
|
+
npm install fluxo-animation
|
|
29
|
+
|
|
30
|
+
# pnpm
|
|
31
|
+
pnpm add fluxo-animation
|
|
32
|
+
|
|
33
|
+
# yarn
|
|
34
|
+
yarn add fluxo-animation
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### CDN Global Import
|
|
38
|
+
|
|
39
|
+
For direct HTML usage without a bundler, import Fluxo from jsDelivr or unpkg:
|
|
40
|
+
|
|
41
|
+
```html
|
|
42
|
+
<!-- Via jsDelivr -->
|
|
43
|
+
<script src="https://cdn.jsdelivr.net/npm/fluxo-animation@latest/dist/index.global.js"></script>
|
|
44
|
+
|
|
45
|
+
<!-- Via unpkg -->
|
|
46
|
+
<script src="https://unpkg.com/fluxo-animation@latest/dist/index.global.js"></script>
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## Quick Start
|
|
52
|
+
|
|
53
|
+
### 1. Modern ESM Import (Vite, Next.js, Rollup, webpack)
|
|
54
|
+
|
|
55
|
+
```javascript
|
|
56
|
+
import { fluxo } from "fluxo-animation";
|
|
57
|
+
|
|
58
|
+
// Animate a box element 200px on X and rotate 180 degrees
|
|
59
|
+
fluxo.to(".box", {
|
|
60
|
+
x: 200,
|
|
61
|
+
rotation: 180,
|
|
62
|
+
duration: 1.2,
|
|
63
|
+
ease: "medium.out",
|
|
64
|
+
});
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### 2. Direct Browser HTML Script (CDN)
|
|
68
|
+
|
|
69
|
+
When loaded via a CDN, the library exposes a global `fluxo` object on the `window` scope:
|
|
70
|
+
|
|
71
|
+
```html
|
|
72
|
+
<div class="box" style="width: 80px; height: 80px; background: #8b5cf6;"></div>
|
|
73
|
+
|
|
74
|
+
<script src="https://cdn.jsdelivr.net/npm/fluxo-animation@latest/dist/index.global.js"></script>
|
|
75
|
+
<script>
|
|
76
|
+
fluxo.to(".box", {
|
|
77
|
+
x: 300,
|
|
78
|
+
rotation: 360,
|
|
79
|
+
duration: 1.5,
|
|
80
|
+
repeat: -1,
|
|
81
|
+
alternate: true,
|
|
82
|
+
ease: "slow.inOut",
|
|
83
|
+
});
|
|
84
|
+
</script>
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
---
|
|
88
|
+
|
|
89
|
+
## Advanced Usage
|
|
90
|
+
|
|
91
|
+
### Timelines
|
|
92
|
+
|
|
93
|
+
Easily sequence animations using chronological timelines with overlap controls:
|
|
94
|
+
|
|
95
|
+
```javascript
|
|
96
|
+
import { fluxo } from "fluxo-animation";
|
|
97
|
+
|
|
98
|
+
const tl = fluxo.timeline({ repeat: -1, alternate: true });
|
|
99
|
+
|
|
100
|
+
tl.to(".element-1", { x: 100, duration: 1.0 })
|
|
101
|
+
.to(".element-2", { y: 50, duration: 0.8 }, "-=0.4") // Overlap by 0.4 seconds
|
|
102
|
+
.to(".element-3", { scale: 1.2, duration: 0.6 }, "<"); // Sync start with previous tween
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### Scroll Animations
|
|
106
|
+
|
|
107
|
+
Bind animation progression directly to your scrollbar:
|
|
108
|
+
|
|
109
|
+
```javascript
|
|
110
|
+
import { fluxo } from "fluxo-animation";
|
|
111
|
+
|
|
112
|
+
fluxo.fromTo(
|
|
113
|
+
".scroll-box",
|
|
114
|
+
{ scale: 0.5, opacity: 0.1 },
|
|
115
|
+
{
|
|
116
|
+
scale: 1.3,
|
|
117
|
+
opacity: 1,
|
|
118
|
+
scroll: {
|
|
119
|
+
trigger: ".scroll-box",
|
|
120
|
+
start: "top 85%",
|
|
121
|
+
end: "bottom 20%",
|
|
122
|
+
scrub: true,
|
|
123
|
+
},
|
|
124
|
+
},
|
|
125
|
+
);
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
---
|
|
129
|
+
|
|
130
|
+
## Development
|
|
131
|
+
|
|
132
|
+
If you want to contribute or modify Fluxo:
|
|
133
|
+
|
|
134
|
+
1. Clone the repository and install dev dependencies:
|
|
135
|
+
```bash
|
|
136
|
+
npm install
|
|
137
|
+
```
|
|
138
|
+
2. Build the distribution assets:
|
|
139
|
+
```bash
|
|
140
|
+
npm run build
|
|
141
|
+
```
|
|
142
|
+
3. Run in watch mode during development:
|
|
143
|
+
```bash
|
|
144
|
+
npm run watch
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
---
|
|
148
|
+
|
|
149
|
+
## License
|
|
150
|
+
|
|
151
|
+
MIT License. Free for both personal and commercial use.
|