Skip to content

Commit 6f5ef64

Browse files
author
Developer
committed
1.2.3 feat: add slide animation and fix critical bugs
- Add new slide animation type (movement without opacity) - Fix HTML preservation in split/count animations - Fix animation parser resetting to fade - Fix split animation losing tuning values - Fix inline-block handling for letter animations - Improve animation cleanup and memory management
1 parent a5b2f28 commit 6f5ef64

File tree

12 files changed

+479
-187
lines changed

12 files changed

+479
-187
lines changed

CHANGELOG.md

Lines changed: 50 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,54 @@ All notable changes to USAL.js will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8-
Analisando a diff da versão 1.2.2, aqui está o changelog:
8+
## [1.2.3] - 2025-09-16
9+
10+
### Added
11+
12+
- **Slide animation**: New `slide` animation type for pure movement without opacity changes
13+
- Supports all directional variants (slide-u, slide-d, slide-l, slide-r, etc.)
14+
- Maintains original element opacity throughout animation
15+
- Useful for elements that need to stay fully visible during entrance
16+
17+
### Fixed
18+
19+
- **Split text HTML preservation**: Split animations now correctly preserve HTML structure
20+
- Bold, italic, and other inline elements are maintained during split
21+
- Nested HTML elements remain properly formatted
22+
- Fixed issue where `textContent` was destroying HTML tags
23+
- **Count animation HTML preservation**: Count animations now work with formatted text
24+
- Preserves surrounding HTML elements when replacing numbers
25+
- Works correctly with nested HTML structures
26+
27+
- **Animation type persistence**: Fixed parser bug that reset animation types
28+
- Animation configuration no longer lost when processing subsequent tokens
29+
- Fixed issue where all animations were defaulting to fade
30+
31+
- **Split animation tuning**: Fixed issue where split animations lost tuning values
32+
- Tuning parameters (e.g., fade-u-200) now correctly preserved with split text
33+
- Empty configuration arrays no longer override valid tuning values
34+
35+
- **Letter animation display**: Fixed inline-block application for split letter animations
36+
- Letters now animate correctly with proper display properties
37+
- Fixed "snap" effect when animations complete
38+
- Proper cleanup maintains inline-block for split elements
39+
40+
- **Build script compatibility**: Fixed Node.js version compatibility in build script
41+
- Added fallback for `file.path` in recursive directory reading
42+
- Works across Node.js versions 18-24
43+
44+
### Changed
45+
46+
- **Internal refactoring**: Improved code organization
47+
- Extracted `genEmptyConfig()` function for configuration generation
48+
- Renamed `splitByNotItem` to `isSplitText` for clarity
49+
- Better separation of concerns in split and count setup functions
50+
51+
### Performance
52+
53+
- **Animation cleanup**: Improved cleanup of cancelled animations
54+
- Better garbage collection hints with effect/timeline nullification
55+
- More efficient memory management for long-running applications
956

1057
## [1.2.2] - 2025-09-10
1158

@@ -129,6 +176,8 @@ Analisando a diff da versão 1.2.2, aqui está o changelog:
129176
- Threshold controls
130177
- Duration and delay modifiers
131178

179+
[1.2.3]: https://github.com/italoalmeida0/usal/compare/v1.2.2...v1.2.3
180+
[1.2.2]: https://github.com/italoalmeida0/usal/compare/v1.2.1...v1.2.2
132181
[1.2.1]: https://github.com/italoalmeida0/usal/compare/v1.2.0...v1.2.1
133182
[1.2.0]: https://github.com/italoalmeida0/usal/compare/v1.1.1...v1.2.0
134183
[1.1.1]: https://github.com/italoalmeida0/usal/compare/v1.1.0...v1.1.1

docs/API.md

Lines changed: 53 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,13 @@ fade fade-u fade-d fade-l fade-r
3434
fade-ul fade-ur fade-dl fade-dr
3535
```
3636

37+
#### Slide Animations
38+
39+
```
40+
slide slide-u slide-d slide-l slide-r
41+
slide-ul slide-ur slide-dl slide-dr
42+
```
43+
3744
#### Zoom In Animations
3845

3946
```
@@ -76,6 +83,7 @@ split-flip-{direction} // split-flip-d, split-flip-r
7683
```
7784

7885
#### Split Delay
86+
7987
Control delay between split parts (milliseconds)
8088

8189
```
@@ -84,13 +92,15 @@ split-delay-{value}-{stagger}
8492
```
8593

8694
**Stagger types:**
95+
8796
- Default (by index): `split-delay-50`
8897
- Linear: `split-delay-50-linear`
8998
- Center (X/Y axes): `split-delay-50-center`
9099
- Edges (X/Y axes): `split-delay-50-edges`
91100
- Random: `split-delay-50-random`
92101

93102
**Examples:**
103+
94104
```
95105
split-delay-30
96106
split-delay-100-center
@@ -223,13 +233,12 @@ window.USAL.config({
223233
splitDelay: 30, // Delay between split items (ms)
224234
easing: 'ease-out', // CSS easing function
225235
blur: false, // Enable/disable blur effect (false, true, or numeric value in rem - default: 0.625rem when true)
226-
loop: 'mirror', // Default loop type (mirror, jump)
236+
loop: 'mirror', // Default loop type (mirror, jump)
227237
},
228238
observersDelay: 50, // Delay for observers (ms)
229239
once: false, // Run animation only once
230240
});
231241

