Skip to content

Commit fb0cccc

Browse files
committed
Update code formatting
1 parent 3a40404 commit fb0cccc

File tree

2 files changed

+7
-18
lines changed

2 files changed

+7
-18
lines changed

src/index.ts

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
/**
22
* Available play modes
3-
*
43
* @remarks
54
* - always: Always glitch (default)
65
* - hover: Glitch on hover
@@ -13,10 +12,8 @@ export type PlayModes = 'always' | 'hover' | 'click' | 'manual';
1312
* Custom options for the glitch animations.
1413
*/
1514
export type PowerGlitchOptions = {
16-
1715
/**
18-
* Html to glitch. If not provided, will use the elements themselves.
19-
* If provided, all elements should have an `innerHTML` property.
16+
* Html to glitch. If not provided, will use the elements themselves. If provided, all elements should have an `innerHTML` property.
2017
*/
2118
html?: string,
2219

@@ -34,7 +31,6 @@ export type PowerGlitchOptions = {
3431
* Timing of the animation.
3532
*/
3633
timing: {
37-
3834
/**
3935
* Duration of the animation loop in milliseconds.
4036
*/
@@ -53,11 +49,11 @@ export type PowerGlitchOptions = {
5349

5450
/**
5551
* Specify if the animation should always glitch uniformly (if false) or if it should glitch at a given time.
52+
* @remarks
5653
* If start and end are set, the animation will glitch between those two times, and the peak glitch will be at the middle.
5754
* glitchTimeSpan.end should be greater than glitchTimeSpan.start. Otherwise, the glitch will not happen.
5855
*/
5956
glitchTimeSpan: false | {
60-
6157
/**
6258
* Start time of the glitch in percent, between 0 and 1.
6359
*/
@@ -71,10 +67,10 @@ export type PowerGlitchOptions = {
7167

7268
/**
7369
* Whether the base layer should shake. If not set to false, the base layer will shake in the given amplitude.
70+
* @remarks
7471
* The shake animation respects the glitch time span constraint, if set.
7572
*/
7673
shake: false | {
77-
7874
/**
7975
* Number of steps to compute for each layer per second of animation.
8076
*/
@@ -93,10 +89,10 @@ export type PowerGlitchOptions = {
9389

9490
/**
9591
* Slice layers are the base animation to give the glitch effect. They clip a part of the element and move it somewhere else.
92+
* @remarks
9693
* The slice animation respects the glitch time span constraint, if set.
9794
*/
9895
slice: {
99-
10096
/**
10197
* Number of layers to generate.
10298
*/
@@ -179,7 +175,6 @@ const getDefaultOptions = (playMode: PlayModes = 'always'): PowerGlitchOptions =
179175
};
180176
};
181177

182-
183178
/**
184179
* Get a random value between -1 and 1, which biases towards the center if the animation should not glitch at the given `stepPct` moment.
185180
*/
@@ -207,7 +202,6 @@ const getGlitchRandom = (options: PowerGlitchOptions, stepPct: number) => {
207202
return rand * glitchFactor;
208203
};
209204

210-
211205
/**
212206
* Get a random rectangle values in % to glitch. Percent values are between 0 and 100.
213207
* @param minHeight Minimum height of the rectangle in percent, between 0 and 1.
@@ -490,7 +484,6 @@ export type GlitchResult = {
490484

491485
/**
492486
* Make a single element glitch.
493-
*
494487
* @param elOrSelector What to glitch. Can be a query selector, a list of HTMLElement, an HTMLElement or a NodeList.
495488
* @param userOptions Optional glitch customization options.
496489
*/

test/powerglitch.test.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,11 @@ const baseOptions = {
2424
};
2525

2626
/**
27-
*
27+
* Duplicate a test for all element types
28+
* @see ELEMENTS
2829
*/
2930
const testAllElementTypes = (name: string, job: (elementType: string) => Promise<void>): void => {
3031
describe(name, function() {
31-
32-
/**
33-
* The given test job is duplicated for each sample element type
34-
* @see ELEMENTS
35-
*/
3632
for (const elementType in ELEMENTS) {
3733
test(elementType, async () => {
3834
await job(elementType);
@@ -76,6 +72,7 @@ describe('Glitching more than one element', () => {
7672
const { containers } = PowerGlitch.glitch(elements, { ...baseOptions });
7773
expect(containers.length).toBe(elements.length);
7874
});
75+
7976
/**
8077
* Glitch an array of HTMLElements
8178
*/
@@ -88,7 +85,6 @@ describe('Glitching more than one element', () => {
8885
});
8986

9087
describe('Finding the element to glitch', () => {
91-
9288
/**
9389
* Glitch from query selector
9490
*/

0 commit comments

Comments
 (0)