To use Ukiyo.js, first mark your target elements in HTML (e.g., using a class like ukiyo). Then, instantiate the Ukiyo class in JavaScript by passing a CSS selector, a NodeList, or an HTMLCollection.
Supported HTML elements
<img><picture> (apply the class to the <img> inside)<video>- Elements with
background-image (apply the class to the <div>)
JavaScript Initialization
You can select elements using standard DOM methods.
import Ukiyo from "ukiyojs";
// Using a CSS selector
new Ukiyo(".ukiyo");
// Using a NodeList
const images = document.querySelectorAll(".ukiyo");
new Ukiyo(images);
// Using an HTMLCollection
const images = document.getElementsByClassName('ukiyo');
new Ukiyo(images);