@arraypress/effects-astro 0.3.0 → 0.5.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/AGENTS.md +6 -2
- package/COMPONENTS.md +80 -1
- package/README.md +9 -4
- package/package.json +5 -2
- package/src/components/BorderSweep.astro +9 -3
- package/src/components/Galaxy.astro +40 -0
- package/src/components/GlitchText.astro +69 -0
- package/src/components/PixelGlitchText.astro +2 -2
- package/src/components/Scene.astro +89 -0
- package/src/index.d.ts +6 -2
- package/src/index.js +4 -2
- package/src/runtime/galaxy.d.ts +37 -0
- package/src/runtime/galaxy.js +311 -0
- package/src/runtime/pixel-glitch.d.ts +8 -1
- package/src/runtime/pixel-glitch.js +71 -12
- package/src/runtime/scene.d.ts +58 -0
- package/src/runtime/scene.js +80 -0
- package/src/styles/border-sweep.css +28 -1
- package/src/styles/glitch-text.css +169 -0
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
/* ─────────────────────────────────────────────────────────────────────
|
|
2
|
+
* @arraypress/effects-astro/glitch-text.css
|
|
3
|
+
*
|
|
4
|
+
* A headline that glitches now and then: two coloured copies of it, laid
|
|
5
|
+
* over the real one, flash on for a few frames near the end of each
|
|
6
|
+
* cycle, each sliced to a different band (clip-path) and shifted
|
|
7
|
+
* sideways, while the real text nudges with them. Mostly it sits still.
|
|
8
|
+
* Livelier under the pointer, on the text or a link or button round it.
|
|
9
|
+
*
|
|
10
|
+
* Markup: the real text first, then the two copies, hidden from assistive
|
|
11
|
+
* technology and from focus:
|
|
12
|
+
*
|
|
13
|
+
* <h2 class="glitch-text" style="--glitch-delay: -1.7s">
|
|
14
|
+
* <span>Make it yours</span>
|
|
15
|
+
* <span class="glitch-text-a" aria-hidden="true" inert>Make it yours</span>
|
|
16
|
+
* <span class="glitch-text-b" aria-hidden="true" inert>Make it yours</span>
|
|
17
|
+
* </h2>
|
|
18
|
+
*
|
|
19
|
+
* Set from custom properties: `--glitch-every` (a cycle, default 5s),
|
|
20
|
+
* `--glitch-hover` (a cycle under the pointer, 1.6s), `--glitch-delay`
|
|
21
|
+
* (where in its cycle this one is, so several glitch on their own beats),
|
|
22
|
+
* `--glitch-a` and `--glitch-b` (the copies' colours, pink and blue) and
|
|
23
|
+
* `--glitch-blend` (how they blend: multiply on a light ground, screen on
|
|
24
|
+
* a dark one). With reduced motion it is the plain text, still.
|
|
25
|
+
*
|
|
26
|
+
* CSS only. From the Logomarks site's Custom card.
|
|
27
|
+
* ───────────────────────────────────────────────────────────────────── */
|
|
28
|
+
|
|
29
|
+
.glitch-text {
|
|
30
|
+
position: relative;
|
|
31
|
+
display: block;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
:is(span, a, em, strong, b, i, small).glitch-text {
|
|
35
|
+
display: inline-block;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.glitch-text > * {
|
|
39
|
+
display: block;
|
|
40
|
+
animation: effect-glitch-text-main var(--glitch-every, 5s) steps(1, end) infinite;
|
|
41
|
+
animation-delay: var(--glitch-delay, 0s);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.glitch-text > .glitch-text-a,
|
|
45
|
+
.glitch-text > .glitch-text-b {
|
|
46
|
+
position: absolute;
|
|
47
|
+
inset: 0;
|
|
48
|
+
pointer-events: none;
|
|
49
|
+
user-select: none;
|
|
50
|
+
opacity: 0;
|
|
51
|
+
mix-blend-mode: var(--glitch-blend, multiply);
|
|
52
|
+
animation-name: effect-glitch-text-a;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.glitch-text > .glitch-text-a,
|
|
56
|
+
.glitch-text > .glitch-text-a * {
|
|
57
|
+
color: var(--glitch-a, #ff3ea5);
|
|
58
|
+
-webkit-text-fill-color: currentColor;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.glitch-text > .glitch-text-b,
|
|
62
|
+
.glitch-text > .glitch-text-b * {
|
|
63
|
+
color: var(--glitch-b, #2e4bff);
|
|
64
|
+
-webkit-text-fill-color: currentColor;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.glitch-text > .glitch-text-b {
|
|
68
|
+
animation-name: effect-glitch-text-b;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.glitch-text:hover > *,
|
|
72
|
+
:is(a, button):is(:hover, :focus-visible) .glitch-text > * {
|
|
73
|
+
animation-duration: var(--glitch-hover, 1.6s);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/* Mostly hidden; a burst near the end of each cycle: a few frames of offset slices. */
|
|
77
|
+
@keyframes effect-glitch-text-a {
|
|
78
|
+
0%,
|
|
79
|
+
88% {
|
|
80
|
+
opacity: 0;
|
|
81
|
+
clip-path: inset(0 0 100% 0);
|
|
82
|
+
transform: none;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
89% {
|
|
86
|
+
opacity: 1;
|
|
87
|
+
clip-path: inset(12% 0 64% 0);
|
|
88
|
+
transform: translateX(-3px);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
91% {
|
|
92
|
+
clip-path: inset(58% 0 22% 0);
|
|
93
|
+
transform: translateX(4px);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
93% {
|
|
97
|
+
clip-path: inset(30% 0 48% 0);
|
|
98
|
+
transform: translateX(-2px);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
95% {
|
|
102
|
+
clip-path: inset(78% 0 6% 0);
|
|
103
|
+
transform: translateX(2px);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
96%,
|
|
107
|
+
100% {
|
|
108
|
+
opacity: 0;
|
|
109
|
+
clip-path: inset(0 0 100% 0);
|
|
110
|
+
transform: none;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/* The second copy a frame behind the first, on other bands. */
|
|
115
|
+
@keyframes effect-glitch-text-b {
|
|
116
|
+
0%,
|
|
117
|
+
89% {
|
|
118
|
+
opacity: 0;
|
|
119
|
+
clip-path: inset(0 0 100% 0);
|
|
120
|
+
transform: none;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
90% {
|
|
124
|
+
opacity: 1;
|
|
125
|
+
clip-path: inset(44% 0 36% 0);
|
|
126
|
+
transform: translateX(3px);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
92% {
|
|
130
|
+
clip-path: inset(6% 0 76% 0);
|
|
131
|
+
transform: translateX(-4px);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
94% {
|
|
135
|
+
clip-path: inset(66% 0 14% 0);
|
|
136
|
+
transform: translateX(2px);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
96%,
|
|
140
|
+
100% {
|
|
141
|
+
opacity: 0;
|
|
142
|
+
clip-path: inset(0 0 100% 0);
|
|
143
|
+
transform: none;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/* The real text nudges with them. */
|
|
148
|
+
@keyframes effect-glitch-text-main {
|
|
149
|
+
0%,
|
|
150
|
+
88.9%,
|
|
151
|
+
96%,
|
|
152
|
+
100% {
|
|
153
|
+
transform: none;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
89% {
|
|
157
|
+
transform: translateX(1px);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
92% {
|
|
161
|
+
transform: translateX(-1px);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
@media (prefers-reduced-motion: reduce) {
|
|
166
|
+
.glitch-text > * {
|
|
167
|
+
animation: none !important;
|
|
168
|
+
}
|
|
169
|
+
}
|