Skip to content

Commit 756a0d3

Browse files
committed
Fixed pixelate-fade text effect synchronization issues ...
by switching from SMIL and CSS animation to particles.
1 parent d1c4955 commit 756a0d3

File tree

16 files changed

+314
-203
lines changed

16 files changed

+314
-203
lines changed

package-lock.json

Lines changed: 11 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"private": true,
33
"name": "website-frontend",
44
"description": "My website's frontend.",
5-
"version": "3.2.2",
5+
"version": "3.2.3",
66
"license": "UNLICENSED",
77
"author": "Steven Vachon <[email protected]> (https://svachon.com)",
88
"repository": "github:stevenvachon/website-frontend",
@@ -23,6 +23,7 @@
2323
},
2424
"dependencies": {
2525
"splitting": "^1.1.0",
26+
"tween-functions": "^1.2.0",
2627
"typed.js": "^2.1.0",
2728
"ua-parser-js": "^2.0.3",
2829
"website-projectile-pixels": "github:stevenvachon/website-projectile-pixels#v1.0.1"

src/scripts/analytics.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ let sessionTimeout;
1414

1515
const isActiveSession = () => sessionStorage.getItem(SESSION_ID_KEY) !== null;
1616

17+
/**
18+
* @param {string} eventName
19+
* @param {{}} data
20+
*/
1721
const send = (eventName, data) =>
1822
Promise.try(() => {
1923
const type = 'application/json';

src/scripts/effects.js

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
1-
import {
2-
numberError,
3-
stringError,
4-
watchForReadyElements,
5-
} from './util/index.js';
1+
import { numberError, stringError } from './logging/index.js';
2+
import { watchForReadyElements } from './util/index.js';
63

74
export const EFFECT_ATTR = 'data-effect';
85
export const EFFECT_DELAY_ATTR = 'data-effect-delay';
@@ -11,6 +8,12 @@ export const EFFECT_DURATION_ATTR = 'data-effect-duration';
118
export const BLUR_FADE_EFFECT = 'blur-fade';
129
export const FADE_EFFECT = 'fade';
1310

11+
/**
12+
* @param {Object} config
13+
* @param {number} config.delay Seconds before starting
14+
* @param {number} config.duration In seconds (excluding the delay)
15+
* @param {number} config.target
16+
*/
1417
const blurFadeEffect = async ({ delay, duration, target }) => {
1518
target.style.filter = 'blur(10px) saturate(0%)';
1619
target.style.opacity = 0;
@@ -31,6 +34,12 @@ const blurFadeEffect = async ({ delay, duration, target }) => {
3134
target.style.opacity = '';
3235
};
3336

37+
/**
38+
* @param {Object} config
39+
* @param {number} config.delay Seconds before starting
40+
* @param {number} config.duration In seconds (excluding the delay)
41+
* @param {number} config.target
42+
*/
3443
const fadeEffect = async ({ delay, duration, target }) => {
3544
target.style.opacity = 0;
3645

src/scripts/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import analytics from './analytics.js';
22
import effects from './effects.js';
3-
import textEffects from './textEffects.js';
3+
import textEffects from './textEffects/index.js';
44
import 'website-projectile-pixels';
55

66
analytics();

src/scripts/index.test.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { beforeAll, beforeEach, expect, test as it, vi } from 'vitest';
22
import analytics from './analytics.js';
33
import effects from './effects.js';
4-
import textEffects from './textEffects.js';
4+
import textEffects from './textEffects/index.js';
55

66
vi.mock('./analytics.js', async () => ({
77
default: vi
@@ -15,10 +15,12 @@ vi.mock('./effects.js', async () => ({
1515
.mockImplementation((await vi.importActual('./effects.js')).default),
1616
}));
1717

18-
vi.mock('./textEffects.js', async () => ({
18+
vi.mock('./textEffects/index.js', async () => ({
1919
default: vi
2020
.fn()
21-
.mockImplementation((await vi.importActual('./textEffects.js')).default),
21+
.mockImplementation(
22+
(await vi.importActual('./textEffects/index.js')).default
23+
),
2224
}));
2325

2426
beforeAll(() => vi.stubGlobal('fetch', vi.fn()));
File renamed without changes.

src/scripts/logging/index.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export { default as ignoredWarning } from './ignoredWarning.js';
2+
export { default as numberError } from './numberError.js';
3+
export { default as stringError } from './stringError.js';
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)