232-
233242
// Get current configuration
234243
const currentConfig = window.USAL.config();
235244

@@ -250,7 +259,6 @@ window.USAL.config({
250259
direction: 'l',
251260
},
252261
});
253-
254262
```
255263

256264
#### Control Methods
@@ -270,19 +278,20 @@ window.USAL.destroy();
270278
// Get version
271279
console.log(window.USAL.version);
272280
```
281+
273282
#### Blur Effect
274283

275284
```javascript
276285
// Blur can be boolean or numeric value in rem
277286
window.USAL.config({
278287
defaults: {
279-
blur: false, // No blur effect
288+
blur: false, // No blur effect
280289
// or
281-
blur: true, // Default blur (0.625rem)
290+
blur: true, // Default blur (0.625rem)
282291
// or
283-
blur: 2, // Custom blur (2rem)
292+
blur: 2, // Custom blur (2rem)
284293
// or
285-
blur: 0.5, // Custom blur (0.5rem)
294+
blur: 0.5, // Custom blur (0.5rem)
286295
},
287296
});
288297
```
@@ -320,6 +329,7 @@ window.USAL.config({ defaults: { duration: 500 } })
320329
<!-- Fixed ID (prevents re-animation) -->
321330
<div data-usal="fade-u" data-usal-id="hero-section">Fixed ID</div>
322331
```
332+
323333
# 🚀 Advanced Options
324334

325335
#### Custom Timeline Animation
@@ -331,12 +341,14 @@ line-[{timeline}]
331341
```
332342

333343
**Timeline Syntax:**
344+
334345
- Properties (case-insensitive): `o` (opacity), `s/sx/sy/sz` (scale), `t/tx/ty/tz` (translate), `r/rx/ry/rz` (rotate), `b` (blur), `p` (perspective)
335346
- Values: `+` or `-` followed by number
336347
- Keyframes: Use `|` to separate, with optional percentage prefix
337348
- Formatting: Spaces and line breaks are allowed for better organization
338349

339350
**Property Reference:**
351+
340352
- `o±value`: Opacity (0-100, auto-clamped, divided by 100)
341353
- `s±value`: Scale (X and Y axes)
342354
- `sx±value`: ScaleX only
@@ -356,13 +368,15 @@ line-[{timeline}]
356368
**⚠️ Important Notes:**
357369

358370
**Order Matters:** Transforms are applied in the order they appear
371+
359372
```html
360373
<!-- Different results! -->
361374
<div data-usal="line-[r+45tx+50]">Rotate then translate</div>
362375
<div data-usal="line-[tx+50r+45]">Translate then rotate</div>
363376
```
364377

365378
**Avoid Conflicts:** Don't mix general and axis-specific properties
379+
366380
```html
367381
<!-- ❌ Conflict: s and sx both affect X scale -->
368382
<div data-usal="line-[s+0.5sx+0.8]">Conflicting scales</div>
@@ -372,6 +386,7 @@ line-[{timeline}]
372386
```
373387

