origami-loaders

Paper loaders that fold themselves.

Step 1 of 14 · Start with a square

Live

Paper

Model

Look

Coral crane #E4685A

The traditional crane, all 14 steps. About 25 seconds a loop.

<origami-loader model="crane" look="paper" style="--ol-front: #E4685A" aria-label="Loading"></origami-loader>

Install

npm i origami-loaders
<script type="module">import 'origami-loaders'</script>
<origami-loader></origami-loader>

Examples

Usage

Attributes

model
crane, plane, pleat, envelope, boat, frog, swan, heart, whale or fox.
look
ink, blueprint, graphite or paper.
progress
A value from 0 to 1. The paper folds to that point and holds, so the finished model means the work is done.
speed
Playback rate. Defaults to 1.
theme
light, dark or auto, which follows the system.
texture
paper, the default; grain, a smaller built-in grain; or none.
paused
Holds the current frame.

CSS variables

--ol-ink
Line colour.
--ol-paper
Sheet colour in the ink and graphite looks.
--ol-bg
The surface behind the loader.
--ol-front
Front of the sheet in the paper look. --ol-back sets the back.
--ol-stroke
Line width, such as 1.5px.

Details

Size it with CSS width and height. It stops drawing while it is off screen, and people who prefer reduced motion see the finished model, still.

It is a role="progressbar", so give it an aria-label that says what is loading.

Each model is real paper geometry: folds cut the sheet, the engine tracks every layer, and the paper grain folds with the paper. About 22 kB gzipped with all ten models, and the texture loads on its own.

More

The source is on GitHub. The paper texture comes from Paper Shaders.