webamp/packages/ani-cursor
2020-12-09 20:29:56 -08:00
..
__tests__ Pull ani-cursor out into its own package 2020-12-09 20:10:45 -08:00
.gitignore Pull ani-cursor out into its own package 2020-12-09 20:10:45 -08:00
babel.config.js Pull ani-cursor out into its own package 2020-12-09 20:10:45 -08:00
index.ts Pull ani-cursor out into its own package 2020-12-09 20:10:45 -08:00
package.json Ignore compiled tests 2020-12-09 20:29:56 -08:00
parser.ts Pull ani-cursor out into its own package 2020-12-09 20:10:45 -08:00
README.md Pull ani-cursor out into its own package 2020-12-09 20:10:45 -08:00
tsconfig.json Pull ani-cursor out into its own package 2020-12-09 20:10:45 -08:00

Install

yarn add ani-cursor

or

npm install ani-cursor

Usage Example

import {convertAniBinaryToCSS} from 'ani-cursor';

async function applyCursor(selector, aniUrl) {
    const response = await fetch(aniUrl);
    const data = new Uint8Array(await response.arrayBuffer());

    const style = document.createElement('style');
    style.innerText = convertAniBinaryToCSS(selector, data);

    document.head.appendChild(style);
}

const h1 = document.createElement('h1');
h1.id = 'pizza';
h1.innerText = 'Pizza Time!';
document.body.appendChild(h1);

applyCursor("#pizza", "https://archive.org/cors/tucows_169906_Pizza_cursor/pizza.ani");