Anime Looks: Cel Light, Painted Skies and Impact Frames
README.md
impactFrames: anime impact frames and smears for any look
Anime and manga hit impact frames for any game, shown on every player's screen at once and safe for photosensitive players by default (at most three full-screen flashes a second). Nine styles: inverted flash, black and white negative, radial burst, colour pop, speed lines, white flash, slash, a held hit pose and a sumi-e ink splash, plus smears that stretch a fast swing. Works with any look, anime or not.
Get started: install impactFrames, then where a hit is decided
require("~impactFrames.ImpactFrames").play("speedBurst", { entity = target })
It brings styleKit and frameTiming along. Version 1.1.1; the history is at the end.
First impact in a few minutes
- Install impactFrames from ZeroMind (search "anime impact frames"); it brings styleKit and frameTiming along.
- Call it where a hit is decided, on that one machine (in play, the owner of the attacker), for example from a component's own hit handler:
local ImpactFrames = require("~impactFrames.ImpactFrames")
-- inside your component, when this attacker's hit connects with `target`
local function onHit(target: any, heavy: boolean)
if heavy then
ImpactFrames.play("slash", { entity = target, angle = 0.5 })
else
ImpactFrames.play("speedBurst", { entity = target })
end
end
To see one straight away, run require("~impactFrames.ImpactFrames").play("radialBurst", { screen = { 0.5, 0.5 }, duration = 3, localOnly = true }) with the execute tool and capture it with capture { source = "presented" } while it shows (styleKit draws on the presented frame only).
- For smears, add the
Smearcomponent to a fast object (a sword, a ball, a dashing player): it smears it whenever it moves faster thanminSpeed(9 m/s). - Already using juiceKit for shake and hitstop?
ImpactFrames.rideJuice(require("juiceKit.juice"))once, and every juice hit brings its impact frame along (see Riding along with juiceKit).
Impact styles
| Style | What it draws | Counts as a flash |
|---|---|---|
invert | The whole picture as a hard, cold negative, sparse pale rays out of the hit. | yes |
silhouette | Subjects as flat shapes: variant "blackOnWhite" (default), "whiteOnBlack", or "redWhite" (black subjects on white with red rays behind them). Subjects found by depth (split = "depth", what stands nearer than the hit plus a few metres) or by brightness ("luma"). | yes |
radialBurst | Bold rays and a shock ring bursting from the hit over a darkened negative ground; variant = "rays" keeps the picture and draws the rays only. | yes ("rays": no) |
colourFlip | The picture's tones as three flat colours: ink darks, a red middle band, pale lights; variant = "reversed" flips the tones. | yes |
speedBurst | Thin ink focus lines closing in from the edges on the hit, a clear oval around it. | no |
whiteFlash | The frame blown out to white, brightest at the hit, subjects left as a faint grey print. | yes |
slash | A bright blade cut across the frame through the hit at angle (radians on screen, default 0.6), the picture on each side knocked apart along the cut and pushed to two flat tones, thin accent echoes beside the blade. variant = "light" reverses the tones. | yes |
holdPose | The held hit pose: the character hit (entity) and the attacker, when given, freeze on the drawing of the hit while their movement, physics and the controls run on (frameTiming's holdPose), framed by a few bold dark wedges with a wide clear space round the hit (since 1.0.8; before, the same fine lines as speedBurst, so the two could not be told apart). | no |
inkSplash | Sumi-e ink on paper: the picture washed to black ink, a dry brush stroke torn through the hit at angle, and with variant "splash" (default) a ragged burst of ink with splatter spokes and drops; "stroke" is the stroke alone. Ink and paper only, never red, for bloodless takedowns and final blows. | yes |
ImpactFrames.play(style, opts) options:
at(a world point),entityorscreen({ u, v }, 0 to 1 from the top left): where the hit is. Each player's machine projects a world point through its own camera at the moment the hit starts.strength(0 to 1, default 1),duration(seconds; defaults: invert 0.125, silhouette 0.17, radialBurst 0.25, colourFlip 0.125, speedBurst 0.35, whiteFlash 0.1, slash 0.2, holdPose 0.28).variant,splitas in the table;angle(slash);attacker(holdPose); coloursink,paper,accent("#rrggbb"or{ r, g, b });settings(any raw block setting, e.g.{ lines = 90, lineWidth = 0.3, clear = 0.2 });seed(the drawings, the same on every machine).delay(seconds: every machine starts at the same future moment),localOnly(this screen only),downgrade = false(drop a flash over the budget instead of drawing the rays variant).
Drawn on the held clock. A hit is laid once, with its start on styleKit's held clock (the stack's holdRate, drawings a second: 8 for TV anime, 12 for 80s OVA and action), and the shader steps its rays and lines and fades it on that clock by itself. Nothing is written while it shows, its lines step like drawn animation rather than crawling per frame, and an impact keeps the look's own drawing rate.
Up to three impacts show at once; a fourth replaces the oldest. ImpactFrames.stop() takes them all off; active() lists them; stats() counts plays, flashes drawn, downgraded and dropped, sent and received.
Riding along with juiceKit (Juicebox)
impactFrames does not remake camera shake, hitstop, squash or sparks: juiceKit does those. A game that already plays juiceKit presets gets impact frames on its hits with one line, once, on every machine (a component's start, or the scene's entrypoint):
ImpactFrames.rideJuice(require("juiceKit.juice"))
From then on every Juice.play(preset, target) this machine makes for a mapped preset also plays its impact frame on the same target, sent to every player like any play (on this screen only when the juice play is scope = "local"), under the same flash limit. The map (ImpactFrames.JUICE_MAP): punch and hitLight speed lines, hitHeavy radial burst, hitCritical black and white silhouette, explosionSmall white flash, explosionLarge invert, death colour pop. Change it with rideJuice(Juice, { map = { hitCritical = "slash", punch = false } }); strength scales every ridden impact (0.9). ImpactFrames.stopRidingJuice() puts Juice.play back exactly; ridingJuice() reports the map and how many impacts it played.
The other way round works too: ImpactFrames.onHit(fn) calls fn(style, hit) for every impact a machine draws (its own and other players', hit = { at, entity, screen, strength, variant }), so ImpactFrames.onHit(function(_, hit) Juice.play("hitstopLight", nil, { scope = "local" }) end) hangs juiceKit's hitstop off every impact.
Smears
Smears.play(entity, style, opts), per object:
stretch: the object drawn once, stretched back along its motion over the ground it just covered (and thinned across it), while the real one is hidden for those frames (0.06 s).multiples:count(3) ghost copies at the places it just passed, fading towardcolour(a pale blue white), the farthest going first (0.12 s).streaks:count(7) speed lines behind it incolour(a warm white), of random lengths and offsets around its outline (0.16 s).
opts: velocity (m/s; a Smear component on the object measures it when left out), duration, count, length (1), colour, seed, localOnly. Ghosts are temporary, unsynced copies of the object's meshes (its Models and its children's), so they work on any object without setup and are never saved.
The Smear component smears its object whenever it moves faster than minSpeed, at most once per cooldown (0.15 s) so a long fast move smears in beats: style stretchAndStreaks (default), multiplesAndStreaks, stretch, multiples or streaks; count, length, colour; inEdit to see it while moving things by hand.
Photosensitivity
On by default, for every player, and not something a world can turn up:
- At most 3 full-screen flashes in any one second. A flash is any impact that changes most of the screen's brightness:
invert,silhouette,radialBurst(its default flipping form),colourFlipandwhiteFlash. Every flash takes a token from a rolling one-second window on each player's machine (the hits of every player count against the same screen). When the window holds 3, a further flash is downgraded to the radial burst's rays-only form (no brightness flip, the picture kept underneath, at 80 percent) or, withdowngrade = false, dropped. The cap cannot be raised above 3;maxFlashesPerSecondonly lowers it, and 0 turns every flash into the rays-only form. - Never a saturated red screen. The colours that fill large areas (
ink,paper) are held to a saturation of 0.35 by ImpactFrames and, in the shader, to a red share of r+g+b of at most 0.65 (WCAG 2.3.1 counts 0.8 and above as saturated red); the colour flip's red middle band uses the accent held the same way. Saturated accent red is only drawn as rays and lines over part of the frame. - Smears that cover a large area spend from the same budget: a smear of an object filling more than about a third of the screen's height takes a flash token, and is left out when none is left.
- Gentle mode, per player.
ImpactFrames.setSafety({ gentle = true })draws every flash at low contrast, tinted toward the picture, only around the hit (its edges fade out by a third of the screen), at 60 percent strength, twice as long with a gradual fade, and halves the ghosts and lines of smears. Non-flashing styles are softened a little too. - Settings are the player's own.
ImpactFrames.setSafety({ maxFlashesPerSecond = 0..3, gentle = bool })applies on this machine only and is saved in the player's own store (runtime_data.player(...), pathprefs/impactFrames) when they are signed in, so it follows them to the next session;ImpactFrames.safety()reads it. Put a toggle in your settings menu that calls it. The engine's own System settings menu cannot take world settings, so the toggle is the world's to show. - Measured, from what is drawn.
ImpactFrames.flashLog()lists the moment each full-screen flash was laid on this screen and the most that started inside any one second. In the showcase, in play, ten flashing hits landing in the same frame drew 3 flashes (7 became rays), ten hits a tenth of a second apart drew 3, and ten presses of E at the training dummy never drew more than 3 inside any second. The test suite checks the first two on every run. - Measured under heavy load (12 November 2026, showcase, in play, impactFrames 1.0.3 on styleKit 1.7.8): 30 hits of mixed styles in one frame, then 3 hits every frame for four seconds, 144 hits in 5.7 seconds in all, drew 12 full-screen flashes, never more than 3 starting inside any one second (
flashLog().maxInAnySecond= 3: three at the start, then three at 1.04 s, two at 2.09 s and one at 2.35 s, two at 3.16 s and one at 3.53 s). Every other hit was drawn as its non-flashing rays form.
What is not guaranteed: juiceKit's own screen flashes (from a preset you play in onHit) go through juiceKit, not this limiter; turn its flash off in the preset or rely on its reduce-motion setting. Full-screen effects other packages draw are not counted unless they call ImpactFrames.takeFlash().
Multiplayer
ImpactFrames.play on one machine sends one small reliable message (impactFrames.play: the style, the hit's world point or synced entity, the options, the seed and the start time in wall-clock UTC) to every other player in the room. Each machine projects the hit through its own camera, draws the same drawings (same seed) and starts at the same moment: a message that arrives late starts part way into the hit, one that arrives after the hit ended is dropped. delay = 0.08 starts every machine at the same future moment, the sender included, for a hit landing on every screen in the same frame. Call play on ONE machine per hit (where the hit is decided, usually the attacker's owner); localOnly = true keeps it on this screen (a hit only this player feels, a menu preview). Each receiving player's own limiter and gentle setting apply to what they see.
Smears: the Smear component runs on every machine from the object's own motion and sends nothing. Smears.play on a synced object is sent the same way (impactFrames.smear) unless localOnly.
Checked with two players in one play session of the showcase (12 November 2026): a radialBurst played on the first player's machine reached onHit on both machines, a speedBurst played there with localOnly = true reached the first player only, and both machines drew through setLocalEntry (ImpactFrames.mode() = "localEntry"), so nothing of a hit entered the shared stack.
Cost
- Idle. With styleKit 1.7.0 or later nothing of impactFrames is in the stack until a hit plays, and it is taken off when the hit ends: an idle world pays no GPU for it. With an older styleKit one dormant entry sits in the shared stack between hits (see Known limits); its pass leaves at once while no hit shows, but the stack still runs it every frame.
- Active: one full-screen post-process pass per showing impact (one shader for all eight styles), measured in the Anime Looks showcase at 2097 x 1453 on the development machine's GPU at about the cost of a finish pass (0.2 to 0.3 ms there; the scene's own sky pass costs 0.39 ms on the same GPU). The settings are written once per hit, not per drawing.
- Measure on your device:
zero profiler gpuwhile an impact shows (ImpactFrames.play("radialBurst", { screen = { 0.5, 0.5 }, duration = 5, localOnly = true })), the rowpost.sk.impactFrames....
Known limits
- Two copies of styleKit in one world. A game that held an older styleKit when impactFrames was installed keeps that copy, and it goes on drawing the scene's stack; a hit laid through impactFrames' own copy is then never drawn.
ImpactFrames.playnotices (the shared stack holds live entries its own copy draws none of, for more than 3 s), warns once and returns false with the reason, instead of reporting a hit nobody sees. Updating the game's styleKit afterwards, or reinstalling, does not merge the two copies (checked on Summit Sprint, which held styleKit 1.4.4; reported to ZeroMind as 01M77X5XNF6KAJ8TWXWCEB91J4), so update the Style Cookbook packages before installing impactFrames. - A styleKit older than 1.7.0 needs one entry in the shared stack. impactFrames lays its blocks on each machine only with
StyleKit.setLocalEntry, which this world sent to the Style Cookbook as pull request #10 and the Cookbook released in styleKit 1.7.0. On an older styleKit (which has onlysetLocal, settings over an entry already in the shared stack) the first hit adds one dormant entry (impactFrames, drawing nothing between hits) to the scene's stack, and hits are drawn by laying settings over it on each machine;ImpactFrames.prepareStack()adds it ahead of time,ImpactFrames.mode()says which way this world draws. In that mode only one impact shows at a time (the newest). - First hit after an idle spell may land a frame late. With no other look, styleKit starts its render feature on the first impact and releases it after the last.
- Each frame is redone from scratch. A styleKit render feature redoes all its work every frame (engine issue #24548), so an active impact costs its full pass on every frame it shows, held drawing or not.
- A setting written before the shader finishes compiling reads back as the default (engine #22741): the very first hit after the world opens can show with default colours for its first drawing.
- No history, motion vectors or normals. Post effects get no history, velocity or normal inputs (engine issue #17427), so smears are drawn with ghost geometry rather than a screen-space smear along motion vectors, and the silhouette splits subjects by depth or brightness rather than by object.
- Draw order and blending are the stack's. A render feature cannot choose the depth of its pass in the frame or its blend state (engine issues #24550, #24551): impact frames draw after every styleKit block and before the UI, never over the UI and never under a particular block.
- juiceKit's own screen flash is juiceKit's. A juice preset that flashes the screen (its
flashpiece) goes through juiceKit, not this limiter; turn its flash off in the preset, or rely on juiceKit's reduce-motion setting, when it rides along. - The hit point is projected once, when the hit starts; a hit of a few tenths of a second does not follow an entity that moves across the screen during it.
- The held hit pose holds skeletons (the drawn pose of a skinned character); a rigid prop's mesh is not frozen.
- Transparent things and particles are not in the depth, so the depth silhouette treats them as what is behind them.
- Smear ghosts copy
Modelmeshes only. Skinned characters (SkinnedModel) are not copied bystretchandmultiples; usestreakson them, or smear a weapon or limb that is aModel. - A stretched smear relies on a non-uniformly scaled, rotated parent to shear the copy along the motion; it reads correctly for compact objects and loosely for long thin ones moving along their length.
Contents
ImpactFrames(module):play,stop,active,styles,stats,resetStats,onHit,rideJuice,stopRidingJuice,ridingJuice,setSafety,safety,takeFlash,receive,prepareStack,mode,setDryRun,laid,step,ensureDriver.Smears(module):play,noteVelocity,stats,clear,step.Smear(component): smears its object on speed.ImpactFramesDriver(component): the per-frame step, spawned for you on a hidden temporary entity.blocks/: the seven Medium-slot style blocks (impactInvert,impactSilhouette,impactRadialBurst,impactColourFlip,impactSpeedBurst,impactWhiteFlash,impactSlash) on one shader,impactFrame.shader. Each passesStyleKit.checkBlock. (holdPosedraws with the speed burst block, with its own few bold wedges.)tests/impactFrames.testSuite: the limiter, every style playing and ending, a hit laid once on the held clock, riding along with juiceKit, gentle mode, the colour guard, another player's hit starting at its sent moment, and every smear style (impacts as a dry run that draws nothing, so it is safe on any screen;ImpactFrames.setDryRun(true)gives your own tests the same).
Version history
Now 1.1.1 (1.1.1: the inkSplash block ships with its metadata; 1.1.0: a new inkSplash style, a sumi-e frame for a bloodless decisive blow: the picture washed to black ink on paper, a dry brush stroke torn through the hit and, as variant = "splash", a burst of ink with splatter and drops ("stroke" is the stroke alone); ink and paper only, never red; made for takedownKit's ink-splash presentation; 1.0.9: a short description and a lead that says what it gives and how to start, with the history moved here; ImpactFrames.VERSION reports the package's version again (it said 1.0.6); 1.0.8: holdPose frames the frozen character with a few bold wedges, so it no longer looks like speedBurst in the moment of a hit; 1.0.7 moves to styleKit 1.7.9, which costs the engine less per frame; 1.0.6 moved to frameTiming 1.0.3, whose timing any player can set) (on styleKit 1.7.9, the Style Cookbook release of 2026-11-12, which has setLocalEntry, so each impact is laid on each machine with nothing dormant in the shared stack; 1.0.1 added flashLog(), the measured flash count, and its test). Works with any styleKit look (anime, watercolor, pencil, none at all): each impact is a styleKit Medium-slot block laid on each player's machine for the few frames it shows. Built on styleKit (the blocks) and frameTiming (the held hit pose); rides along with juiceKit (the Juicebox kit) when a game uses it, without depending on it.