Skip to content

Commit fadb1dc

Browse files
committed
v1.1.0 – Rebrand GlyphFX.js to AnimText with letter/word/line animations, fixed random delay bug, added base duration & full docs
1 parent f8ef0a7 commit fadb1dc

File tree

11 files changed

+604
-488
lines changed

11 files changed

+604
-488
lines changed

CONTRIBUTING.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Changelog
2+
3+
## [1.1.0] - 2025-07-18
4+
5+
### Initial Public Release – Rebranded from GlyphFX.js → AnimText
6+
7+
#### Features
8+
9+
- New name: **AnimText** – semantic, memorable, and focused on text animations.
10+
- Animate text by:
11+
- **Letter**: `data-at-sequence`, `data-at-random`, `data-at-reverse`
12+
- **Word**: `data-at-word`
13+
- **Line**: `data-at-line` (supports dot or `<br>` separation)
14+
- Attribute-driven animation control (`data-at-*`)
15+
- **Custom class support** for animation effects (`ca__fx-*` from cssanimation.io)
16+
- Supports multiple class names for staggering effects
17+
- Supports **multiple delay values** via `data-at-delay`
18+
- Supports global override via `data-at-base-duration`
19+
- Includes `aria-hidden="true"` for accessibility compliance
20+
- Automatically injects default styles based on configured selector
21+
22+
#### Fixes
23+
24+
- Corrected delay logic for `random` letter animations (no duplicate delays)
25+
- Improved DOM clone logic to prevent detached element issues
26+
- Added internal caching for computed animation durations
27+
- Improved robustness for malformed attribute values
28+
29+
#### Debug Mode
30+
31+
- Set `window.__ANIMTEXT_DEBUG = true` to enable detailed logging and safe fallback warnings
32+
33+
#### Docs & Distribution
34+
35+
- Complete README with live examples, install instructions, and feature table
36+
- CDN ready via jsDelivr and unpkg
37+
- NPM published as `animtext`

README.md

Lines changed: 70 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
# 🔡 Amazing Text & Letter Animations
1+
# Amazing Text & Letter Animations
22

