Files
powerglitch/docs/api-docs/index.html
2026-01-20 03:31:14 +01:00

112 lines
15 KiB
HTML

<!DOCTYPE html><html class="default" lang="en"><head><meta charSet="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>PowerGlitch</title><meta name="description" content="Documentation for PowerGlitch"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="assets/style.css"/><link rel="stylesheet" href="assets/highlight.css"/><script async src="assets/search.js" id="search-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os"</script><header class="tsd-page-toolbar">
<div class="tsd-toolbar-contents container">
<div class="table-cell" id="tsd-search" data-base=".">
<div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><path d="M15.7824 13.833L12.6666 10.7177C12.5259 10.5771 12.3353 10.499 12.1353 10.499H11.6259C12.4884 9.39596 13.001 8.00859 13.001 6.49937C13.001 2.90909 10.0914 0 6.50048 0C2.90959 0 0 2.90909 0 6.49937C0 10.0896 2.90959 12.9987 6.50048 12.9987C8.00996 12.9987 9.39756 12.4863 10.5008 11.6239V12.1332C10.5008 12.3332 10.5789 12.5238 10.7195 12.6644L13.8354 15.7797C14.1292 16.0734 14.6042 16.0734 14.8948 15.7797L15.7793 14.8954C16.0731 14.6017 16.0731 14.1267 15.7824 13.833ZM6.50048 10.499C4.29094 10.499 2.50018 8.71165 2.50018 6.49937C2.50018 4.29021 4.28781 2.49976 6.50048 2.49976C8.71001 2.49976 10.5008 4.28708 10.5008 6.49937C10.5008 8.70852 8.71314 10.499 6.50048 10.499Z" fill="var(--color-text)"></path></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div>
<div class="field">
<div id="tsd-toolbar-links"></div></div>
<ul class="results">
<li class="state loading">Preparing search index...</li>
<li class="state failure">The search index is not available</li></ul><a href="index.html" class="title">PowerGlitch</a></div>
<div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><rect x="1" y="3" width="14" height="2" fill="var(--color-text)"></rect><rect x="1" y="7" width="14" height="2" fill="var(--color-text)"></rect><rect x="1" y="11" width="14" height="2" fill="var(--color-text)"></rect></svg></a></div></div></header>
<div class="container container-main">
<div class="col-8 col-content">
<div class="tsd-page-title">
<h2>PowerGlitch</h2></div>
<div class="tsd-panel tsd-typography"><img src="./assets/intro.gif" alt="">
<p>PowerGlitch is a standalone library with no external dependencies. It leverages CSS animations to glitch anything on the web, without using a canvas. It weights less than 2kb minified and gzipped.<br></p>
<p>Want to try it out? Check out the <a href="https://7ph.github.io/powerglitch/#/playground">demo</a> 😊</p>
<p align="right">
Like this project? Give a star 🌟
</p>
<a href="#getting-started" id="getting-started" style="color: inherit; text-decoration: none;">
<h2>Getting started</h2>
</a>
<ol>
<li><p>Install PowerGlitch using a package manager</p>
<pre><code class="language-bash"><span class="hl-0">npm </span><span class="hl-1">i</span><span class="hl-0"> </span><span class="hl-1">--save</span><span class="hl-0"> </span><span class="hl-1">powerglitch</span><br/><span class="hl-2"># or</span><br/><span class="hl-0">yarn </span><span class="hl-1">add</span><span class="hl-0"> </span><span class="hl-1">powerglitch</span>
</code></pre>
<p> or by <a href="https://unpkg.com/powerglitch@latest/dist/powerglitch.min.js">importing the web bundle</a> in a script tag (or save it locally)</p>
<pre><code class="language-html"><span class="hl-3">&lt;</span><span class="hl-4">script</span><span class="hl-5"> </span><span class="hl-6">src</span><span class="hl-5">=</span><span class="hl-7">&quot;https://unpkg.com/powerglitch@latest/dist/powerglitch.min.js&quot;</span><span class="hl-3">&gt;&lt;/</span><span class="hl-4">script</span><span class="hl-3">&gt;</span>
</code></pre>
</li>
<li><p>Find an element to glitch</p>
<pre><code class="language-html"><span class="hl-2">&lt;!-- Image --&gt;</span><br/><span class="hl-3">&lt;</span><span class="hl-4">img</span><span class="hl-0"> </span><span class="hl-6">src</span><span class="hl-0">=</span><span class="hl-7">&#39;https://.../image.png&#39;</span><span class="hl-0"> </span><span class="hl-6">class</span><span class="hl-0">=</span><span class="hl-7">&#39;glitch&#39;</span><span class="hl-0"> </span><span class="hl-3">/&gt;</span><br/><br/><span class="hl-2">&lt;!-- Button --&gt;</span><br/><span class="hl-3">&lt;</span><span class="hl-4">button</span><span class="hl-0"> </span><span class="hl-6">class</span><span class="hl-0">=</span><span class="hl-7">&#39;glitch&#39;</span><span class="hl-3">&gt;</span><br/><span class="hl-0"> click me 🤷‍♂️</span><br/><span class="hl-3">&lt;/</span><span class="hl-4">button</span><span class="hl-3">&gt;</span><br/><br/><span class="hl-2">&lt;!-- Any DOM element --&gt;</span><br/><span class="hl-3">&lt;</span><span class="hl-4">div</span><span class="hl-0"> </span><span class="hl-6">class</span><span class="hl-0">=</span><span class="hl-7">&#39;glitch&#39;</span><span class="hl-3">&gt;</span><br/><span class="hl-0"> </span><span class="hl-3">&lt;</span><span class="hl-4">p</span><span class="hl-3">&gt;</span><span class="hl-0">Hello </span><span class="hl-3">&lt;</span><span class="hl-4">b</span><span class="hl-3">&gt;</span><span class="hl-0">World</span><span class="hl-3">&lt;/</span><span class="hl-4">b</span><span class="hl-3">&gt;&lt;/</span><span class="hl-4">p</span><span class="hl-3">&gt;</span><br/><span class="hl-3">&lt;/</span><span class="hl-4">div</span><span class="hl-3">&gt;</span>
</code></pre>
</li>
<li><p>Import PowerGlitch using ES6 import</p>
<pre><code class="language-javascript"><span class="hl-8">import</span><span class="hl-0"> { </span><span class="hl-9">PowerGlitch</span><span class="hl-0"> } </span><span class="hl-8">from</span><span class="hl-0"> </span><span class="hl-1">&#39;powerglitch&#39;</span>
</code></pre>
<p> or using ES5 require</p>
<pre><code class="language-javascript"><span class="hl-10">const</span><span class="hl-0"> </span><span class="hl-11">PowerGlitch</span><span class="hl-0"> = </span><span class="hl-12">require</span><span class="hl-0">(</span><span class="hl-1">&#39;powerglitch&#39;</span><span class="hl-0">).</span><span class="hl-9">PowerGlitch</span>
</code></pre>
<p> if you are importing PowerGlitch using a <code>script</code> tag, the <code>PowerGlitch</code> global variable is automatically available.</p>
</li>
<li><p>Glitch the element</p>
<pre><code class="language-javascript"><span class="hl-9">PowerGlitch</span><span class="hl-0">.</span><span class="hl-12">glitch</span><span class="hl-0">(</span><span class="hl-1">&#39;.glitch&#39;</span><span class="hl-0">)</span>
</code></pre>
</li>
<li><p>That&#39;s it, your element is glitched!</p>
</li>
<li><p>Check-out the <a href="https://7ph.github.io/powerglitch/#/usage">usage guide</a> for optimization and usage tips.</p>
</li>
</ol>
<a href="#useful-links" id="useful-links" style="color: inherit; text-decoration: none;">
<h2>Useful links</h2>
</a>
<p>Documentation</p>
<ul>
<li>Visually try out effects using the <a href="https://7ph.github.io/powerglitch/#/playground">demo</a>.</li>
<li>Lookup PowerGlitch <a href="https://7ph.github.io/powerglitch/">home page</a>.</li>
<li>For customization and optimization tips, check the <a href="https://7ph.github.io/powerglitch/#/usage">usage guide</a>.</li>
<li>Check out the <a href="https://7ph.github.io/powerglitch/api-docs/variables/PowerGlitch.html">api documentation</a> for reference.</li>
</ul>
<p>Integrations</p>
<ul>
<li>React: <a href="https://github.com/7PH/react-powerglitch">react-powerglitch</a></li>
<li>Vue: <a href="https://github.com/7PH/vue-powerglitch">vue-powerglitch</a></li>
</ul>
<a href="#contributing" id="contributing" style="color: inherit; text-decoration: none;">
<h2>Contributing</h2>
</a>
<p>Having trouble? Found a bug? Want to contribute? Any kind of contribution is welcome. If you have any questions, please open an issue or create a pull request.</p>
</div></div>
<div class="col-4 col-menu menu-sticky-wrap menu-highlight">
<div class="tsd-navigation settings">
<details class="tsd-index-accordion"><summary class="tsd-accordion-summary">
<h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><path d="M4.93896 8.531L12 15.591L19.061 8.531L16.939 6.409L12 11.349L7.06098 6.409L4.93896 8.531Z" fill="var(--color-text)"></path></svg> Settings</h3></summary>
<div class="tsd-accordion-details">
<div class="tsd-filter-visibility">
<h4 class="uppercase">Member Visibility</h4><form>
<ul id="tsd-filter-options">
<li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li>
<li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-private" name="private"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Private</span></label></li>
<li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li>
<li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></form></div>
<div class="tsd-theme-toggle">
<h4 class="uppercase">Theme</h4><select id="theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div>
<nav class="tsd-navigation primary">
<details class="tsd-index-accordion" open><summary class="tsd-accordion-summary">
<h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><path d="M4.93896 8.531L12 15.591L19.061 8.531L16.939 6.409L12 11.349L7.06098 6.409L4.93896 8.531Z" fill="var(--color-text)"></path></svg> Modules</h3></summary>
<div class="tsd-accordion-details">
<ul>
<li class="current selected"><a href="modules.html">Power<wbr/>Glitch</a>
<ul></ul></li></ul></div></details></nav>
<nav class="tsd-navigation secondary menu-sticky">
<ul>
<li class="tsd-kind-type-alias"><a href="types/PlayModes.html" class="tsd-index-link"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><rect fill="var(--color-icon-background)" stroke="var(--color-ts)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6" id="icon-4194304-path"></rect><path d="M11.31 16V8.224H8.91V7.24H14.79V8.224H12.39V16H11.31Z" fill="var(--color-text)" id="icon-4194304-text"></path></svg>Play<wbr/>Modes</a></li>
<li class="tsd-kind-type-alias"><a href="types/PowerGlitchOptions.html" class="tsd-index-link"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-4194304-path"></use><use href="#icon-4194304-text"></use></svg>Power<wbr/>Glitch<wbr/>Options</a></li>
<li class="tsd-kind-type-alias"><a href="types/LayerDefinition.html" class="tsd-index-link"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-4194304-path"></use><use href="#icon-4194304-text"></use></svg>Layer<wbr/>Definition</a></li>
<li class="tsd-kind-function"><a href="functions/mergeOptions.html" class="tsd-index-link"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-function)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6" id="icon-64-path"></rect><path d="M9.39 16V7.24H14.55V8.224H10.446V11.128H14.238V12.112H10.47V16H9.39Z" fill="var(--color-text)" id="icon-64-text"></path></svg>merge<wbr/>Options</a></li>
<li class="tsd-kind-type-alias"><a href="types/RecursivePartial.html" class="tsd-index-link"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-4194304-path"></use><use href="#icon-4194304-text"></use></svg>Recursive<wbr/>Partial</a></li>
<li class="tsd-kind-type-alias"><a href="types/GlitchPartialOptions.html" class="tsd-index-link"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-4194304-path"></use><use href="#icon-4194304-text"></use></svg>Glitch<wbr/>Partial<wbr/>Options</a></li>
<li class="tsd-kind-type-alias"><a href="types/GlitchableElement.html" class="tsd-index-link"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-4194304-path"></use><use href="#icon-4194304-text"></use></svg>Glitchable<wbr/>Element</a></li>
<li class="tsd-kind-type-alias"><a href="types/GlitchResult.html" class="tsd-index-link"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-4194304-path"></use><use href="#icon-4194304-text"></use></svg>Glitch<wbr/>Result</a></li>
<li class="tsd-kind-variable"><a href="variables/PowerGlitch.html" class="tsd-index-link"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-variable)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6" id="icon-32-path"></rect><path d="M11.106 16L8.85 7.24H9.966L11.454 13.192C11.558 13.608 11.646 13.996 11.718 14.356C11.79 14.708 11.842 14.976 11.874 15.16C11.906 14.976 11.954 14.708 12.018 14.356C12.09 13.996 12.178 13.608 12.282 13.192L13.758 7.24H14.85L12.582 16H11.106Z" fill="var(--color-text)" id="icon-32-text"></path></svg>Power<wbr/>Glitch</a></li></ul></nav></div></div>
<div class="container tsd-generator">
<p>Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></div>
<div class="overlay"></div><script src="assets/main.js"></script></body></html>