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 */
1514export 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 */
0 commit comments