Appeal is charisma, and it isn’t the same as cuteness: a villain can be appealing too. It comes from clear, simple shapes, pleasing proportions and signs of life. A character that breathes, blinks and reacts feels present even when it’s doing nothing. In the demo, Dot does all three.
Move your pointer and Dot watches it. Press Make Dot happy or click the canvas.
Show the demo's source
The complete page: it loads toon.css and toon.js, plus demo-theme.js (theme colors), demo-runtime.js (gives the demo its own clock) and, for the characters, cast.js.
<!doctype html><html lang="en" data-style="saturday"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><title>12 · Appeal — toon</title><link rel="stylesheet" href="../src/toon.css"><link rel="stylesheet" href="demo.css"><style> body { font-size: 15px; line-height: 1.5; max-width: var(--demo-max-width); margin: 2rem auto; padding: 0 1rem; } canvas { display: block; width: 100%; height: 340px; margin-bottom: var(--space-sm); cursor: pointer; } button { font: 600 14px system-ui; padding: .5em 1.2em; border-radius: 999px; border: 1.5px solid var(--demo-faint); background: var(--demo-surface); color: var(--demo-ink); cursor: pointer; }</style></head><body><h1>Appeal</h1><p>Appeal is charisma: simple readable shapes, soft curves, and a sense of life. Dot breathes and blinks on an irregular rhythm.</p><canvas id="c" style="cursor:pointer" role="img" aria-label="Dot breathes, blinks on an irregular rhythm and follows the pointer with its eyes. On request, Dot hops happily."></canvas><p class="demo-try"><button type="button" class="demo-act" id="act">Make Dot happy</button> Move your pointer and Dot watches it. Press <i>Make Dot happy</i> or click the canvas.</p>
<script src="../src/toon.js"></script><script src="demo-theme.js"></script><script src="cast-shapes.js"></script><script src="cast.js"></script><script src="demo-runtime.js"></script><script>ToonDemos.register('12-appeal', (document, Toon, DemoTheme) => { const T = DemoTheme; // design tokens, live (see demo-theme.js) const { createStage, ticker, tween, sequence, ease, breathe, blink, Spring, withSquash, groundShadow, clamp } = Toon; const stage = createStage(document.getElementById('c')); const { ctx } = stage; const dot = { hop: 0, sy: 1 }; let happy = false, busy = false, happyTimer = 0, mouse = { x: stage.width / 2, y: stage.height / 2 }; const look = { x: new Spring(0, { stiffness: 140, damping: 16 }), y: new Spring(0, { stiffness: 140, damping: 16 }) }; const set = v => Object.assign(dot, v); const to = (pose, d, e) => () => tween({ from: { ...dot }, to: pose, duration: d, ease: e, onUpdate: set });
stage.canvas.addEventListener('pointermove', e => { const r = stage.canvas.getBoundingClientRect(); mouse = { x: e.clientX - r.left, y: e.clientY - r.top }; }); const act = async () => { if (busy) return; busy = happy = true; clearTimeout(happyTimer); // an older timer must not end this hop's smile await sequence(to({ sy: 0.8 }, 120, ease.outQuad), to({ hop: 60, sy: 1.12 }, 260, ease.outQuad), to({ hop: 0, sy: 1 }, 240, ease.inQuad), to({ sy: 0.82 }, 70, ease.outQuad), to({ sy: 1 }, 450, ease.outElastic)); busy = false; happyTimer = setTimeout(() => (happy = false), 600); }; stage.canvas.addEventListener('click', act); document.getElementById('act').addEventListener('click', act);
stage.loop((dt, t) => { const H = 140, cx = stage.width / 2, ground = stage.height - 40, cy = ground - H / 2 - dot.hop; const b = breathe(t, { rate: 0.35, amount: 0.025 }); // [APPEAL] alive at rest const shut = happy ? 0 : blink(t, { every: 3 }); look.x.target = clamp((mouse.x - cx) / 120, -1, 1); look.y.target = clamp((mouse.y - cy) / 120, -1, 1); const lx = look.x.step(dt), ly = look.y.step(dt); stage.clear(); groundShadow(ctx, cx, ground, 60, dot.hop, { maxHeight: 200 }); withSquash(ctx, cx, cy, { sx: b.sx / dot.sy, sy: b.sy * dot.sy }, c => Cast.draw(c, 'dot', { x: 0, y: 0, h: H, fill: T.primary, ink: T.ink, mood: happy ? 'happy' : 'neutral', blink: shut, look: { x: lx, y: ly } }), { x: 0, y: H / 2 }); });
});</script></body></html>Appeal in CSS
Section titled “Appeal in CSS”To give a character life at rest, add .toon-pop-in to a wrapper, .toon-breathe to the body and .toon-blink to the eyes. This snippet runs as-is:
<link rel="stylesheet" href="toon.css">
<!-- One preset per element: pop in on the wrapper, breathe on the body, blink on the eyes. On a dark body, set --face to white so the brows and mouth stay readable. --><div class="toon-pop-in" style="width:120px"> <svg class="toon-breathe" viewBox="0 0 120 120" width="120" height="120" aria-hidden="true" style="display:block; overflow:visible"> <circle cx="63" cy="66" r="52" fill="currentColor"/> <circle cx="60" cy="62" r="52" stroke="currentColor" stroke-width="4.5" style="fill:var(--toon-color)"/> <g fill="none" stroke-width="2.6" stroke-linecap="round" style="stroke:var(--face, #1a1a1a)"> <path d="M32 40 Q40 33 50 37 M70 37 Q80 33 88 40"/> <path d="M48 82 Q60 92 72 82"/> </g> <!-- fill-box: the eyes squash about their own center --> <g class="toon-blink" style="transform-box:fill-box; transform-origin:center"> <circle cx="44" cy="56" r="9" fill="#fff" stroke-width="3" style="stroke:var(--face, #1a1a1a)"/> <circle cx="76" cy="56" r="9" fill="#fff" stroke-width="3" style="stroke:var(--face, #1a1a1a)"/> <circle cx="45" cy="57" r="4.5" fill="#1a1a1a"/> <circle cx="77" cy="57" r="4.5" fill="#1a1a1a"/> </g> </svg></div>Below, the snippet’s face is on the right, next to the same face with no presets:
and blink
Press Replay entrance to see the pop-in again.
Each preset sets animation, so nest the elements: one element per preset. .toon-breathe scales from the bottom edge, so the character stays on the ground.
Appeal in Canvas
Section titled “Appeal in Canvas”breathe() returns a small scale for withSquash(), so the body swells and settles. blink() returns how far the lids are closed, from 0 to 1, with uneven gaps between blinks. Two Spring objects move the eyes toward the pointer and let them settle softly.
Move your pointer over the canvas and the eyes follow it.
<script src="toon.js"></script><canvas style="width:100%; height:180px" role="img" aria-label="A round face sits on the floor. It breathes gently, blinks every few seconds and its eyes follow the pointer"></canvas>
<script>const { createStage, breathe, blink, Spring, withSquash, groundShadow, shade, clamp } = Toon;const canvas = document.querySelector('canvas');const stage = createStage(canvas);const R = 50; // body radius, pxconst WHITE = '#fff', PUPIL = '#1a1a1a';// The eyes follow the pointer on springs, so they settle softly.const spring = () => new Spring(0, { stiffness: 140, damping: 16 });const look = { x: spring(), y: spring() };canvas.addEventListener('pointermove', (e) => { const box = canvas.getBoundingClientRect(); const dx = e.clientX - box.left - stage.width / 2; const dy = e.clientY - box.top - (stage.height - 20 - R); look.x.target = clamp(dx / 120, -1, 1); look.y.target = clamp(dy / 120, -1, 1);});canvas.addEventListener('pointerleave', () => { look.x.target = look.y.target = 0;});4 collapsed lines
// Reduced motion: freeze the clock, so the face holds still.if (matchMedia('(prefers-reduced-motion: reduce)').matches) { Toon.ticker.timeScale = 0;}
// Is a color light? (Relative luminance, as WCAG measures it.)function isLight(color) { const [r, g, b] = shade(color, 0).match(/[\d.]+/g) .map((v) => (v / 255) ** 2.2); return 0.2126 * r + 0.7152 * g + 0.0722 * b > 0.18;}
// Flat fills, an ink outline drawn a little off the fill, brows,// eyes and a smile. shut closes the lids; lx, ly move the pupils.function face(c, fill, ink, feat, shut, lx, ly) { const full = Math.PI * 2, ry = 9 * (1 - shut * 0.9); c.lineCap = 'round'; c.beginPath(); c.arc(0, 0, R, 0, full); c.fillStyle = fill; c.fill(); c.beginPath(); c.arc(-3, -3, R, 0, full); c.lineWidth = 2.4; c.strokeStyle = ink; c.stroke(); c.beginPath(); c.moveTo(-26, -20); c.quadraticCurveTo(-18, -28, -8, -24); c.moveTo(8, -24); c.quadraticCurveTo(18, -28, 26, -20); c.moveTo(-11, 18); c.quadraticCurveTo(0, 27, 11, 18); c.lineWidth = 2.6; c.strokeStyle = feat; c.stroke(); for (const ex of [-15, 15]) { c.beginPath(); c.ellipse(ex, -6, 9, ry, 0, 0, full); c.fillStyle = WHITE; c.fill(); c.lineWidth = 1.8; c.strokeStyle = feat; c.stroke(); c.beginPath(); c.ellipse(ex + lx, -6 + ly * ry / 9, 4.5, ry / 2, 0, 0, full); c.fillStyle = PUPIL; c.fill(); }}
stage.loop((dt, t) => { const ctx = stage.ctx, x = stage.width / 2; const floor = stage.height - 20; // Page colors: --toon-color for the body, text for the ink.3 collapsed lines
const fill = getComputedStyle(document.documentElement) .getPropertyValue('--toon-color').trim() || '#ff6b4a'; const ink = getComputedStyle(document.body).color; // Brows and mouth: near-black on a light body, else white. const feat = isLight(fill) ? PUPIL : WHITE; const b = breathe(t, { rate: 0.35, amount: 0.025 }); // sx, sy const shut = blink(t, { every: 3 }); // 0 open to 1 shut const lx = look.x.step(dt) * 4, ly = look.y.step(dt) * 4;
stage.clear(); ctx.fillStyle = ink; ctx.fillRect(0, floor, stage.width, 2); groundShadow(ctx, x, floor, R, 0); // Breathe from the base, so the face stays on the floor. withSquash(ctx, x, floor - R, b, (c) => face(c, fill, ink, feat, shut, lx, ly), { x: 0, y: R });});</script>Appeal: tuning tips
Section titled “Appeal: tuning tips”- Simplify the silhouette. If you can’t recognize the shape filled in black, simplify it.
- Vary proportions. Big and small shapes together are more interesting than all-medium ones: big eyes on a round body read at a glance.
- Keep idle motion subtle. A scale change of 2–4% is enough. More makes the character look anxious.
- Avoid a metronome.
blink()varies the gap between blinks, and a breath of about 3 seconds keeps the two rhythms from lining up.
The Dot demo also shows secondary action (blinking while breathing) and follow-through (the eyes settle on springs).
For every option, see the Canvas appeal functions and the CSS appeal presets.