Sound starts when you press Sound, Bowl or Gong.
Put it on your page
Two lines. The first loads the element, the second puts the fire where it sits.
<script type="module" src="https://pointcast.xyz/baby-bonfire/hearth-kit/hearth-fire.js"></script>
<hearth-fire></hearth-fire>
On pages at pointcast.xyz the two lines work as they are. A browser runs a module script from another site only when that site says it may, and pointcast.xyz does not say so for this file yet. Until it does, copy hearth-fire.js and the five media files below to your own site, change the src to your copy, and set media to the folder that holds the files.
The box keeps the film’s shape, 720 by 950, before anything loads, so the page does not jump. Give it a width; set a height too if you want another shape, and fit decides how the film fills it.
<hearth-fire media="/my/media/" fit="contain" volume="0.6"
style="width:320px;--hearth-radius:12px"></hearth-fire>
Attributes, methods and events
| Name | What it does |
|---|---|
media | The folder with the media files. Default /baby-bonfire/prayer/media/ on the site the script came from. |
sound | off hides the built-in Sound button. The methods still work. |
fit | cover (default) or contain. |
volume | 0 to 1. Default 0.8. |
light() | Starts the fire bed with a soft fade in. Call it from a tap or click. Resolves true when sound is playing, false when the browser kept it quiet. |
quiet() | Fades the sound out and stops it. |
ring(name) | Strikes 'bowl' or 'gong'. Call it from a tap. Resolves true when it sounded. |
lit | True while the fire bed is on. |
hearth-lit | Event: the fire bed was started. |
hearth-quiet | Event: the fire bed was stopped. |
--hearth-radius | CSS: corner radius. Default 0. |
--hearth-glow | CSS: a box-shadow around the box. |
::part(film), ::part(sound) | CSS: style the film and the Sound button from outside. |
Every <hearth-fire> on a page shares one audio context. The same list, for machines: kit.json.
When sound or motion is held back
- Sound never starts by itself. Browsers only let a page make sound after a tap, a click or a key. Before that, the fire is silent. Call
light()andring()from your own click or tap handler; called at any other time, most browsers keep the sound off and the promise resolvesfalse. - If a sound file cannot load, the element makes the sound in the browser instead: filtered noise and crackle for the fire, a few tones for the bowl and the gong.
- With no Web Audio at all, the film still plays and the methods resolve
false. - On an iPhone, the sound is started inside the tap, with a silent loop that lets it play when the ring switch is off.
- With reduced motion turned on in the system settings, the film is never loaded; the still picture shows. Sound still works on a tap.
- Off screen or in a hidden tab, the film pauses. It loads only when it comes near the screen. If the film cannot load, the still picture stays.
The files
| File | What it is | Size |
|---|---|---|
| hearth-fire.js | The element. No dependencies. | 15.3 KB |
| hearth-loop.mp4 | The film, 12 seconds, looped, no sound track. Loaded only when the fire is near the screen. | 533 KB |
| hearth-poster.jpg | The still picture, the film’s first frame. | 42 KB |
| fire.mp3 | The fire bed, 25 seconds, looped. Loaded on the first tap. | 351 KB |
| bowl.mp3 | One struck bowl. Loaded on the first tap. | 199 KB |
| gong.mp3 | One gong. Loaded on the first tap. | 240 KB |
Before a tap, a page with the fire on it loads the element, the still picture and the film: about 590 KB. The three sounds add about 790 KB after the first tap. The kit uses the same files as Prayer Fire, from the same folder.
Licence
Everything under /baby-bonfire/ that is not a file to print is under CC BY 4.0, under the Baby Bonfire licence's line for everything else there, and this kit is offered on those terms: the element, this page, the film and the sounds. A separate code licence for the element may come later. Credit it as: Hearth Kit, Baby Bonfire, PointCast (https://pointcast.xyz/baby-bonfire/hearth-kit/), CC BY 4.0, with a link back and a note of what you changed.
The film was made from a generated picture with a Seedance video model through Krea; the fire, bowl and gong sounds were generated through Krea. The PointCast and Baby Bonfire names are not licensed as marks. No warranty.