Custom graphics API
A Custom graphic layer runs your own HTML, CSS and JavaScript inside a Studio overlay. You write it beside a live preview, and it saves, publishes and reaches OBS with the rest of the overlay. Your code talks to Bloopbot through one global object: bloop.
New to custom graphics? Follow Author a custom graphic first. For GSAP, PixiJS, Three.js and Phaser, see Graphics libraries.
How a graphic works
- Your source is the HTML, CSS and TypeScript (or JavaScript) tabs in Studio's code workspace. TypeScript is compiled to JavaScript before anything runs it, and types never block a preview, a save or Publish. It shares the overlay's draft, history, Publish and OBS URL.
- Settings declare what the graphic may use: events, messages, variables, media, fonts, libraries, controls and capabilities. Anything undeclared never reaches it.
- Flows decide when something happens. A flow sends an event or message; the graphic decides how it looks.
- The clock belongs to Studio. Play, pause and seek drive the graphic, so anything that moves should follow it.
A graphic shows channel data; it never changes it. Stream behaviour stays in flows. Records, leaderboard boards, alerts and video players come through declared capabilities; a page of your own outside Studio uses the Overlay SDK.
Your first graphic
Every new graphic starts as this raid card. It lists GSAP in libraries, declares the raid event and has one colour control called accent.
<article id="card">
<span id="caption">READY TO PLAY</span>
<strong id="name">Your next great moment</strong>
</article>html, body { margin: 0; background: transparent; }
body { font-family: system-ui, sans-serif; color: #fff; }
#card {
padding: 32px 40px;
border-radius: 20px;
background: #121419;
border-bottom: 6px solid var(--accent, #467bff);
}
#caption { display: block; font-size: 18px; letter-spacing: .12em; margin-bottom: 12px; }
#name { display: block; font-size: 48px; line-height: 1.1; }document.documentElement.style.setProperty('--accent', bloop.settings.accent);
bloop.onEvent('raid', (event) => {
document.querySelector('#caption').textContent = 'WELCOME, RAIDERS';
document.querySelector('#name').textContent = event.name || 'A new party has arrived';
bloop.timeline()
.fromTo('#card', { y: 40, opacity: 0 }, { y: 0, opacity: 1, duration: 0.6 })
.to('#card', { opacity: 0, y: -20, duration: 0.4 }, 5.6);
});To try it, pick an event in the workspace's Event list, edit the sample JSON if you like, and choose Send event. Each event type has its own sample, and switching type replaces the fields. A message with declared fields gets one input per field, prefilled from its contract.
Get events from flows
A graphic never listens to Twitch directly. A flow's Send to overlay step delivers to it.
- Alerts (
follow,sub,resub,gift,cheer,raid): tick the event under Data & settings → Events. Studio queues a matching flow, or reuses one you have, and publishes it with your draft. The layer's Content tab lists them under Triggered by flows. - Your own messages: declare a name in
messages, such asround-start, and send it from any flow. It arrives as acustomevent.
bloop.onEvent('follow', (event) => console.log(event.name));
bloop.onEvent('custom', (event) => {
if (event.name === 'round-start') console.log(event.data);
});When you write the flow yourself
Set Send to overlay's format (action.widget's format) to the alert type, such as follow, so the graphic receives onEvent('follow', …). Pass the viewer's name and any numbers or text as Values. Choosing a format in the flow editor fills these rows from the matching trigger: gift uses $(gifter) and $(count), cheer $(bits) and raid $(viewers). Changing the type replaces the Values in one undoable edit; saved flows are never rewritten.
The default format, custom, delivers { type: 'custom', name, data } to onEvent('custom', …).
Through MCP, copy the chosen format's optionConfig[format].data from describe_node into the node's config.data yourself. An assistant that adds an event to a graphic also needs the matching flow tool calls.
Messages with fields
A message can declare the values it carries. That gives the flow editor something to check and gives Studio's completions a type for event.data.
{ "name": "beanboozled", "fields": { "result": ["safe", "boozled"], "total": "number" } }- Up to 16 fields. Each name matches a Values row name (1–32 letters, digits or underscores).
- A field is
"text","number", or a list of up to 32 allowed values (1–64 characters each). orderkeeps the fields in the order you wrote them; leave it out and the written order is used.- Checks happen while a flow is edited, never at delivery. The flow editor and MCP
validate_flow,create_flowandupdate_flowwarn about a missing or undeclared value, a value outside the list, or text in a number field (overlay_message_missing,overlay_message_extra,overlay_message_not_allowed,overlay_message_not_number). Values containing$(…)are only checked for presence. - Every value still arrives as text in
event.data.
Animate on the clock
Studio can pause, scrub and replay a graphic, and previews render a chosen moment. That only works when everything that moves follows the graphic's clock (a graphic with No timeline has nothing to seek, so it can relax this):
| You use | Do this |
|---|---|
| GSAP | Build timelines with bloop.timeline(). They start paused and follow the clock. A bare gsap.to() runs on GSAP's own clock. |
| CSS animations | Nothing. Studio pauses and advances them for you, including ones an event starts. |
| Delays | bloop.schedule(ms, fn), never setTimeout. |
| PixiJS, Three.js, Phaser, canvas | Stop the library's loop and render from bloop.onTick. Graphics libraries has an example for each. |
The overlay page shares one animation-frame scheduler across its graphics. Use bloop.onTick instead of starting a loop for every layer. Each graphic keeps its own clock, so pausing or seeking one Studio preview does not move another. A background ticker keeps logical work advancing when browser animation frames stop.
Seeking rebuilds the graphic and replays its events in time order; Studio keeps the latest 256 and a full variable snapshot at the oldest retained moment. Loop replays the selected sample at the start of each cycle; turn it off for one-shot playback. Reset starts a fresh run. An error in one callback shows in Output, marks the preview as needing attention and does not stop the others. A startup exception fails the preview instead of reporting it ready; correct the code and press Run code. A replayed event never sounds twice: bloop.replaying is true while it replays, and sound and playMedia stay silent. An <audio> or <video> that playMedia starts after its event, once its file has loaded, takes the event's moment (see playMedia below); before a late sound, check that moment's replaying yourself. An event that arrives while the graphic is being rebuilt is live: it reaches the graphic once it is ready, and sounds.
Draw only while visible
bloop.visibility describes the document and, in OBS, its Browser Source. visible is true when the document is visible and OBS has not reported the source hidden. sourceVisible and sourceActive are null until OBS reports them; an inactive source can still be shown in OBS's preview, so sourceActive: false alone does not stop drawing. bloop.onVisibility(fn) calls immediately with the current snapshot and again when it changes.
bloop.canvas({ draw }) skips drawing while hidden and draws the current moment once when shown again. Events, schedules, reports and onTick continue; no missed drawing frames are replayed. Guard your own library renderer in the same way:
bloop.onTick(({ timeMs }) => {
updateScene(timeMs);
if (bloop.visibility.visible) renderer.render(scene, camera);
});
bloop.onDispose(() => renderer.dispose());Keep logical state updates outside the visibility check. To keep the page alive while its scene is hidden, untick OBS's Shutdown source when not visible.
Repeatable visual choices
bloop.random(key) returns a repeatable number from 0 inclusive to 1 exclusive. bloop.shuffle(items, key) returns a shuffled shallow copy, leaving the input and its items unchanged. A key is text or a finite number (42 and "42" mean the same key); invalid keys throw. Results depend on the key, not call order, frame count or other layers, so a rebuild makes the same choices.
Give each choice a stable identity, such as an event id plus a particle index and property:
const x = bloop.random(`${event.id}:particle:${index}:x`) * bloop.size.width;
const order = bloop.shuffle(bloop.settings.pictures, `${event.id}:round:${round}`);Avoid Math.random() or frame-count keys for a visual that must survive seek or restart. These helpers choose visual variation; prize winners and other channel outcomes still come from flows and records.
No timeline
Set durationMs: null (in Studio, Data & settings, Preview length, No timeline) for a graphic with no natural end: a clock, a ticker, a looping background. Studio's preview then plays on with no end. It counts elapsed time, and Play carries on from where it paused (from zero it starts over with the selected event); Reset starts it again. Nothing pauses it at a set time, and Loop has no end to repeat at, so there is no loop box. Preview time reaches back to a moment already played, but only within the first ten minutes (a seek replays the graphic from the start, and a graphic with a job every frame has tens of thousands to replay by then), and not before the oldest event Studio still keeps (the latest 256). Sending an event after seeking back drops the history after that moment, and the scrubber stops there too. The Studio canvas and OBS never used durationMs, so they play the same either way. A built-in that has no natural end declares durationMs: null in its manifest, and its code copy opens with No timeline. Switching a running preview between a length and No timeline takes hold at once.
With nothing to seek, the graphic does not need bloop.timeline() or onTick for its animations. Native timers, requestAnimationFrame, plain GSAP tweens and a library's own ticker (PixiJS, Phaser) all work, and the preview never stops or fights a library's ticker. CSS animations and element.animate() (Web Animations) still follow the graphic's clock, with or without a timeline: the frame takes them over, so Studio's pause holds them. Three things belong to the graphic clock either way:
- A rebuild replays on the graphic clock. A code update, a resize or a reconnect rebuilds the graphic; clock-driven work catches up, and native timers restart from zero.
- A hidden OBS source throttles native timers and stops animation frames. After about five minutes hidden, a native timer fires about once a minute, and
requestAnimationFramedoes not run at all until the source shows again. The graphic clock keeps ticking (its worker ticker). - Studio's pause pauses only the graphic clock (and the CSS and Web Animations it drives). Native timers,
requestAnimationFrameloops and a library's own ticker keep running.
An ambient, looping visual can use native timers with No timeline. Prefer onTick for rendering so layers share the page's animation frames and Studio can pause them; stop a library's own ticker when driving it this way. Anything time-critical (heartbeats, countdowns, event sequences) stays on bloop.schedule and onTick. Code that reads durationMs must treat null as no timeline: a Studio tab opened before this option existed misreads it (as a length of 0) until it is reloaded.
Play alerts one at a time
bloop.queue runs events in turn on the clock. Return how long the event lasts, in milliseconds, or the timeline you built. This one uses libraries: ["gsap", "gsap/SplitText"] and a sound declared as whoosh:
bloop.queue((event) => {
const name = document.querySelector('#name');
name.textContent = String(event.name ?? 'Raid party');
const letters = new SplitText(name, { type: 'chars' }).chars;
return bloop.timeline()
.call(() => bloop.sound('whoosh', { volume: 0.8 }))
.from(letters, { y: 30, opacity: 0, stagger: 0.03, duration: 0.4 })
.to('#card', { opacity: 0, duration: 0.4 }, '+=4');
}, { gapMs: 500 });Fonts, sound and images
Fonts
List each family in fonts, then load it in CSS from Google Fonts or from an uploaded WOFF2, WOFF, TTF or OTF file declared in assets:
@import url('https://fonts.googleapis.com/css2?family=Creepster&display=swap');
@font-face {
font-family: 'Brand Sans';
src: url(asset:brand_font);
}
#name { font-family: Creepster, 'Brand Sans', sans-serif; }The script runs first. Then the graphic waits up to three seconds for the listed fonts before it replays events and handles the first one, so a first alert measures text in its real font. Measure or split text inside event handlers, not at the top level. A font that does not load is named in Output.
Sound
bloop.sound('whoosh', { volume: 0.8 }) plays a declared media file. Its volume is multiplied by the layer's Sound volume (volume, default 0.8), which the streamer sets without code. Sounds stay silent while a moment is rebuilt (seeking, scrubbing, previews) or when the clock jumps past them. At most eight play at once. It never throws: a name you did not declare is reported once in Output and stays silent.
Images and effects
- Your media: declare a file in
assetsand usebloop.assets.name, a local URL. - Pictures from other websites:
await bloop.loadImage(url)fetches anhttps://PNG, JPEG, GIF, WebP or AVIF of up to 8 MB through Bloopbot and returns a local URL. Call it again rather than keeping an old URL; images are cached for a day. - Canvas:
bloop.canvas({ draw })adds a canvas sized for the real output, with its 2D context already scaled, and callsdrawon every tick. - SVG filters work, so gooey, displacement, glow and glitch effects are possible. Define the filter in HTML and apply it with CSS:
<svg width="0" height="0">
<filter id="goo">
<feGaussianBlur in="SourceGraphic" stdDeviation="8" result="blur" />
<feColorMatrix in="blur" values="1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 20 -8" />
</filter>
</svg>
<div class="blobs" style="filter: url(#goo)">…</div>feTurbulence with feDisplacementMap gives a liquid wobble; animate stdDeviation or scale from a timeline. feImage may only point at blob: or data: URLs, such as bloop.assets and loadImage results.
- Many pictures: tick Load on demand on a media setting, and
bloop.settingsholds file ids instead of URLs. Load each when you need it. The next picture of a list is fetched ahead, so a slideshow reads it from memory when it moves on, and a moment Studio rebuilds by seeking shows the same picture. Show a picture that had to load only if it is still the current one, so a slow file never covers a newer one:
const slides = bloop.settings.slides;
let index = 0;
let current = null;
const show = (id, url) => { if (id === current) document.getElementById('slide').src = url; };
const step = () => {
const id = current = slides[index++ % slides.length];
const ready = bloop.files.get(id);
if (ready) show(id, ready);
else bloop.files.load(id).then((url) => show(id, url), () => {});
bloop.schedule(8000, step);
};
step();Themes and custom CSS
A graphic draws inside its overlay's theme, like every other layer. bloop.theme is that theme for this layer, and bloop.onTheme(theme => …) receives it immediately and again whenever the streamer switches themes or changes the layer's style or the overlay's custom CSS. The graphic is not rebuilt and nothing replays.
| Field | Contents |
|---|---|
colors |
The theme's accent, panel and text colours as #RRGGBB: what a theme:accent, theme:panel or theme:text colour setting stands for |
vars |
The theme's CSS custom properties, already set on #graphic: --w-text, --w-accent, --w-panel, --w-panel-opacity, --w-panel-fill, --w-radius, --w-padding-x, --w-padding-y, --w-border-width, --w-border-color, --w-letter-spacing, --w-line-height, --w-font-weight, --w-font-family, --w-font-body-weight, and --w-bi-panel-*, --w-bi-item-*, --w-bi-alert-* for the theme's picture frames (--w-bi-…-source, the picture itself, only when your source names it) |
css |
The theme's part styles and the overlay's custom CSS aimed at this graphic, already on the page after your own CSS |
fonts |
The font families the theme loaded for this graphic |
tokens |
The theme's other choices: design, chatBubbleWidth, shadow, panelBackground, itemBackground, alertBackground (a picture or video carries url, a local blob URL, when your source names that background), motion, and parts: a built-in's part styles, or those of the parts your graphic declares |
Use the variables in your CSS so the graphic follows the theme:
.card {
color: var(--w-text);
background: var(--w-panel-fill);
border-radius: var(--w-radius);
font-family: var(--w-font-family);
font-weight: var(--w-font-body-weight);
}The theme's font is not applied for you, so an existing graphic keeps its own; write font-family: var(--w-font-family); font-weight: var(--w-font-body-weight); where you want it. The theme's fonts (its Google font, part fonts, Inter and Bloop Display) load, and hold the first event as fonts does, only for what a graphic paints in: your source, its part styles or a custom CSS rule aimed at it uses --w-font-family, or names the family. A theme's picture frame or background picture or video (up to 25 MB) is sent only to a graphic whose source names it: write var(--w-bi-panel-source) or bloop.theme.tokens.panelBackground out in full. Blob URLs in bloop.theme are replaced when the file changes, so read them again in onTheme.
A colour setting may hold a theme colour (theme:accent, theme:panel or theme:text) instead of a hex, so the graphic follows a theme switch. bloop.themeColor(value) turns either into the colour to draw: a reference as the theme's current #RRGGBB, a hex unchanged. Call it again in onTheme:
bloop.onTheme(() => {
document.querySelector('.card').style.borderColor = bloop.themeColor(bloop.settings.border);
});#graphic carries the layer's attributes, as the layer's box does on the overlay page: class="w-layer", data-layer-id, data-layer-kind (graphics, or a built-in's kind) and data-shadow. The overlay's custom CSS reaches the graphic through the rules naming one of the .w-* classes in its source, or its layer ([data-layer-id="…"]); they load after your own CSS, so the streamer wins a tie, as on the page. A class inside :is(), :where(), :not() or :has() does not count, and a rule that already styles the layer's frame on the page ([data-layer-id="…"] > *) stays there. A rule for the layer's box itself (.w-layer, [data-layer-id="…"]) or for :root, html or body brings only the custom properties your source or a kept rule uses, at the lowest priority and before your own CSS, so a property you define yourself always wins. The @font-face, @keyframes, @property and @counter-style rules a kept rule uses come the same way, so your own of the same name wins. Any other rule (img, .title) stays on the page, and a graphic with no w- class and no rule for its layer gets nothing from the overlay's custom CSS. Give the parts a streamer may want to restyle w- class names, written out in full in your source.
Letters
A built-in drawn on graphics, and a code copy of one, moves its text letter by letter as the theme's Letters say, exactly as on the overlay page: the text of every .w-<part> element the source draws is split into words and letters, text drawn later is split too, and every letter moves on the graphic's clock, so Studio's preview seeks it to the same place each time. Keep the part classes in a code copy to keep its Letters.
Any graphic can do the same to its own text: list bloop/letters in libraries (Letter effects in Studio) and call bloop.letters(target, effect) with an element inside the graphic, or a selector for one:
const name = document.getElementById('name');
bloop.letters(name, 'wave');
bloop.onEvent('raid', (frame) => { name.textContent = frame.name; });wave, wiggle, bounce, pulse, tada, rubber-band and jelly loop; typewriter types the text in once. null puts the text back, and so does the function bloop.letters returns. Text in right-to-left or joined scripts, an element past 200 letters, and everything for a viewer who asked for reduced motion stay whole, and screen readers still read the whole text.
Parts
A theme styles a built-in's parts one by one: the chat name, an alert's title, a goal's bar. Your graphic gets the same by declaring its own parts in parts. Give each element a w-<id> class, written out in full in your source, and declare it:
"parts": [
{ "id": "card", "label": "Card", "box": true },
{ "id": "title", "label": "Title", "text": true },
{ "id": "subtitle", "label": "Subtitle" }
]<div class="w-card">
<h1 class="w-title">New follower</h1>
<p class="w-subtitle">Welcome in</p>
</div>Studio's theme editor then lists them under Parts, by label, when Custom graphic is chosen, and the theme stores their styles at parts.graphics.<id>. A layer's own style can change them for that one graphic. Every part takes type, colour, text effects, padding and margins. box: true adds the box: fill, border, corners and a picture frame. text: true adds the theme's Letters, which move the part's text letter by letter as they do a built-in's, with nothing to list in libraries.
The theme's part styles are shared by every custom graphic that declares the same id, as a kind's parts are shared by all its layers, so a streamer who styles title once styles it in every graphic that has one. Your graphic receives only the styles of the parts it declares: they go in its theme sheet after your own CSS, so a part style wins a tie with your CSS, and in bloop.theme.tokens.parts. Write your own rules for a part with its one class (.w-card { padding: 0; }), as the built-ins do: a rule with an id or a longer selector would beat the theme's. A frame on a part without box, and Letters on one without text, are left out.
A graphic declares up to 24 parts. An id is a lowercase letter, then lowercase letters, digits or single hyphens, at most 32 characters, each once. The class names Bloopbot's themes draw themselves are refused: layer, root, hl, ch, wd, i, in, accent, letters-label, shape-auto, and ids starting l-, m-, i- or bi-. A label has 1–40 characters. A built-in and a code copy of one keep their kind's parts and take no parts.
Keep running when settings change
When the streamer changes one of your settings and publishes, the graphic starts over with the new values, and whatever it was showing is gone. Subscribe with bloop.onSettings while your script first runs, and it keeps running instead: your handler gets the new settings, with bloop.settings and bloop.layer already updated, so you redraw what depends on them and keep everything else on screen. A picture or sound a new value picks arrives with it.
const card = document.querySelector('#card');
bloop.onSettings((settings) => {
card.style.fontSize = `${settings.size}px`;
card.style.backgroundImage = settings.picture ? `url(${settings.picture})` : 'none';
});The handler runs once straight away, so it can draw the first look too, then again whenever only the values change or the layer is renamed, on Studio's canvas and in OBS. Keep the subscription for the graphic's life. A change to your code or declarations, to a font or variable a setting picks, and every run in the code workspace still start the graphic over. A graphic that does not subscribe starts over on every change, as before. Another layer's save, or a change to an alert design your settings do not name, never touches a running graphic.
Capabilities
A graphic gets nothing beyond its events and variables unless it declares a capability in settings.capabilities. Studio's Data & settings tab lists them under Capabilities, and anyone adding a graphic from the marketplace sees the same list, in plain words, before they add it. An update that asks for more says so.
| Capability | Lets the graphic |
|---|---|
records (alert_design, wheel, giveaway, leaderboard) |
Read the records its record settings name: bloop.records.get(kind, id) |
boards |
Show the leaderboard its source, metric, scope and variable values describe: bloop.boards.get(key) and leaderboard events |
stage |
Play the alert designs its design value and alert-design settings name; it counts as an alert layer |
media |
Play what Play media sends; it counts as a Media layer. A play's file arrives as media.file (play:<id>), never its address: bloop.files.load(frame.media.file) streams it in |
templates |
Fill $(var.…), $(data.…) and fields such as $(name): every text setting marked template: true follows its keys, and bloop.template(text, fields?) fills them |
reports (finished, mediashare) |
Tell Bloopbot when end credits or a minigame scene finish, or what a Media share video did: bloop.report(type, payload) |
embeds (twitch-clip, youtube) |
Play a Twitch clip or YouTube video in a player Bloopbot draws over the graphic: bloop.embed.show(options) |
images (emotes, badges, avatars) |
Show chat emotes and badges and Twitch profile pictures: bloop.twitch.emoteUrl, badgeUrl and avatar |
chat, countdown, slideshow, credits, emoteRain, ticker, wheel, giveaway, nowplaying, minigames, mediashare, clip |
Stand in for that built-in: the feature finds this layer, sends it the built-in's events and reads the same setting keys (durationSec and mode for a countdown, maxMessages for chat scrollback, wheelId for a wheel). Flows target it by the layer's name |
maps |
Show maps, country flags and the streamer's place lists from Bloopbot's map server: bloop.map.create(canvas, options?) (with the bloop/map library), bloop.flag(code), and places events for the lists its place_list settings pick (see Maps and places). The overlay page reads the server for the graphic; the sandbox still has no network |
goal |
Stand in for the Goal bar: the graphic gets your Twitch goal's goal events (begin, progress and end, with goal_type, current_amount and target_amount) without ticking the event, and Studio lists it under Goal bar |
A capability is true, or a list for the four with several kinds. Saving refuses what cannot work: a record setting without the capability that reads it (records with its kind, or stage, wheel, giveaway, boards or, for a place_list, maps), a template setting without templates, a finished report without credits or minigames, a mediashare report without mediashare, and a capability button such as countdown.start without its capability. Studio declares what a new record or template setting needs as you add it.
The graphic's frame still has no network. Each call goes to the overlay page, which checks the declaration and the ids your settings name, and the server checks the saved overlay again: a record is answered only when the published layer names it. In Studio's code workspace, records answer with samples and players show where they will play.
// A wheel graphic: settings.capabilities = { wheel: true }, a `wheelId` record setting.
const wheel = await bloop.records.get<{ name: string; segments: Array<{ label: string; color: string }> }>('wheel', String(bloop.settings.wheelId));
document.querySelector('#title')!.textContent = wheel.name;
bloop.records.onChange('wheel', String(bloop.settings.wheelId), (next) => console.log('The wheel changed', next));Players
bloop.embed.show({ provider, id, x?, y?, width, height, muted?, volume?, title?, mediaUrl? }) draws a YouTube video (provider: 'youtube', an 11-character video id, at least 480 × 270) or a Twitch clip ('twitch-clip', the clip's slug; mediaUrl plays a clip's own file instead) over your graphic, at that box in your graphic's coordinates, kept inside your layer: a box past an edge moves back inside and one larger than the layer shrinks to it. It plays at volume (0–100, default 100) times the layer's Sound volume, which starts at 80% (a Twitch clip's page can only be muted or not, so a silent layer mutes it); title names the player for screen readers. bloop.embed.update({ x?, y?, width?, height?, volume?, muted? }) moves, resizes or changes the level of the player showing without restarting it, for example from onResize when your layout changes size. bloop.embed.hide() takes it away. Calls run in the order you make them, and what your graphic asks while Bloopbot replays its history (a seek in Studio, a rebuild) waits for the replay to finish, when only the last stands. A rebuild keeps the player showing: a show for the same clip or video takes it over without restarting it (in its new box, and playing is said again), a player your rebuilt graphic has not asked for goes once it is ready, and one it asks for just after that resumes where it had got to, muted. onEvent('embed', …) reports playing (once per show), ended and failed with a code, plus reason: 'file' when a clip's own file failed (show Twitch's player instead) or reason: 'api' when YouTube's script did not load. A clip's own file plays letterboxed on black, and muted if the browser refuses sound. A graphic with players is placed at its own size, with no scale, rotation or motion, as the Clip and Media share players are; when a save moves or resizes the layer, the player follows, and a layer made smaller than YouTube's 480 × 270 loses its YouTube player (the graphic hears failed with no reason). On Studio's canvas a Twitch clip plays in its real player, silent while the canvas sound is off; a YouTube video shows where it will play.
A graphic declaring mediashare is a Media share player: the page keeps its id, its boot and the server's answer, and onEvent('mediashare', …) gives it each state as this player sees it, with holds (it plays the channel's video), elsewhere (another player does), answered and finished (it already ended or failed that request), and delivered (with delivered_at) each time one of its reports reached Bloopbot (a lease that runs from a delivery should start from the graphic's own start when it is rebuilt: delivered is news only and is not replayed). Report with bloop.report('mediashare', { op, request_id?, code? }); after a heartbeat the page says a finished report again while the state still names that request.
Maps and places
A graphic with maps can draw the streamer's own pins and routes on its map: the hotel, the venue, or a food tour's
numbered stops, ticked off as the camera reaches each one. Streamers make the lists on their Places page, and the map
draws them as the built-in Mini map does.
The map supports numeric zoom levels 12–18. Levels 16–18 enlarge the archive’s z15 vectors without adding map detail. Place icons include shopping, groceries, transport, services and landmarks; use the GraphicMapPlaceIcon values in the SDK. The built-in Mini map keeps its Street, Neighbourhood, Town, City and Whole route choices. Set style.glyphs.defaultPlaces to true to use the shared place icons; a style.glyphs.places table overrides individual icons. The icon data loads with the first places drawing, once per frame, rather than in each widget’s initial source.
Declare
maps, listbloop/mapinlibraries, and add a setting that picks place lists: arecordsetting of kindplace_list, or alistof them:JSON { "key": "places", "label": "Places", "type": "list", "default": [], "max": 8, "item": [ { "key": "list", "label": "Place list", "type": "record", "record": "place_list", "default": null } ] }Listen for
places. The overlay sends one when the graphic starts and whenever a picked list or its route's progress changes. It holds only the lists your settings pick. While the map is hidden for the camera yourcamerasetting follows (Camera on air without one), your lists are left out, down to{ "type": "places", "lists": [] }. The map is hidden when the stream is offline, location sharing is off, or the camera is in a privacy zone. Each list hasid,name,kind(pinsorroute),active(the one route that is running) andplaces(each withname,icon,lat,lng, a 1-basednumberfor a route stop, andstate:pin,upcoming,next,visitedorskipped).Hand them to the map with
bloop.map.placesOf(event, ids). It keeps the lists whose ids you pass, in that order, drops anything malformed and marks the running route's stops:JavaScript const map = bloop.map.create(document.querySelector('canvas')); let places = []; let last = null; function show(view) { last = view; map.setView({ ...view, places, units: 'metric', nextArrow: true }); } bloop.onEvent('places', (event) => { const ids = (bloop.settings.places ?? []).map((row) => row.list).filter(Boolean); places = bloop.map.placesOf(event, ids); if (last) show(last); });
What you see:
- Pins are discs with their icon.
- Route stops are numbered badges joined by a dashed line in stop order. Visited stops are dimmed with a tick, and skipped stops are dimmed.
- The next stop has a ring that pulses gently (never with reduced motion), and its name is the first label on the map.
- When the next stop is off the map, an arrow on the map's edge points to it with a pill such as "The Crown · 350 m".
units: 'imperial'reads miles and feet, andnextArrow: falseturns the arrow off. zoom: 'route'(Whole route) frames every stop of the running route and the marker at the closest of Street to City, so the marker may sit off centre. With no route running, it shows Street.
The style may set pin, stop, route and next colours. Without them, pins take the label colour, stops and the next
stop the marker's, and the line the trail's. Pass glyphs.places (SVG path data on a 24 grid for each icon: hotel,
local_bar, restaurant, local_cafe, music_note, stadium, star, flag, home, local_parking, photo_camera,
info) and glyphs.tick. Without them, a pin is a plain disc and a visited stop keeps its number.
Limits:
- A setting may pick up to 8 lists, and a list holds up to 50 places, so a map draws at most 400.
- The line between stops is straight, never along streets.
- Pins show where the streamer put them, exactly.
The bloop object
bloop.version is "1.3". Every on… method, schedule and queue returns a function that cancels it.
Data
| Member | What you get |
|---|---|
settings |
Current values of your controls, frozen all the way down (lists included) |
onSettings(fn) |
The settings now, then each change of values or the layer's name, without starting over (see Keep running when settings change) |
assets |
Local URLs for declared media, by name, frozen |
getVariables() |
Current values of declared variables |
onVariables(fn) |
The current values now, then every change |
onEvent(type, fn) |
Each declared event as a detached JSON object; an undeclared type throws |
onAction(action, fn) |
Runs when the streamer presses a declared button whose action is action, in Studio and on stream; never through onEvent. An undeclared action throws |
queue(fn, { events?, gapMs?, max? }) |
Events one at a time. gapMs defaults to 0; events narrows which types; up to max wait (default 50, at most 500) and newer ones are dropped with a warning |
Time and size
| Member | What you get |
|---|---|
timeMs |
The clock's current time |
size |
{ width, height, pixelRatio }. pixelRatio counts the overlay's own scaling and the screen |
onTick(fn) |
{ timeMs, deltaMs } now (delta 0), then on every clock advance |
onResize(fn) |
The size now, then on every change |
layer.shape() |
The layer's shape as the overlay clips it: { d, width, height }, SVG path data (commands M L C Q A Z) in your graphic's pixels, or null for a plain box. Mask with new Path2D(d) |
layer.onShape(fn) |
The shape now, then every change: a new shape, a new size, or a layer state that reshapes the layer |
visibility |
Frozen { visible, documentVisible, sourceVisible, sourceActive }; the OBS flags are null until known. visible combines document visibility and source visibility, not source activity |
onVisibility(fn) |
The visibility now, then every change. Logical work continues while hidden |
random(key) |
The same number in [0, 1) for the same text or finite-number key, independent of call order |
shuffle(items, key) |
A repeatably shuffled shallow copy; never changes the input array or its items |
timeline() |
A paused GSAP timeline on the clock (needs gsap) |
schedule(ms, fn) |
Runs once, 0–3,600,000 ms from now; cancelled on dispose. When the live clock jumps because the page drew nothing for over a second (an OBS source hidden and shown again, a background tab, a sleeping computer), each job it skips over runs once, at the new time, so a job that schedules itself again carries on from there instead of running once for every missed interval, and the next queued event starts then, with its sound. Seeking or a rebuild still replays every job at its own time. Only a job that keeps scheduling itself with no delay is ever dropped, with a warning in Output |
onDispose(fn) |
Runs once before the graphic is removed. Studio rebuilds on every seek and code change, so release what you create here |
Media and drawing
| Member | What you get |
|---|---|
sound(asset, { volume? }) |
Plays a declared file by name, or any local URL the graphic holds, at volume (0–1, default 1) × the layer volume. Returns { stop() }; never throws |
canvas({ width?, height?, context?, parent?, draw? }) |
A 2d, webgl or webgl2 canvas, at most 4,096 pixels a side. draw receives { context, canvas, width, height, pixelRatio, timeMs, deltaMs }; drawing pauses while hidden and resumes at the current moment with deltaMs: 0. Returns { canvas, context, width, height, pixelRatio, redraw(), destroy() } |
loadImage(url) |
A promise of a local URL for a remote image (see Images and effects). Kept for a day, least recently used dropped past 128 MB |
files.load(id) |
A promise of a local URL for a file a Load on demand setting holds (its id from settings), fetched through Bloopbot the first time, at most 8 MB. Also takes a Play media play's media.file (with media): a WebM video plays as it arrives, any other file once it is whole, at most 25 MB, let go at the play’s stop or the next play (a video's URL plays in one element). Also a name in assets or a URL the graphic already holds |
files.get(id) |
The local URL now if the file is in memory (loaded, sent ahead as the next of a list, or kept for a rebuilt moment), otherwise null. Never fetches |
Theme
| Member | What you get |
|---|---|
theme |
The overlay theme this layer draws with, frozen: { colors, vars, css, fonts, tokens } (see Themes and custom CSS) |
onTheme(fn) |
The theme now, then every change, without a rebuild |
letters(target, effect) |
Animate an element's text letter by letter, as a theme's Letters do; needs bloop/letters (see Letters) |
themeColor(value) |
A colour setting as it draws now: theme:accent, theme:panel or theme:text as the theme's #RRGGBB, a hex unchanged |
paintBackground(el, background, { video? }) |
Paints a theme background (bloop.theme.tokens.panelBackground …) or one you build ({ type: 'color' | 'gradient' | 'image' | 'video', color, gradient, url, fit, position, opacity, blur }) behind el's content, as the built-in widgets do. Theme colours resolve; pictures must be blob: URLs |
number(value) |
A variable's value as a number (a number, or text that is one), else null |
onWallClock(everyMs, fn) |
Calls fn(Date.now()) just after each whole interval of the wall clock (1–3600 s), counted from the Unix epoch so every source agrees: seconds, minutes and quarter hours fall on local boundaries everywhere, an hourly tick on the UTC hour. For clocks and rotations; it does not follow Studio's preview clock |
demoState(draw, holdMs?) |
Keeps a Studio Test sample (a frame with demo: true) apart from the live state: .demo(sample) draws it for holdMs (6 s), then draw(live) again; .live(state) draws at once unless a sample holds |
playMotion(el, motion, phase, { distance?, delayMs?, fallback?, options?, fittedDurationMs? }) |
Needs the bloop/motion library in libraries. Plays a theme Motion (bloop.theme.tokens.motion.rowIn, rowOut …, or an effect name) on el as the built-in widgets do, phase in or out. A negative delayMs starts it that far in, so something drawn late after a rebuild shows as far along as it would be. fallback is the effect when motion names none, options an alert design's own animateInOptions or animateOutOptions (direction, length, easing) when motion is only an effect name, and fittedDurationMs a length that fits a queue item's time, even under 100 ms. Under reduced motion it is a fade of the same length. Returns its length in ms (0 when nothing plays) |
clearMotion(el) |
Takes an entrance or exit off el |
motionMs(effect, { durationMs? }) |
Needs bloop/motion. How long an entrance or exit runs: 0 for none, else durationMs, else 400 |
preview |
true where Studio draws the graphic (its canvas and the code workspace), false in OBS |
volume, onVolume(fn) |
The layer's sound level, 0–1, and each change; 0 while Studio's canvas sound is off |
replaying |
true while this moment is replayed: a rebuild or a Studio seek replays the graphic's events, or a timeline callback runs inside a long seek. sound and playMedia stay silent then |
playMedia(el, { volume?, muted?, moment? }) |
Needs the bloop/stage library. Starts an <audio> or <video> you built at volume × the sound level, muted while the level is 0 (and marked data-preview-muted) and following later changes; muted: true keeps it muted for good. Started in a replayed moment it never sounds: it is muted for good, stands where it would be by now, and plays on muted once the clock runs (a paused Studio canvas or a preview capture keeps it paused). stop() pauses it and clears its source; remove the element yourself. For an element that starts after its event (once files.load or a record read answers), read moment = { timeMs: bloop.timeMs, replaying: bloop.replaying } when the event arrives and pass it, so a replayed play stays silent after the replay too; take what had already played off timeMs (a stage play's durationMs − remainingMs) |
cardHeld(id, card, { scale }?) |
Needs stage and bloop/stage. On Studio's canvas, tells Arrange card where a held alert card (.w-alert) and its pieces painted, once it has settled. An explicit finite scale from 0.1 to 4 enables handles that scale the whole card and keeps the handles aligned with its contents |
To offer Arrange card for a custom alert, declare capabilities: { stage: true }, list bloop/stage, and give its alert_design record control editor: "inline". Draw the chosen design's card and pieces, and report a settled preview hold with bloop.cardHeld(frame.id, cardElement). A Free card has optional whole-pixel x (-1920–1920) and y (-1080–1080), default 0, relative to its usual position inside the layer. Apply these as left and top on a position: relative card, keeping motion's transform independent. Re-read the design when its record changes and redraw a held preview so dragging follows the saved arrangement. Built-in alert code copied with Edit code already follows this contract. These controls edit the shared design; they do not rewrite arbitrary HTML or move the overlay layer.
For handles that scale the entire card, also draw the Free design's optional card.scale (a finite number from 0.1 to 4, default 1). Keep card.width, card.height and each piece's coordinates and sizes in their original, unscaled pixels. Put the card in an outer wrapper that applies transform: scale(scale) with transform-origin: top left, leaving the card's own transform for its entrance and exit motion. Apply card.x and card.y outside that scaling wrapper so moving the card does not multiply its position. Report the unscaled .w-alert element and the scale you applied with bloop.cardHeld(frame.id, cardElement, { scale }). Report 1 too: the explicit option tells Studio your widget supports whole-card scaling. Studio then scales the card and its contents with its handles; individual pieces still drag and resize in the card's original coordinates. Layout width and Layout height change the available layout space. Older sources that call cardHeld without the scale option keep their box-resize handles and Card size fields until their author implements this contract.
Capabilities and helpers
| Member | What you get |
|---|---|
layer |
{ id, name } of the layer the graphic draws on. Frames such as a ticker line or a countdown name their layer. A rename reaches onSettings |
capabilities |
What the graphic declared, frozen |
template(text, fields?) |
text with $(var.…), $(data.…) and $(field) filled (needs templates). A variable the graphic does not follow, or a field fields lacks, comes out empty; anything else inside $(…) stays as written |
templateParts(text, { fields?, value? }) |
The template as literal runs and filled values ({ text, value }), to draw values apart; value(key, current) reads a variable as you show it (needs templates) |
writeText(el, parts, highlight?) |
Writes parts as text, each value in <span class="w-hl"> when highlight |
highlights(part, defaultOn?) |
Whether the theme highlights this built-in part's values (Highlight values); ask again in onTheme |
format.number(value, style?, currency?) |
plain (1234.5), grouped (1,234.5), compact (15.3K) or currency ($5.00, or another three-letter code) |
format.duration(ms) |
A clock: 4:05, or 1:02:05 from an hour up |
records.get(kind, id) |
A promise of a record your settings name: alert_design, wheel, giveaway (or 'panel', the live one, with giveaway), leaderboard, or nowplaying with id 'current'. Pictures, sounds and videos in it arrive as local URLs sound can play. An alert design's video can be up to 25 MB: read the design with a third argument, records.get('alert_design', name, { streamVideo: true }), and the video is not copied into your graphic. media.video is then absent and streams.video is a file name; await bloop.files.load(name) gives a URL that plays while the file is still arriving, a stream of its own on each call, so give every card its own <video> and load it again for the next card. Up to four such streams run at once (cards of several designs, or one leaving beside the next); a fifth lets the oldest go, and so does removing the card's element from the page. A graphic that only reads designs (records) needs nothing declared for it: the answer brings what loads the file. A design read this way and later changed is pushed to records.onChange the same way. When Bloopbot is answering too many requests, the error has retryAfterMs: wait that long before asking again. A record the overlay names but your library no longer holds (a wheel you deleted) rejects with notFound: true on the error; any other failure, a refused or revoked overlay key included, does not, so keep what you show |
records.onChange(kind, id, fn) |
A newer copy of a record you read |
boards.get(key) |
A promise of the newest snapshot of one of your boards (loyalty, contrib:<metric>:<scope>, var:<key>) |
report(type, payload?) |
finished with { roll_id } (credits) or { play_id } (minigames), or mediashare with { op, request_id?, code? }. Never throws; a refusal goes to Output |
minigames.moment(sound), minigames.flow(sound), minigames.gain(volume) |
Needs minigames. Game sounds the overlay page plays, mixed with every Minigames layer on it: moment({ key, moment, source, asset?, volume }) plays a game moment (slots.spin …) from its built-in sound (source: 'default') or a library file your values name ('library'), once per key and moment on the page; flow({ id, url, volume }) plays a Play a game sound step's file in full (the sound_id and url of a minigames sound event this layer heard in the last minute); gain(volume) is your layer's Game volume, 0 to 1, or null while it should not count. Silent on Studio's canvas. Never throws |
twitch.emoteUrl(id, scale?, provider?, animated?, sourceAnimated?) |
A local URL for an emote (twitch, bttv, ffz, 7tv, kick). The fourth argument permits animation; the fifth says whether the emote itself is animated. Pass it (fragment.animated === true for a chat fragment, or the flag from bloop.chatEmote(fragment)) so static 7TV emotes load their ordinary image with animation off. Without it the source is assumed animated, as before, and an animation-off 7TV request asks for a still that static emotes do not have. Existing four-argument calls keep their behavior |
twitch.badgeUrl(imageId, scale?) |
A local URL for a chat badge, by the image id chat events carry |
twitch.avatar(login) |
A local URL for a viewer's profile picture |
chatEmote(raw) |
Needs the bloop/chat library in libraries. A chat frame's emote fragment (or a flow's rain emote) checked against its provider's id shape: { provider, id, name, animated, zeroWidth }, or null |
writeChatMessage(body, fragments, { classes, animate, scale? }) |
Needs bloop/chat. Appends a chat message's fragments to body as the chat box draws them: spans for text, mentions and cheers, an <img> per emote with 7TV zero-width emotes stacked, a bad emote id as its code. classes names each part's class (text, mention, cheer, emote, zeroWidth, stack). Needs images: ['emotes']. Each picture's src arrives after the line is drawn: give img:not([src]) width:0;visibility:hidden in your CSS, so it keeps its height as a loading picture does |
wheel.view(doc?), wheel.loop(), wheel.rotation(spec, serverNow), wheel.art(), wheel.colors |
Needs the bloop/wheel library in libraries. The Spin wheel's drawing, as the built-in Spin wheel and Giveaway draw it: view(document) builds a wheel (.w-wheel-stage; bring the .w-wheel-* rules in your CSS) with setSegments, setRotation, setHit and setArt, loop() turns views on animation frames, rotation(spec, serverNow) is where a server-fixed spin is (and whether it has landed), art() the theme's pointer and cap pictures (theme.tokens.slots, sent to every graphic that lists bloop/wheel) and colors the segment palette |
writeChatBadges(parent, badges, { className, scale? }) |
Needs bloop/chat. Appends a badge <img> per resolved badge (at most 8) and returns how many. Needs images: ['badges'] |
map.create(canvas, options?) |
Needs the maps capability and the bloop/map library in libraries. Draws a map on a <canvas> from Bloopbot's map server on the canvas-2D context, with no GPU, and returns a MiniMap with setView(view), setStyle(style), resize(cssSize, pixelRatio), outline() and dispose() (the types are GraphicMapView, GraphicMapStyle and GraphicMiniMap). resize takes a number (the canvas is a square of that many CSS px) or { width, height } (the canvas fills that box); the style's mask is what the map is cut to: SVG path data in the canvas's CSS px from its top-left corner, usually your layer's own shape (bloop.layer.shape()?.d, and again on each bloop.layer.onShape), or null for the plain box with the style's radius. The mask clips the map and its border, drops labels that would be cut off, and keeps the privacy zone's words inside it where they fit, and always keeps the attribution inside it, shrinking it to OSM's short form and then to smaller text on a tiny or spiky mask. The engine never stretches a mask: hand it a new one when the layer's size changes. The style's old shape ('round', 'square' or a shape name) is gone, so copies of the Mini map made before layer shapes draw the plain box: pass the layer's shape as mask instead. In the SDK types this is a breaking change: GraphicMapShape is removed and GraphicMapStyle.mask is required (null for the plain box), so TypeScript code that still sets shape no longer compiles. outline() returns the mask (or the plain box) as SVG path data in the canvas's CSS px (it changes only with setStyle and resize), for a shadow drawn once behind the canvas. Throws without maps. Labels use English names where OpenStreetMap has them, and the local name where it does not (the streamer's own place names are shown as written). The map server's files arrive through the page, a range at a time, a dozen tile reads at once per map and nearest the centre first (the host allows 32 calls waiting per graphic, so a graphic with several maps should share one or expect refusals); a tile that fails to load tries again by itself while it is in view, after 2 s, 5 s and 15 s, then every 30 s (a new fix does not hurry it), and a bigger resize box reads the tiles it newly shows. Tiles that arrive after the first paint fade in over 250 ms (not with reduced motion or in a privacy zone). Maps still open when the graphic goes are disposed with it. bloop.map.placesOf(event, ids?) reads a places event (only the listed ids, in that order, when given) into the places a view takes; see Maps and places. |
flag(code) |
Needs the maps capability. A promise of a blob URL of a country's flag as an SVG, for an ISO 3166-1 alpha-2 code in any case ('gb', 'DE'); rejects for a code the flag set does not hold. Draw it with an <img> |
embed.show(options) / embed.update(options) / embed.hide() |
A player over the graphic: draw it, move, resize or re-level it in place, take it away (see Players) |
Settings reference
A graphic's settings object. Studio's Data & settings tab edits all of it; you only write it by hand through MCP.
| Field | What it holds |
|---|---|
version |
Always 1 |
html, css, javascript |
Your source, up to 100,000 characters each. The whole settings object, source included, and the overlay document that holds the graphic must each stay under 128 KB of JSON; a save over that is refused with "Keep this under 128 KB." |
language |
Optional. "ts" when javascript holds TypeScript; absent (or "js" on input) means JavaScript. New graphics start as "ts". Before Studio, OBS, preview_overlay or a marketplace build runs it, it is compiled to JavaScript: types are erased, never checked at run time. A syntax error runs no script; Studio's console and MCP compileWarnings name its line. A compile that takes longer than 2 seconds is stopped and reported the same way, and pauses compiling for the channel for a minute |
libraries |
Libraries, plugins and add-ons to load, such as ["gsap", "gsap/SplitText"]. Names and versions: Graphics libraries. "bloop/motion", "bloop/chat", "bloop/wheel", "bloop/map" and "bloop/stage" are Bloopbot's own: the code behind bloop.playMotion, behind the chat helpers with a cache that asks for each Twitch picture once while it is kept, behind bloop.wheel, behind bloop.map (Mini map, with the maps capability) and behind bloop.playMedia and bloop.cardHeld |
events |
Event types the graphic receives, such as raid, follow, chat, goal and poll |
messages |
Optional. Up to 64 message names (1–32 lowercase letters, digits, hyphens or underscores), or { name, fields } |
variables |
Up to 32 channel variable keys (1–64 lowercase letters, digits or underscores) |
assets |
Up to 32 names mapped to media from this channel's library |
fonts |
Optional. Up to 8 font family names, unquoted (1–64 letters, digits, spaces, hyphens or underscores) |
volume |
Optional. The layer's sound level, 0–1, default 0.8 |
controls |
Up to 64 settings the streamer can change without code, counting those inside groups and lists (below) |
values |
The streamer's values for those controls; missing ones use the default |
presets |
Optional. Up to 16 { id, label, values } buttons that fill in the values they list |
parts |
Optional. Up to 24 { id, label, box?, text? }: the .w-<id> elements the theme styles one by one (see Parts). Not on a code copy |
capabilities |
Optional. What the graphic may do beyond its events and variables (see Capabilities). Absent means nothing more than its settings need: a graphic saved before capabilities existed reads as declaring records for its record settings and templates for its template text |
durationMs |
Required. Studio preview length, 100–60,000 ms, or null for No timeline: the preview plays on with no end (see No timeline). The Studio canvas and OBS never use it |
examples |
Optional. Your example payloads, the records and variable values they read, and a demo (see Examples and a demo). Never sent to OBS |
Examples and a demo
examples ships your graphic with its own example data, so whoever adds it sees it working: Studio's Play example (on the canvas and in the code workspace's Examples tab), the workspace preview, marketplace screenshots and videos, and preview_overlay all play it. Built-ins declare theirs the same way, in their manifest, and a code copy keeps them. Nothing in examples reaches OBS, Twitch or flows; OBS is never served it.
{
"payloads": [
{ "name": "Small raid", "event": "raid", "fields": { "name": "Tiny", "viewers": 3 } },
{ "name": "Huge raid", "event": "raid", "fields": { "name": "PixelPal", "viewers": 500 } },
{ "name": "Hype", "event": "custom:celebration", "fields": { "viewer": "PixelPal", "size": "3" } }
],
"records": [{ "kind": "nowplaying", "id": "current", "data": { "nowPlaying": { "title": "Example song", "artist": "Example artist" } } }],
"variables": { "wins": 12 },
"demo": { "steps": [{ "example": "Small raid", "afterMs": 0 }, { "example": "Huge raid", "afterMs": 2500 }, { "example": "Hype", "afterMs": 3000 }], "endMs": 3000, "loop": true }
}| Field | What it holds |
|---|---|
payloads |
Up to 24 { name, event, fields }. name is 1–40 letters, digits, spaces or simple punctuation, unique. event is an event type, such as raid, or a flow message as custom:<name>. For an event, fields is the frame without type, checked against what a real frame of that type carries; for a message, its text values (a declared number field must hold numeric text, a declared list one of its values). Each at most 8,000 characters of JSON. An example for an event the graphic no longer declares is kept and never delivered |
records |
Optional. Up to 16 { kind, id, data }: what bloop.records.get(kind, id) answers while examples play and in the workspace preview, after the usual checks that the graphic may read it. kind is alert_design, wheel, giveaway, leaderboard or nowplaying (id current); data is a JSON object, at most 8,000 characters |
variables |
Optional. Up to 32 channel variable keys or data.<record>.<field> keys, each text (up to 1,000 characters), a number or true/false. They lie over the channel's values; the graphic still only sees the ones it follows |
demo |
Optional. steps: up to 32 { example, afterMs }, each naming a payload and played afterMs (whole milliseconds) after the step before; endMs (default 3,000) holds after the last step; loop: true starts over. Every wait and the hold total at most 60,000 ms, and a looping demo at least 500 ms. Without a demo, Play example and previews play the first example of each event at the start |
All of examples stays under 64,000 characters of JSON and holds no text or key containing $(secret.…) (a pasted key itself cannot be recognised, so keep keys out), and an empty set is stored as no field. Saves are checked strictly; an example stored before a change it no longer fits (a message's fields) is left out when the overlay is read, and Studio removes it with a note. A frozen preview shows the demo just after its last step. Studio's Simulate lists your examples before the platform's samples.
Controls
A control has key (a lowercase letter, then up to 47 letters, digits or underscores; camelCase allowed), label (1–80 characters), optional help (up to 280 characters) and optional showWhen. showWhen is {key, equals} (a value or a list of values), {key, notEquals}, or a list of up to four that must all hold. It names another one-value setting at the same level and only hides the control in the editor.
| Type | Fields | bloop.settings holds |
|---|---|---|
text |
default, multiline?, maxLength? (up to 1,000), required? (must not be blank, the default too), format? (time: a time of day as HH:MM, 00:00–23:59, drawn as a time picker; it needs a valid default and takes no multiline, maxLength, template or required), template? (needs templates: the platform follows its $(…) keys) |
a string, as written; bloop.template fills it |
color |
default (#rgb, #rrggbb, #rrggbbaa), alpha?, themeRefs? (also accept theme:accent, theme:panel or theme:text) |
a string: the colour, or the theme reference exactly as chosen, so your code can follow the theme |
number |
default, min?, max?, step?, unit?, slider?, integer? (whole numbers only), scale? (the form shows the value divided by it: 1000 with unit s shows milliseconds as seconds, 0.01 with unit % shows 0–1 as a percentage), clamp? (true, with both limits: a value outside them is kept at the nearest limit instead of refused), floor? (with clamp: a value above min but below floor is raised to it, so min stays an off switch) |
a number in stored units (within ±1,000,000,000) |
flag |
default |
true or false |
select |
options (up to 32 strings or {value, label}), default, display? (dropdown, segmented, or shapes: a grid of shape tiles, for a single choice whose option values are round, square or Social image shape names such as heart or star), multiple?, required? (with multiple: at least one) |
the chosen value, or with multiple a list |
font |
default (a family name, or "") |
the family; a Google Fonts family is loaded before the first event |
gradient |
default, like linear-gradient(180deg, #467bff 0%, #121419 100%) or radial-gradient(circle, …), 2–4 hex stops in order |
the CSS gradient |
asset |
accept (image, audio, video, font), default (a library id or null), multiple?, max? (up to 100), lazy? (load on demand), slots? (with multiple and lazy: keep a slot per entry); each file must be a kind in accept, checked when the draft is saved |
a local blob URL or null; with multiple a list of URLs; with lazy the library ids instead, for files, a file the library no longer holds left out (with slots, kept as '' so entry N stays entry N) |
record |
record (alert_design, wheel, giveaway, leaderboard, place_list: its lists arrive as places events, never through bloop.records), default, editor? ("inline", alert designs and wheels only), required? (it must name one: null and a blank are refused, the default too, and the picker has no "None") |
the design name, id or board key, or null |
variable |
default, scope? (channel, viewer), data?, valueType? (number, text, flag: the editor offers only that type, and a data field must hold it) |
the variable key or null; a channel variable is delivered to getVariables() |
list |
item (the controls each item holds: no list, group or action), default items, min?, max? (up to 100), itemLabel? |
an array of objects, each item’s defaults filled in |
group |
controls (no group inside), collapsed?, editor?: "minigame-sounds" (once, over exactly the Minigames sound values; Studio’s layer panel then draws the Minigames Sounds editor in their place) |
nothing of its own: its controls’ values sit at the top level |
action |
action |
nothing: a button |
A widget action button’s action is a lowercase name. Pressing it in Studio runs bloop.onAction(action, handler) in this graphic, in the Studio preview and on every open OBS source, and never reaches onEvent or a queue. The press names the layer whose button was pressed, so another graphic with the same action stays still. MCP previews press one with {type:"custom", name:"action:<name>", data:{}}, adding layer:"<layer id>" to press one layer's button. An action of the form capability.verb is a capability button: countdown.start, countdown.pause and countdown.reset start, pause and reset the countdown named after the layer, exactly as the Countdown panel's buttons do, and need the countdown capability. slideshow.next (with slideshow) moves the saved Slideshow layer with this layer's id on one picture, on every source and for good, exactly as a flow's Control a slideshow step does; publish the layer first, since it is found among your saved overlays. A capability button reaches the live overlay, so an MCP preview cannot press one: to see a slideshow turn, preview at a later timeMs. stage.test (with stage) is Test on stream: after the streamer confirms, it plays the first design your graphic draws on the live overlay. media.library (with media) is the Media layer's Media library button: it opens Studio's media library.
With editor: "inline", an alert_design or wheel setting at the top level or in a group (one per kind, never in a list item) shows the record's own Studio editor in place of a picker: the same design editor an alert layer has, or the same segment editor a Wheel layer has. Those edits change the design or wheel everywhere it shows; your code still receives the id. Settings, list items and presets are validated together, and every value must match its control.
Naming rules
- Asset names start with a lowercase letter and use lowercase letters, digits and underscores, up to 48 characters. Control keys start with a lowercase letter and may use capitals too, such as
durationSec, up to 48 characters.constructor,prototype,__proto__and the other names every JavaScript object has, such astoStringandvalueOf, are refused. - Labels have 1–80 characters. Defaults and values must match their type;
falseand0are kept. - Source is never rewritten: Bloopbot does not expand
$(…)templates or swap asset-like strings in your code. Bind media throughassetsor anassetsetting.
Build and test through MCP
An AI assistant connected through MCP can write and check a graphic without OBS:
describe_layer_kind({ kind: 'graphics' })returns the allowed events and a complete starter. It also returns the whole controls and capabilities vocabulary:controlTypes,controlLimits,recordKinds,assetKinds,capabilitiesandcapabilityActions.create_overlayacceptsstartWith: { kind: 'graphics' }.save_overlay_draftreplaces the whole source document, checking the revision. A TypeScript graphic that does not compile is still saved;save_overlay_draft,patch_overlay_draftand a source upload link returncompileWarningswith each field, line and message (a layer the server could not check just now, because the channel compiled too often in the last minute or the server was busy, is reported as "Not checked").preview_overlayrenders a moment:graphics: { timeMs, events: [{ timeMs, frame }], variables }, with up to 32 made-up events and 32 values. Passframes(2–12 timestamps) instead oftimeMsfor a strip of images. Events after the chosen time are ignored, and each layer keeps only the types it declares. Adddemo: trueto play each graphic's own demo with its records and values under your events. Withoutgraphics, a graphic with examples shows its demo; otherwise it uses the sample for the first declared event. Previews change no live data.describe_layer_kind({ kind: 'graphics' })also returnsexamples: the shape and limits above.- On a channel with the cloud stream,
list_place_listsgives the ids aplace_listrecord setting takes. An assistant can make a list withcreate_place_listfrom coordinates it knows; it cannot search for places.
Packs carry the source, controls, examples and any missing variable declarations. Media rebinds to the recipient's library, and their existing variable values are kept.
Sandbox and limits
- Source runs in an isolated frame. It receives only declared data and media, never the channel's credentials, and cannot read the dashboard, cookies or storage.
- Blocked: remote scripts, images and media,
fetch(exceptblob:URLs, so loaders such asPIXI.Assets.loadcan read your media), sockets, workers and nested frames. Allowed: Google Fonts stylesheets and font files, pictures throughbloop.loadImage, and what a declared capability asks the overlay page for. Players are drawn by the page, outside your frame. - Declared media: up to 8 MB per file and 32 MB loaded before the graphic starts. A Load on demand setting's files load as your code asks: as many as the setting holds, at most 48 MB of them in memory at once, the least recently used dropped first.
- A Play media file: up to 25 MB, one play at a time; it streams into the frame through Bloopbot, so the frame still makes no request of its own.
- A graphic downloads only the libraries it lists, each a separately cached bundle.
- OBS receives your CSS and JavaScript minified. Studio keeps them as written, so Output line numbers match the editor. Errors and media failures show there too.
- A failed or unhealthy layer appears beside Studio's canvas with its name, reason and source line when available. Restart restarts only that preview layer at its current moment; it does not send a test or change the live OBS overlay. OBS stays transparent instead of drawing error text on stream.
- Asset, image, record and board reads have deadlines and reject on failure; a restart or disposal cancels outstanding work. Catch rejected reads and keep a fallback visible instead of waiting forever.
- An infinite loop runs in the viewer's browser and can stall the overlay. Keep per-tick work small.
- The frame can still navigate itself, so only run source you trust with channel data.