374388
**Duplicate Properties:** Last value wins
389+
375390
```html
376391
<!-- Final opacity will be 0.8 -->
377392
<div data-usal="line-[o+50o+80]">Duplicate opacity</div>
@@ -383,28 +398,31 @@ line-[{timeline}]
383398
**Keyframe Rules:**
384399

385400
1. **No pipes:** Animates FROM specified value TO original state
401+
386402
```html
387403
<!-- 0%: opacity 0, 100%: original -->
388404
<div data-usal="line-[o+0]">Fade in</div>
389-
405+
390406
<!-- 0%: scale 0.3 (X and Y), 100%: original -->
391407
<div data-usal="line-[s+0.3]">Scale up</div>
392408
```
393409

394410
2. **One pipe:** Animates FROM original state TO specified value
411+
395412
```html
396413
<!-- 0%: original, 100%: opacity 0.2 -->
397414
<div data-usal="line-[|o+20]">Fade to 20%</div>
398-
415+
399416
<!-- With percentage: 0%: original, 60%: opacity 0.4, 100%: opacity 0.4 -->
400417
<div data-usal="line-[|60o+40]">Fade at 60%</div>
401418
```
402419

403420
3. **Multiple pipes (2+):** Multi-step animation with auto-copy behavior
421+
404422
```html
405-
<!-- 0%: opacity 0.3 (copy of 40%), 40%: opacity 0.3, 100%: opacity 0.7 -->
406-
<div data-usal="line-[|40o+30|o+70]">Two pipes</div>
407-
423+
<!-- 0%: opacity 0.3 (copy of 40%), 40%: opacity 0.3, 100%: opacity 0.7 -->
424+
<div data-usal="line-[|40o+30|o+70]">Two pipes</div>
425+
408426
<!-- 0%: opacity 0.1 (copy of 20%), 20%: opacity 0.1, 50%: opacity 0.6, 70%: opacity 0.8, 100%: opacity 0.8 (copy of 70%) -->
409427
<div data-usal="line-[|20o+10|50o+60|70o+80]">Multi-step fade</div>
410428
```
@@ -413,21 +431,29 @@ line-[{timeline}]
413431

414432
```html
415433
<!-- Multi-line formatting for readability -->
416-
<div data-usal="line-[
434+
<div
435+
data-usal="line-[
417436
O+0 SX+0.2 SY+0.2 TX+70 |
418437
40 O+50 SX+0.8 SY+0.8 TX+35 |
419438
70 O+90 SX+0.95 SY+0.95 TX+5 |
420439
O+100 SX+1 SY+1 TX+0
421-
]">Complex entrance (case-insensitive)</div>
440+
]"
441+
>
442+
Complex entrance (case-insensitive)
443+
</div>
422444

423445
<!-- 3D transformation with order consideration -->
424-
<div data-usal="line-[
446+
<div
447+
data-usal="line-[
425448
p+100 rx+0 ry+0 sx+0.3 sy+0.3 |
426449
25 rx+90 sx+0.6 sy+0.6 |
427450
50 rx+180 ry+90 sx+1 sy+1 |
428451
75 rx+270 ry+180 |
429452
rx+360 ry+360
430-
]">3D flip sequence</div>
453+
]"
454+
>
455+
3D flip sequence
456+
</div>
431457

432458
<!-- Combine with other modifiers -->
433459
<div data-usal="line-[o+0s+0.5|50s+1.2|o+100s+1] duration-2000 easing-[cubic-bezier(0.4,0,0.2,1)]">
@@ -450,28 +476,32 @@ Fine-tune standard animations with numeric parameters.
450476
```
451477

452478
**Default Values:**
479+
453480
- **Normal animations:**
454-
- Fade/Zoom movement: 15%
455-
- Zoom intensity: 15%
481+
- Fade/Zoom movement: 15%
482+
- Zoom intensity: 15%
456483
- **Split animations (word/letter):**
457-
- Fade/Zoom movement: 50%
458-
- Zoom intensity: 50%
484+
- Fade/Zoom movement: 50%
485+
- Zoom intensity: 50%
459486
- **Flip (both):**
460-
- Angle: 90°
461-
- Perspective: 25rem
487+
- Angle: 90°
488+
- Perspective: 25rem
462489

463490
**Parameter Interpretation:**
464491

465492
**Fade:** Controls movement distance
493+
466494
- 1 value: `fade-40` → 40% distance (default: 25%)
467495
- 2 values: `fade-30-60` → X: 30%, Y: 60%
468496

469497
**Zoom:** Controls scale and movement
498+
470499
- 1 value: `zoomin-30` → 30% intensity (default: 25%)
471500
- 2 values: `zoomin-40-60` → movement: 40%, intensity: 60%
472501
- 3 values: `zoomin-30-50-80` → X: 30%, Y: 50%, intensity: 80%
473502

474503
**Flip:** Controls rotation and 3D depth
504+
475505
- 1 value: `flip-120` → 120° angle (default: 90°)
476506
- 2 values: `flip-90-60` → angle: 90°, perspective: 60rem (default: 25rem)
477507

@@ -492,4 +522,4 @@ Fine-tune standard animations with numeric parameters.
492522
<div data-usal="flip">Default 90° angle, 25rem perspective</div>
493523
<div data-usal="flip-180-50">Full flip, deeper perspective</div>
494524
<div data-usal="flip-udlr-120-80">Multi-direction flip, custom angle and perspective</div>
495-
```
525+
```

0 commit comments

Comments
 (0)