33
![Plugin](https://img.shields.io/badge/Type-Text%20Enhancer-4B9CE2?style=for-the-badge)
44
![Vanilla JS](https://img.shields.io/badge/JS-Vanilla%20JS-brightgreen?style=for-the-badge)
55
![No Dependencies](https://img.shields.io/badge/Dependencies-None-lightgrey?style=for-the-badge)
66
[![Built for](https://img.shields.io/badge/Built%20for-cssanimation-blueviolet?style=for-the-badge)](https://github.com/yesiamrocks/cssanimation)
7-
[![npm](https://img.shields.io/npm/v/glyphfx?style=for-the-badge)](https://www.npmjs.com/package/glyphfx)
8-
[![jsDelivr](https://img.shields.io/jsdelivr/npm/hm/glyphfx?style=for-the-badge)](https://cdn.jsdelivr.net/npm/glyphfx@latest/dist/)
9-
[![unpkg](https://img.shields.io/badge/CDN-unpkg-blue?style=for-the-badge)](https://unpkg.com/browse/glyphfx/)
10-
[![View Demo](https://img.shields.io/badge/🎬%20Live-Demo-green?style=for-the-badge)](https://yesiamrocks.github.io/GlyphFX/)
7+
[![npm](https://img.shields.io/npm/v/animtext?style=for-the-badge)](https://www.npmjs.com/package/animtext)
8+
[![jsDelivr](https://img.shields.io/jsdelivr/npm/hm/animtext?style=for-the-badge)](https://cdn.jsdelivr.net/npm/animtext@latest/dist/)
9+
[![unpkg](https://img.shields.io/badge/CDN-unpkg-blue?style=for-the-badge)](https://unpkg.com/browse/animtext/)
10+
[![View Demo](https://img.shields.io/badge/🎬%20Live-Demo-green?style=for-the-badge)](https://yesiamrocks.github.io/animtext/)
1111

12-
`glyphfx.js` plugin is a lightweight, CSS-only enhancement script that brings **letter-by-letter, word-by-word, and line-by-line** animations to your projects. It's designed to work seamlessly with [cssanimation](https://cssanimation.io), for robust and customizable text effects.
12+
**AnimText** is a lightweight JavaScript enhancer for animating text with **letter-by-letter, word-by-word, and line-by-line** animations to your projects. It's designed to work seamlessly with [{css}animation](https://github.com/yesiamrocks/cssanimation), for robust and customizable text effects.
1313

1414
## Key Features
1515

@@ -20,106 +20,118 @@
2020
- Random & Reverse Effects: Get creative with animation order.
2121
- Smart Handling: Safely handles whitespace and provides animation class fallbacks.
2222

23-
## Letter Animation Installation
23+
## Installation
2424

2525
### Via NPM
2626

2727
```bash
28-
npm install glyphfx
28+
npm install animtext
2929
```
3030

31-
For plain HTML, include the `glyphfx.js`, plugin just before your closing `</body>` tag:
31+
For plain HTML, include the `animtext.js`, plugin just before your closing `</body>` tag:
3232

3333
### JS Initialization
3434

3535
```js
36-
import glyphfx from "glyphfx";
36+
import animtext from "animtext";
3737

38-
glyphfx.init();
38+
animtext.init();
3939
// or with debug mode
40-
glyphfx.init({ dev: true });
40+
animtext.init({ dev: true });
4141
```
4242

4343
```html
44-
<script src="https://cdn.jsdelivr.net/npm/glyphfx@latest/dist/glyphfx.min.js"></script>
44+
<script src="https://cdn.jsdelivr.net/npm/animtext@latest/dist/animtext.min.js"></script>
4545
```
4646

47-
GlyphFX requires @hellouxpavel/cssanimation to function. It provides the actual animation classes (like ca\_\_fx-fadeIn) used in the HTML examples.
47+
animtext requires @hellouxpavel/cssanimation to function. It provides the actual animation classes (like ca\_\_fx-fadeIn) used in the HTML examples.
4848

4949
```bash
5050
npm install @hellouxpavel/cssanimation
5151
```
5252

53+
## Getting Started
54+
55+
```html
56+
<h1 class="cssanimation" data-at-sequence="ca__fx-fadeIn">Hello AnimText!</h1>
57+
```
58+
59+
This will animate the letters of the heading using your chosen animation class.
60+
5361
## Letter Animation Usage
5462

55-
Every animated text block needs the `.cssanimation` class along with a `gf__*` attribute to define how it animates.
63+
Every animated text block needs the `.cssanimation` class along with a `data-at-*` attribute to define how it animates.
5664

5765
### 1. Letter-by-Letter Animation
5866

5967
Animate text one letter at a time with different sequencing styles:
6068

61-
**➜ Sequential (in order):** `gf__sequence`
69+
**➜ Sequential (in order):** `data-at-sequence`
6270

6371
```html
64-
<h1 class="cssanimation" gf__sequence="ca__fx-fadeIn">Letters Animate</h1>
72+
<h1 class="cssanimation" data-at-sequence="ca__fx-fadeIn">Letters Animate</h1>
6573
```
6674

67-
**➜ Randomized order** `gf__random`
75+
**➜ Randomized order** `data-at-random`
6876

6977
```html
70-
<p class="cssanimation" gf__random="ca__fx-bounceInTop">Randomized entry!</p>
78+
<p class="cssanimation" data-at-random="ca__fx-bounceInTop">
79+
Randomized entry!
80+
</p>
7181
```
7282

73-
**➜ Reverse (last letter first)** `gf__reverse`
83+
**➜ Reverse (last letter first)** `data-at-reverse`
7484

7585
```html
76-
<h3 class="cssanimation" gf__reverse="ca__fx-moveFromTop">Backwards Flow</h3>
86+
<h3 class="cssanimation" data-at-reverse="ca__fx-moveFromTop">
87+
Backwards Flow
88+
</h3>
7789
```
7890

7991
---
8092

81-
### 2. Word-by-Word Animation `gf__word`
93+
### 2. Word-by-Word Animation `data-at-word`
8294

8395
```html
84-
<h2 class="cssanimation" gf__word="ca__fx-fadeIn">
96+
<h2 class="cssanimation" data-at-word="ca__fx-fadeIn">
8597
Each word animates uniquely
8698
</h2>
8799
```
88100

89-
### 3. Line-by-line Animation `gf__line`
101+
### 3. Line-by-line Animation `data-at-line`
90102

91103
```html
92-
<p class="cssanimation" gf__line="ca__fx-fadeIn">
104+
<p class="cssanimation" data-at-line="ca__fx-fadeIn">
93105
First line<br />
94106
Second line<br />
95107
Third line
96108
</p>
97109
```
98110

99-
Split lines by periods `"."` or by `<br>` / `\n`. Use `gf__separator="dot"` for period separation.
111+
Split lines by periods `"."` or by `<br>` / `\n`. Use `data-at-separator="dot"` for period separation.
100112

101113
```html
102-
<p class="cssanimation" gf__line="ca__fx-fadeIn" gf__separator="dot">
114+
<p class="cssanimation" data-at-line="ca__fx-fadeIn" data-at-separator="dot">
103115
Step 1. Step 2. Step 3.
104116
</p>
105117
```
106118

107-
You don't need to add `gf__separator` for `<br>` or newlines, this is the **default behavior**.
119+
You don't need to add `data-at-separator` for `<br>` or newlines, this is the **default behavior**.
108120

109121
**🔥You can assign different animation classes and delays to each word and line! Space-separate your class names and delay values.**
110122

111123
```html
112124
<h2
113125
class="cssanimation"
114-
gf__word="ca__fx-fadeIn ca__fx-moveFromTop ca__fx-moveFromBottom ca__fx-moveFromRight">
126+
data-at-word="ca__fx-fadeIn ca__fx-moveFromTop ca__fx-moveFromBottom ca__fx-moveFromRight">
115127
Each word animates uniquely
116128
</h2>
117129
```
118130

119131
```html
120132
<p
121133
class="cssanimation"
122-
gf__line="ca__fx-blurIn ca__fx-bounceFromTop ca__fx-bounceX">
134+
data-at-line="ca__fx-blurIn ca__fx-bounceFromTop ca__fx-bounceX">
123135
First line<br />
124136
Second line<br />
125137
Third line
@@ -128,69 +140,72 @@ You don't need to add `gf__separator` for `<br>` or newlines, this is the **defa
128140

129141
[Check out this Text & Letter Animations Preview Tool to easily generate the animation code for your text.](https://yesiamrocks.github.io/cssanimation/text-animation.html)
130142

131-
## `gf__delay` in Detail
143+
## `data-at-delay` in Detail
132144

133-
The `gf__delay` attribute specifies the delay before each animated unit (letter, word, or line) begins its animation. The values are in milliseconds (ms).
145+
The `data-at-delay` attribute specifies the delay before each animated unit (letter, word, or line) begins its animation. The values are in milliseconds (ms).
134146

135147
**Single Value:** If you provide a single value, that delay will be applied to every unit.
136148

137149
```html
138-
<h1 class="cssanimation" gf__sequence="ca__fx-fadeIn" gf__delay="100">
150+
<h1 class="cssanimation" data-at-sequence="ca__fx-fadeIn" data-at-delay="100">
139151
Each letter delays by 100ms
140152
</h1>
141153
```
142154

143155
**Multiple Values:** This is where it gets powerful! You can provide multiple space-separated values. These values will be applied sequentially to each unit. If you provide fewer delay values than there are units, the last delay value will repeat for the remaining units.
144156

145157
```html
146-
<h2 class="cssanimation" gf__word="ca__fx-fadeIn" gf__delay="0 200 400">
158+
<h2 class="cssanimation" data-at-word="ca__fx-fadeIn" data-at-delay="0 200 400">
147159
First word, then 200ms, then 400ms, then 400ms
148160
</h2>
149161
```
150162

151-
This allows you to create rhythmic or staggered entry effects easily, like `gf__delay="50 100 100"` as in your example. The first unit gets 50ms delay, and all subsequent units get 100ms delay.
163+
This allows you to create rhythmic or staggered entry effects easily, like `data-at-delay="50 100 100"` as in your example. The first unit gets 50ms delay, and all subsequent units get 100ms delay.
152164

153-
## `gf__base-duration` in Detail
165+
## `data-at-base-duration` in Detail
154166

155-
The `gf__base-duration` attribute provides a simple way to set a global default animation duration for all units (letters, words, or lines) in milliseconds (ms).
167+
The `data-at-base-duration` attribute provides a simple way to set a global default animation duration for all units (letters, words, or lines) in milliseconds (ms).
156168

157169
This value is used to explicitly set the duration for all units, overriding any `animation-duration` or `transition-duration` that might be detected from the CSS classes applied to the element.
158170

159171
```html
160-
<h3 class="cssanimation" gf__sequence="ca__fx-fadeIn" gf__base-duration="750">
172+
<h3
173+
class="cssanimation"
174+
data-at-sequence="ca__fx-fadeIn"
175+
data-at-base-duration="750">
161176
Global base duration
162177
</h3>
163178
```
164179

165180
**Precedence:**
166181

167-
1. `gf__base-duration` (global override)
168-
2. CSS-defined duration (auto-detected from your animation class if `gf__base-duration` is absent)
182+
1. `data-at-base-duration` (global override)
183+
2. CSS-defined duration (auto-detected from your animation class if `data-at-base-duration` is absent)
169184
3. Internal library default (if no duration is specified anywhere)
170185

171-
This means `gf__base-duration` gives you a convenient way to set a project-wide or component-wide default duration without needing to edit CSS.
186+
This means `data-at-base-duration` gives you a convenient way to set a project-wide or component-wide default duration without needing to edit CSS.
172187

173188
## Supported Attributes for Text Animations Plugin
174189

175-
| Attribute | Description |
176-
| ------------------- | -------------------------------------------------------------------------------- |
177-
| `gf__sequence` | Animates letter-by-letter, in order. |
178-
| `gf__random` | Animates letter-by-letter, in a randomized order. |
179-
| `gf__reverse` | Animates letter-by-letter, in reverse order (last letter first). |
180-
| `gf__word` | Animates word-by-word. |
181-
| `gf__line` | Animates line-by-line. |
182-
| `gf__delay` | Accepts one or more delay values (e.g., `100 300 500`) in milliseconds per unit. |
183-
| `gf__base-duration` | Optional base animation duration per unit (in ms) |
184-
| `gf__separator` | Use `dot` to split on periods `( . )`. Default: line breaks (`<br>` or `\n`) |
190+
| Attribute | Description |
191+
| ----------------------- | -------------------------------------------------------------------------------- |
192+
| `data-at-sequence` | Animates letter-by-letter, in order. |
193+
| `data-at-random` | Animates letter-by-letter, in a randomized order. |
194+
| `data-at-reverse` | Animates letter-by-letter, in reverse order (last letter first). |
195+
| `data-at-word` | Animates word-by-word. |
196+
| `data-at-line` | Animates line-by-line. |
197+
| `data-at-delay` | Accepts one or more delay values (e.g., `100 300 500`) in milliseconds per unit. |
198+
| `data-at-base-duration` | Optional base animation duration per unit (in ms) |
199+
| `data-at-separator` | Use `dot` to split on periods `( . )`. Default: line breaks (`<br>` or `\n`) |
185200

186201
**Example: Full Setup**
187202

188203
```html
189204
<h2
190205
class="cssanimation"
191-
gf__word="ca__fx-fadeIn ca__fx-fadeInLeft ca__fx-slinkyDrop ca__fx-jiggleTransform"
192-
gf__delay="200 300 400"
193-
gf__duration="1000">
206+
data-at-word="ca__fx-fadeIn ca__fx-fadeInLeft ca__fx-slinkyDrop ca__fx-jiggleTransform"
207+
data-at-delay="200 300 400"
208+
data-at-duration="1000">
194209
Animate each word smoothly
195210
</h2>
196211
```
@@ -201,6 +216,6 @@ This means `gf__base-duration` gives you a convenient way to set a project-wide
201216
- You can provide fewer classes or delay values than units; the last value will simply repeat for the remaining units, making it easy to apply a pattern.
202217
- If you pass more classes or values than needed, the extra elements are skipped, and a warning might be logged to your console to help with debugging.
203218
- Delay and duration values are parsed safely; non-numeric strings will fall back to default behaviors to prevent errors.
204-
- Animation duration is determined in this order of precedence: `gf__base-duration` > CSS-detected duration > internal default.
219+
- Animation duration is determined in this order of precedence: `data-at-base-duration` > CSS-detected duration > internal default.
205220

206221
[← Return to the main README](./README.md)

dist/glyphfx.js renamed to dist/animtext.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
/*!
2-
* glyphfx.js
3-
* Title: glyphfx
2+
* animtext.js
3+
* Title: animtext
44
* Description: A lightweight JavaScript utility to split text into letters with animation-ready wrappers. Perfect for GSAP, cssanimation, or any custom animation workflow.
55
*
6-
* Version: 1.0.2
6+
* Version: 1.1.0
77
* Author: Shafayetul Islam Pavel
8-
* Website: https://github.com/yesiamrocks/glyphfx#readme
8+
* Website: https://github.com/yesiamrocks/animtext#readme
99
* LinkedIn: https://www.linkedin.com/in/shafayetul/
1010
* Email: hello@cssanimation.io
1111
* GitHub: https://github.com/yesiamrocks
Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
/*!
2-
* glyphfx.js
3-
* Title: glyphfx
2+
* animtext.js
3+
* Title: animtext
44
* Description: A lightweight JavaScript utility to split text into letters with animation-ready wrappers. Perfect for GSAP, cssanimation, or any custom animation workflow.
55
*
6-
* Version: 1.0.2
6+
* Version: 1.1.0
77
* Author: Shafayetul Islam Pavel
8-
* Website: https://github.com/yesiamrocks/glyphfx#readme
8+
* Website: https://github.com/yesiamrocks/animtext#readme
99
* LinkedIn: https://www.linkedin.com/in/shafayetul/
1010
* Email: hello@cssanimation.io
1111
* GitHub: https://github.com/yesiamrocks

0 commit comments

Comments
 (0)