ssplayer_flame library

Flame adapter for ssplayer_flutter.

Adds a Layer-4 drawing adapter, SpriteStudioComponent, that plays a SpriteStudio .ssab inside a FlameGame, and a button made of one, SpriteStudioButtonComponent. It reuses the whole ssplayer_flutter player (L3 transport + L2 draw engine) in externally-clocked mode, so Flame's game loop supplies the time.

Everything else — the raw .ssab API, SpriteStudioPlayer, textures — comes from package:ssplayer_flutter/ssplayer_flutter.dart, which this package re-exports for convenience.

Classes

BlendPass
One pass of a reconstructed framebuffer blend: a stock ui.BlendMode plus what the draw should put through it.
DrawFrame
Per-frame draw inputs bundled for the geometry builders.
EffectPart
A part that hosts a particle effect, as declared in the static .ssab.
EffectSlots
Owns one EffectSlot per effect part and their per-frame draw plans.
GeometryBuilder
Bakes the Brain's SoA buffers into ui.Vertices for Canvas.drawVertices.
InstanceChild
The child-player surface InstanceSlots drives.
InstancePackLoadResult
The packs an animation's instance parts need, plus what went missing.
InstancePart
A part that plays another animation in-place, as declared in the static .ssab.
InstanceSlot<T extends InstanceChild>
One instance part's live state: its Brain-side slot and the child player it drives.
InstanceSlots<T extends InstanceChild>
Owns one InstanceSlot + child player per instance part.
MaskBits
One target's resolved mask test: which writers apply to it, and with what polarity.
MaskComposition
The mask settings an instance part hands to the sub-animation it calls.
MaskPartFlags
The static, per-part mask flags — read once from the .ssab PartData and never re-read per frame (PartData is static, FrameData is animated).
MaskPlan
The frame's mask plan: which parts write coverage, the box the coverage bitmap spans, and the per-target scope resolution.
MaskWriter
One coverage-bitmap writer for the current frame.
MeshBuffers
The Brain's mesh SoA for one frame, bundled for DrawFrame.
MeshGeometry
A baked, ready-to-draw vertex block — the inspectable form of what GeometryBuilder.buildMeshParts hands to Canvas.drawVertices.
PartColor
A part's resolved PartColor: the shader-side blend coefficient row plus the four corner colours (lt,rt,lb,rb).
PartColorCorner
One corner's PartColor sample: a straight-alpha colour in 0..1 plus the blend rate (composite strength).
PartColorQuad
Per-part quad + affine map for the PartColor shader path.
PartNameTable
Pack-level part query table, read once from the .ssab PartData list: part names ↔ indices, plus the static per-part skinned-mesh flag.
PartShader
A part's resolved shader attribute (SHDR): which built-in id to run and the parameters to run it with.
ShapeBuffers
The Brain's shape SoA for one frame, bundled for DrawFrame.
SpriteStudioAnimation
Layer 4 — an animation you place, with nothing to own.
SpriteStudioButtonComponent
A SpriteStudioComponent that is a button: one animation shows its states, as SpriteStudioStateView does for a Flutter button.
SpriteStudioComponent
Layer 4 — the Flame drawing adapter (sibling to the Widget-based SpriteStudioView).
SpriteStudioInternalPlayer
Layer 2 — the Widget-agnostic drawing engine (ports the SDK's SSInternalPlayer).
SpriteStudioPartAnchor
Sticks child to a SpriteStudio part so it tracks that part's position, rotation and scale every frame — the Flutter-idiomatic form of ForUnity's part tracker and ForGodot's part attachment. Where those engines drive a scene-graph node, this drives a Widget: it reads the part's pose from player and wraps child in a Transform.
SpriteStudioPlayer
Layer 3 — the user-facing controller (ports the SDK's SSPlayer).
SpriteStudioRenderBox
The render object behind SpriteStudioView: sizes the box, hands the fit to the player, and paints it. Use the widget unless you are composing render objects yourself.
SpriteStudioView
Layer 4 — the default drawing adapter.
SsAnimeInfo
Read-only metadata about a .ssab animation pack, parsed directly from the bytes via the Dart FlatBuffers accessors.
SsAudioEvent
An Audio trigger. SpriteStudio audio is trigger-only: this hands you the sound to play (by name and/or hash) plus its loop count, and your app plays it with whatever audio stack it likes — the player never produces sound itself.
SsDevChannel
The in-app end of the SpriteStudio dev push channel.
SsInstanceLoader
Fetches the external .ssab packs referenced by an animation's instance parts — the async half of the instance path.
SsLiveReloadTarget
A live-reload target the SsDevChannel can hot-swap: the current pack of one on-screen SpriteStudioPlayer, with a say in when to take a push and what to do after one. Implemented by the SsLiveReload mixin.
SsPartQuad
A part's outline as drawn: four corners in the space SpriteStudioPlayer.partTransform reports, measured from the centre of the view's box.
SsPlacement
How a view fits the animation into its box: which box (frame), how it is scaled (fit) and where it lands (alignment).
SsRootTransform
The player-level flip / offset / scale — what a player draws, mirrored, scaled and shifted, with nothing else moved.
SsSignal
A Signal event — a named command with typed parameters. Only active signals are surfaced (an inactive one is skipped, matching the sibling players).
SsSignalParam
One parameter of an SsSignal. value is the decoded union payload — a bool, int, double, String, or null for a valueless parameter.
SsTextureLoader
Loads a .ssab's cellmap textures into a TextureRegistry, supporting BOTH texture-supply modes (like SSPlayerForWeb):
SsUiClip
What a state plays instead of the label named after it: the section of animation that starts at label.
SsUserData
A UserData marker the animator placed on a part's timeline, surfaced as playback crosses its frame. Every payload field is optional — a marker carries whichever ones were authored (an integer, a rectangle, a point, a string, or any combination).
TextureLoadReport
Result of a texture-load pass: cellmap image paths that could not be resolved (neither embedded nor found as an asset). Empty on full success.
TextureRegistry
Texture store for the Player: a cellmap texture hash → decoded ui.Image map, plus a cached identity ui.ImageShader per image for drawVertices. Mirrors the sibling ports' hash-keyed texture map (Godot _textures, Web IResourceManager.getTexture, Unity material map).

Enums

BlendPassSource
What one pass of a blendPassesFor plan actually draws.
SpriteStudioAnchorHidden
What a SpriteStudioPartAnchor does with its child when the tracked part is hidden on the current frame (its keyframe hide, or a visibility override).
SpriteStudioAnchorMirror
What a SpriteStudioPartAnchor does with its child when the player is flipped (SpriteStudioPlayer.flipX / SpriteStudioPlayer.flipY).
SpriteStudioBackend
Selects which L2 render backend a SpriteStudioView drives.
SsBlendOp
Blend operation of a per-part colour override. The four values are the same set the authored PartColor uses, and value is the wire encoding the C-API expects — anything ≥ 4 is rejected by the Brain rather than clamped to Mix (unlike the keyframe PartColor path, which clamps defensively).
SsOverridePriority
Keyframe-vs-override precedence for the two attributes that can conflict with the animation — colour and cell.
SsPlaybackDirection
Which way the playhead walks the animation.
SsPlaybackStyle
What happens when the playhead reaches the far end of the range.
SsShaderId
One of SpriteStudio's built-in integration shaders (ss-*), the effects a part carries through its SHDR attribute.
SsTrackBlend
How a track folds onto the pose the tracks below it produced.
SsTrackSync
Where the animations laid on a track start.
SsUiState
A state a SpriteStudio button shows. By default each plays from the label of the same name in one animation, up to the frame before the next label.

Mixins

SsLiveReload<T extends StatefulWidget>
Wires SpriteStudio dev live-reload into a State: registers this player's current pack with the VM-Service dev push channel (SsDevChannel) so the sswatch host runner can hot-swap it in place — playhead / animation / play state preserved (SpriteStudioPlayer.reload) — on desktop, device and (in flutter run -d chrome debug, via DWDS) the web alike, with no r and the IDE debugger left attached.

Constants

kMaskSeqEnd → const int
MaskWriter.close of a clipping writer: the end of the tree sequence. A clipping writer keeps clipping everything drawn after it, out through every instance that encloses it, to the end of the top-level animation.
kMaxMaskWriters → const int
Maximum mask writers honoured in one frame, across the whole instance tree.
noCutoutThreshold → const double
MaskWriter.threshold for a writer that has no texel to cut out — a Shape (the shape special case), whose whole polygon is the mask. Below every possible alpha, so nothing is ever thresholded away (ForGodot's sentinel too).
ssLiveReloadDefine → const String
The --dart-define key that opts an app into SpriteStudio .ssab live-reload. sswatch --run injects =true; the in-app channel (SsDevChannel) comes up only in a debug build that carries it, so a plain flutter run does normal Dart hot reload without touching the art. Shared by sswatch (the injector) and the channel (the reader) so the key can't drift.

Functions

blendModeFor(BlendType type) → BlendMode
Framebuffer blend mapping: the Paint.blendMode used for a batch's drawVertices / peeled drawPath.
blendPassesFor(BlendType type) → List<BlendPass>
The stock-ui.BlendMode passes that realise type over one part's geometry, in order. All but two modes are a single pass — blendModeFor.
drawTexturedPass(Canvas canvas, Vertices vertices, BlendPass pass, Shader? texture, {ColorFilter? tint, Shader? maskedOut, Rect? bounds, required Paint paint, required Paint layerPaint}) → void
Draws one pass of a blendPassesFor plan as a textured drawVertices: vertices sampling texture (the atlas's ImageShader), with tint — a peeled Mesh part's whole-part PartColor — unless the pass brings a filter of its own.
effectBlendModeFor(int blend) → BlendMode
Framebuffer blend mapping for an EffectDrawCommand.blend.
loadSsRuntime([String? moduleUrl]) → Future<void>
No-op on native: the Brain is a native asset the @Native bindings resolve eagerly. Exposed so the public barrel offers the same symbol as the web backend, where it asynchronously loads the wasm module before first use.
packRgba(Color color) → int
Packs a Flutter ui.Color into the 0xRRGGBBAA the override C-API expects.
partColorCoef(BlendType type) → List<double>
Shader-side PartColor coefficient row for type: the _PartColorCoef table (fSrc, fDst, fDstSrc/mulFlag, 0). The partcolor.frag shader combines it with the per-fragment rate into varg = (1 + fSrc·rate, fDst·rate, fDstSrc, pma) and evaluates pixel·varg.x + mix(1, pixel, varg.z)·color·varg.y.

Typedefs

SsAudioCallback = void Function(SsAudioEvent audio)
Signature for SpriteStudioPlayer.onAudio.
SsCornerColors = ({Color leftBottom, Color leftTop, Color rightBottom, Color rightTop})
The four corner colours of a gradient override, in one value.
SsEventCallback = void Function(List<int> passedEventIndices)
Callback for frame-accurate events surfaced from the ssab.
SsPassedEvents = ({List<SsAudioEvent> audios, List<SsSignal> signals, List<SsUserData> userData})
The UserData / Signal / Audio events crossed on one advance, decoded from the pack. Returned by SsAnimeInfo.decodePassedEvents and dispatched per-event by SpriteStudioPlayer.
SsSignalCallback = void Function(SsSignal signal)
Signature for SpriteStudioPlayer.onSignal.
SsUserDataCallback = void Function(SsUserData userData)
Signature for SpriteStudioPlayer.onUserData.