kiosko-plugin-fractals 0.0.0-stage → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +148 -2
- package/dist/index.js +1884 -0
- package/docs/coral.jpg +0 -0
- package/docs/coral.webm +0 -0
- package/docs/ferns.jpg +0 -0
- package/docs/ferns.webm +0 -0
- package/docs/flame.jpg +0 -0
- package/docs/flame.webm +0 -0
- package/docs/julia.jpg +0 -0
- package/docs/julia.webm +0 -0
- package/docs/mandelbrot.jpg +0 -0
- package/docs/mandelbrot.webm +0 -0
- package/kiosko-manifest.json +170 -0
- package/package.json +73 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Loksly
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,149 @@
|
|
|
1
|
-
#
|
|
1
|
+
# kiosko-plugin-fractals
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Generative fractals as interludes, in your theme's colours: a **fractal
|
|
4
|
+
flame** that develops on the panel like a photo in the developer, from faint
|
|
5
|
+
dust to glowing filaments; a **Julia set** that twists and turns as its
|
|
6
|
+
parameter walks around the Mandelbrot set; a **dive into the Mandelbrot
|
|
7
|
+
set**; a **meadow of Barnsley ferns** growing along the bar; and **coral**
|
|
8
|
+
branching up from the bottom (or frost hanging from the top). Each time slot
|
|
9
|
+
paints a different piece; the same slot always paints the same one.
|
|
10
|
+
|
|
11
|
+
A plugin for [Kiosko](https://github.com/kiosko-lcd/kiosko), the widget mosaic
|
|
12
|
+
for small USB LCD panels. **Optional:** Kiosko doesn't install it.
|
|
13
|
+
|
|
14
|
+

|
|
15
|
+
|
|
16
|
+
The pictures in `docs/` (a still and a few seconds of video of each
|
|
17
|
+
interlude, for the plugin store) were painted by this plugin itself, in the
|
|
18
|
+
default theme.
|
|
19
|
+
|
|
20
|
+
## Install
|
|
21
|
+
|
|
22
|
+
```sh
|
|
23
|
+
npm install --prefix ~/.config/kiosko/plugins kiosko-plugin-fractals
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
(macOS: `~/Library/Application Support/Kiosko/plugins`, Windows: `%APPDATA%\Kiosko\plugins`.)
|
|
27
|
+
|
|
28
|
+
Then add an interlude to a screen: **Screens → Interludes → Fractal flame**
|
|
29
|
+
(or **Morphing Julia**, **Mandelbrot dive**, **Fern meadow**, **Growing
|
|
30
|
+
coral**). Like any interlude it plays at its time slot (every
|
|
31
|
+
15 min = at :00, :15, :30, :45) for up to `maxSeconds`, or right away from the
|
|
32
|
+
editor or Home Assistant. 30 s suits both.
|
|
33
|
+
|
|
34
|
+
## What it does on your machine
|
|
35
|
+
|
|
36
|
+
Nothing beyond computing: no network, no files, no programs. Pure
|
|
37
|
+
TypeScript, drawn on the canvas Kiosko provides.
|
|
38
|
+
|
|
39
|
+
It takes a share of the processor while it plays (`cpu`, 40 % of each frame
|
|
40
|
+
by default), and less by itself when frames come late. Getting ready takes
|
|
41
|
+
about a third of a second for the flame (choosing a composition that fills
|
|
42
|
+
the bar), a few milliseconds for the others. Memory: two histograms of the
|
|
43
|
+
panel's size for the flame and the ferns (about 7 MB at 1920×462), a canvas
|
|
44
|
+
of the panel's size for the coral, a few smaller buffers for the rest.
|
|
45
|
+
|
|
46
|
+
Times (`revealMs`, `growMs`, `zoomMs`, `loopMs`) are by the clock: a screen
|
|
47
|
+
that plays slower than 15 frames a second still takes the time asked.
|
|
48
|
+
|
|
49
|
+
## What it does
|
|
50
|
+
|
|
51
|
+
**The flame** is Scott Draves' algorithm, the one behind Apophysis and
|
|
52
|
+
Electric Sheep: the chaos game over two to four random affine maps, each bent
|
|
53
|
+
by a blend of nonlinear variations (sinusoidal, spherical, swirl, horseshoe,
|
|
54
|
+
polar, julia, spiral, disc…), sometimes with a mirror or a rotation for
|
|
55
|
+
symmetry. Of a couple of dozen candidates it keeps the one that best fills a
|
|
56
|
+
wide bar, and turns it so its long axis lies along the panel. The points are
|
|
57
|
+
gathered in a density histogram and shown with log-density and gamma, so
|
|
58
|
+
they come up like a print in the tray; the densest cores burn towards the
|
|
59
|
+
theme's ink (light on dark themes, dark on `paper`). The points are computed
|
|
60
|
+
while it plays, as many as fit in each frame's share, so the picture keeps
|
|
61
|
+
sharpening; once developed, its colours drift slowly.
|
|
62
|
+
|
|
63
|
+
**The Julia set** follows c just outside the main cardioid of the Mandelbrot
|
|
64
|
+
set, so it goes from sea horses to spirals to dust and back, and comes back
|
|
65
|
+
exactly where it started (a perfect loop). The view turns with the set so it
|
|
66
|
+
lies along the bar. Colour by continuous (smooth) iteration count; inside the
|
|
67
|
+
set, quiet ripples by an orbit trap. It is computed at the fraction of the
|
|
68
|
+
panel's resolution that fits the frame's time, then scaled up.
|
|
69
|
+
|
|
70
|
+
**The Mandelbrot dive** zooms, about a million times over the option's
|
|
71
|
+
time, towards one of a few famous spots on the set's edge (seahorse valley,
|
|
72
|
+
a seahorse's spiral, a double spiral, a dendrite's arm), turning slowly. It
|
|
73
|
+
stops well before double precision gives out. Deep down each pixel costs
|
|
74
|
+
hundreds of iterations, so the picture is carried from frame to frame along
|
|
75
|
+
the zoom and each frame recomputes as many pixels as fit in its time, in a
|
|
76
|
+
shuffled order; on a slow machine a share of them is a little stale (a fine
|
|
77
|
+
grain), on a fast one none.
|
|
78
|
+
|
|
79
|
+
**The fern meadow** is a row of Barnsley ferns (the classic four-map IFS,
|
|
80
|
+
drawn by the chaos game), each with its own height, lean, curl and colour.
|
|
81
|
+
They grow from the stem up and fill in with density, like the flame.
|
|
82
|
+
|
|
83
|
+
**The coral** is diffusion-limited aggregation: particles wander at random
|
|
84
|
+
until they touch the growth and stick, so it branches into fine fingers, as
|
|
85
|
+
corals, frost and Lichtenberg figures do. It rises from a few roots along
|
|
86
|
+
the bottom of the bar (sometimes it hangs from the top), coloured by when
|
|
87
|
+
each part arrived, until a branch reaches the far side.
|
|
88
|
+
|
|
89
|
+
Colours come from the theme: its accent and a few of its other colours, in a
|
|
90
|
+
different selection and order for each slot.
|
|
91
|
+
|
|
92
|
+
## Interludes
|
|
93
|
+
|
|
94
|
+
### Fractal flame — `fractals/flame`
|
|
95
|
+
|
|
96
|
+

|
|
97
|
+
|
|
98
|
+
| Option | Type | Default | |
|
|
99
|
+
|---|---|---|---|
|
|
100
|
+
| `revealMs` | duration | `20000` | How long it takes to come up fully. Then it keeps sharpening and its colours drift slowly until the interlude ends. |
|
|
101
|
+
| `cpu` | integer, % (advanced) | `40` | How much of each frame's time goes to computing it. Lowers by itself when frames come late. |
|
|
102
|
+
|
|
103
|
+
### Morphing Julia — `fractals/julia`
|
|
104
|
+
|
|
105
|
+

|
|
106
|
+
|
|
107
|
+
| Option | Type | Default | |
|
|
108
|
+
|---|---|---|---|
|
|
109
|
+
| `loopMs` | duration | `30000` | How long one trip around the Mandelbrot set takes; then it starts again exactly where it began. |
|
|
110
|
+
| `cpu` | integer, % (advanced) | `40` | How much of each frame's time goes to computing it (and so the resolution). |
|
|
111
|
+
|
|
112
|
+
### Mandelbrot dive — `fractals/mandelbrot`
|
|
113
|
+
|
|
114
|
+

|
|
115
|
+
|
|
116
|
+
| Option | Type | Default | |
|
|
117
|
+
|---|---|---|---|
|
|
118
|
+
| `zoomMs` | duration | `40000` | How long it takes to go from the whole set to the deepest point (about a million times closer). Then it stays there, its colours drifting. |
|
|
119
|
+
| `cpu` | integer, % (advanced) | `40` | How much of each frame's time goes to computing it (and so how many pixels are fresh each frame). |
|
|
120
|
+
|
|
121
|
+
### Fern meadow — `fractals/ferns`
|
|
122
|
+
|
|
123
|
+

|
|
124
|
+
|
|
125
|
+
| Option | Type | Default | |
|
|
126
|
+
|---|---|---|---|
|
|
127
|
+
| `growMs` | duration | `20000` | How long the ferns take to grow to their full height. Then they keep filling in until the interlude ends. |
|
|
128
|
+
| `cpu` | integer, % (advanced) | `40` | How much of each frame's time goes to computing it. |
|
|
129
|
+
|
|
130
|
+
### Growing coral — `fractals/coral`
|
|
131
|
+
|
|
132
|
+

|
|
133
|
+
|
|
134
|
+
| Option | Type | Default | |
|
|
135
|
+
|---|---|---|---|
|
|
136
|
+
| `growMs` | duration | `25000` | How long it takes to grow to its full size. On a slow machine it may grow slower than that. |
|
|
137
|
+
| `cpu` | integer, % (advanced) | `40` | How much of each frame's time goes to growing it. |
|
|
138
|
+
|
|
139
|
+
## Testing
|
|
140
|
+
|
|
141
|
+
`npm test`: the same slot gives the same piece, every interlude paints in
|
|
142
|
+
every theme without burning out, the flame comes up, the Julia set loops
|
|
143
|
+
exactly, the Mandelbrot dive carries over exactly what it would compute and
|
|
144
|
+
ends at its target, the coral's particles touch the ones they stuck to,
|
|
145
|
+
frames stay within their time budget.
|
|
146
|
+
|
|
147
|
+
## Licence
|
|
148
|
+
|
|
149
|
+
MIT.
|