ApexPainter member
ApexPainter.animate
Published ApexPainter.animate method.
lib-next/apex-painter/main.ts (opens in a new tab)Signature
(frames: Frame[], defaultDuration: number, defaultWidth?: number, defaultHeight?: number, options?: import("../gif/animate-frames.js").AnimateOptions, painterOpts?: PainterAssetRefsOptions) => Promise<Buffer[] | undefined>Parameters
frames
Frame[]
defaultDuration
number
defaultWidth?
number
defaultHeight?
number
options?
painterOpts?
Options
| Option | Type | Contract | Allowed values | Runtime & capabilities |
|---|---|---|---|---|
| frames | ||||
frames.backgroundColorPublished frames.backgroundColor option. | string | OptionalDefault— | — | node22 · node24 · node26 |
frames.blendModePublished frames.blendMode option. | GlobalCompositeOperation | OptionalDefault— | 26 values"color" "color-burn" "color-dodge" "copy" "darken" "destination-atop" "destination-in" "destination-out" "destination-over" "difference" "exclusion" "hard-light" "hue" "lighten" "lighter" "luminosity" "multiply" "overlay" "saturation" "screen" "soft-light" "source-atop" "source-in" "source-out" "source-over" "xor" | node22 · node24 · node26 |
frames.durationPublished frames.duration option. | number | OptionalDefault— | — | node22 · node24 · node26 |
frames.gradientPublished frames.gradient option. | GradientConfig | OptionalDefault— | — | node22 · node24 · node26 |
frames.gradient.anglePublished frames.gradient.angle option. | number | OptionalDefault— | — | node22 · node24 · node26 |
frames.gradient.centerXPublished frames.gradient.centerX option. | number | OptionalDefault— | — | node22 · node24 · node26 |
frames.gradient.centerYPublished frames.gradient.centerY option. | number | OptionalDefault— | — | node22 · node24 · node26 |
frames.gradient.colorsPublished frames.gradient.colors option. | { stop: number; color: string; }[] | RequiredDefaultRequired | — | node22 · node24 · node26 |
frames.gradient.colors.colorPublished frames.gradient.colors.color option. | string | RequiredDefaultRequired | — | node22 · node24 · node26 |
frames.gradient.colors.stopPublished frames.gradient.colors.stop option. | number | RequiredDefaultRequired | — | node22 · node24 · node26 |
frames.gradient.endRadiusPublished frames.gradient.endRadius option. | number | OptionalDefault— | — | node22 · node24 · node26 |
frames.gradient.endXPublished frames.gradient.endX option. | number | OptionalDefault— | — | node22 · node24 · node26 |
frames.gradient.endYPublished frames.gradient.endY option. | number | OptionalDefault— | — | node22 · node24 · node26 |
frames.gradient.repeatPublished frames.gradient.repeat option. | "repeat" | "reflect" | "no-repeat" | OptionalDefault— | "repeat" "reflect" "no-repeat" | node22 · node24 · node26 |
frames.gradient.startAnglePublished frames.gradient.startAngle option. | number | OptionalDefault— | — | node22 · node24 · node26 |
frames.gradient.startRadiusPublished frames.gradient.startRadius option. | number | OptionalDefault— | — | node22 · node24 · node26 |
frames.gradient.startXPublished frames.gradient.startX option. | number | OptionalDefault— | — | node22 · node24 · node26 |
frames.gradient.startYPublished frames.gradient.startY option. | number | OptionalDefault— | — | node22 · node24 · node26 |
frames.gradient.typePublished frames.gradient.type option. | "linear" | "radial" | "conic" | RequiredDefaultRequired | "linear" "radial" "conic" | node22 · node24 · node26 |
frames.heightPublished frames.height option. | number | OptionalDefault— | — | node22 · node24 · node26 |
frames.onDrawCustomPublished frames.onDrawCustom option. | (ctx: SKRSContext2D, canvas: Canvas) => void | OptionalDefault— | — | node22 · node24 · node26 |
frames.patternPublished frames.pattern option. | { source: string; repeat?: "repeat" | "no-repeat" | "repeat-x" | "repeat-y"; } | OptionalDefault— | — | node22 · node24 · node26 |
frames.pattern.repeatPublished frames.pattern.repeat option. | "repeat" | "no-repeat" | "repeat-x" | "repeat-y" | OptionalDefault— | "repeat" "no-repeat" "repeat-x" "repeat-y" | node22 · node24 · node26 |
frames.pattern.sourcePublished frames.pattern.source option. | string | RequiredDefaultRequired | — | node22 · node24 · node26 |
frames.sourcePublished frames.source option. | string | OptionalDefault— | — | node22 · node24 · node26 |
frames.transformationsPublished frames.transformations option. | { scaleX?: number; scaleY?: number; rotate?: number; translateX?: number; translateY?: number; } | OptionalDefault— | — | node22 · node24 · node26 |
frames.transformations.rotatePublished frames.transformations.rotate option. | number | OptionalDefault— | — | node22 · node24 · node26 |
frames.transformations.scaleXPublished frames.transformations.scaleX option. | number | OptionalDefault— | — | node22 · node24 · node26 |
frames.transformations.scaleYPublished frames.transformations.scaleY option. | number | OptionalDefault— | — | node22 · node24 · node26 |
frames.transformations.translateXPublished frames.transformations.translateX option. | number | OptionalDefault— | — | node22 · node24 · node26 |
frames.transformations.translateYPublished frames.transformations.translateY option. | number | OptionalDefault— | — | node22 · node24 · node26 |
frames.widthPublished frames.width option. | number | OptionalDefault— | — | node22 · node24 · node26 |
| options | ||||
options.gifPublished options.gif option. | boolean | OptionalDefault— | false true | node22 · node24 · node26 |
options.gifPathPublished options.gifPath option. | string | OptionalDefault— | — | node22 · node24 · node26 |
options.onEndPublished options.onEnd option. | () => void | OptionalDefault— | — | node22 · node24 · node26 |
options.onFramePublished options.onFrame option. | (index: number) => void | OptionalDefault— | — | node22 · node24 · node26 |
options.onStartPublished options.onStart option. | () => void | OptionalDefault— | — | node22 · node24 · node26 |
options.signalPublished options.signal option. | AbortSignal | OptionalDefault— | — | node22 · node24 · node26 |
| painterOpts | ||||
painterOpts.resolveAssetRefsWhen **true**, string leaves in the payload are resolved via {@link AssetManager.resolve } (same rules as {@link ApexPainter.prepareForRender } / {@link ApexPainter.renderScene }). | boolean | OptionalDefault— | false true | node22 · node24 · node26 |
frames.backgroundColor
OptionalPublished frames.backgroundColor option.
- Type
string- Default
- —
- Allowed
- —
- Runtime
- node22, node24, node26
frames.blendMode
OptionalPublished frames.blendMode option.
- Type
GlobalCompositeOperation- Default
- —
- Allowed
26 values
"color""color-burn""color-dodge""copy""darken""destination-atop""destination-in""destination-out""destination-over""difference""exclusion""hard-light""hue""lighten""lighter""luminosity""multiply""overlay""saturation""screen""soft-light""source-atop""source-in""source-out""source-over""xor"- Runtime
- node22, node24, node26
frames.duration
OptionalPublished frames.duration option.
- Type
number- Default
- —
- Allowed
- —
- Runtime
- node22, node24, node26
frames.gradient
OptionalPublished frames.gradient option.
- Type
GradientConfig- Default
- —
- Allowed
- —
- Runtime
- node22, node24, node26
frames.gradient.angle
OptionalPublished frames.gradient.angle option.
- Type
number- Default
- —
- Allowed
- —
- Runtime
- node22, node24, node26
frames.gradient.centerX
OptionalPublished frames.gradient.centerX option.
- Type
number- Default
- —
- Allowed
- —
- Runtime
- node22, node24, node26
frames.gradient.centerY
OptionalPublished frames.gradient.centerY option.
- Type
number- Default
- —
- Allowed
- —
- Runtime
- node22, node24, node26
frames.gradient.colors
RequiredPublished frames.gradient.colors option.
- Type
{ stop: number; color: string; }[]- Default
- Required
- Allowed
- —
- Runtime
- node22, node24, node26
frames.gradient.colors.color
RequiredPublished frames.gradient.colors.color option.
- Type
string- Default
- Required
- Allowed
- —
- Runtime
- node22, node24, node26
frames.gradient.colors.stop
RequiredPublished frames.gradient.colors.stop option.
- Type
number- Default
- Required
- Allowed
- —
- Runtime
- node22, node24, node26
frames.gradient.endRadius
OptionalPublished frames.gradient.endRadius option.
- Type
number- Default
- —
- Allowed
- —
- Runtime
- node22, node24, node26
frames.gradient.endX
OptionalPublished frames.gradient.endX option.
- Type
number- Default
- —
- Allowed
- —
- Runtime
- node22, node24, node26
frames.gradient.endY
OptionalPublished frames.gradient.endY option.
- Type
number- Default
- —
- Allowed
- —
- Runtime
- node22, node24, node26
frames.gradient.repeat
OptionalPublished frames.gradient.repeat option.
- Type
"repeat" | "reflect" | "no-repeat"- Default
- —
- Allowed
"repeat""reflect""no-repeat"- Runtime
- node22, node24, node26
frames.gradient.startAngle
OptionalPublished frames.gradient.startAngle option.
- Type
number- Default
- —
- Allowed
- —
- Runtime
- node22, node24, node26
frames.gradient.startRadius
OptionalPublished frames.gradient.startRadius option.
- Type
number- Default
- —
- Allowed
- —
- Runtime
- node22, node24, node26
frames.gradient.startX
OptionalPublished frames.gradient.startX option.
- Type
number- Default
- —
- Allowed
- —
- Runtime
- node22, node24, node26
frames.gradient.startY
OptionalPublished frames.gradient.startY option.
- Type
number- Default
- —
- Allowed
- —
- Runtime
- node22, node24, node26
frames.gradient.type
RequiredPublished frames.gradient.type option.
- Type
"linear" | "radial" | "conic"- Default
- Required
- Allowed
"linear""radial""conic"- Runtime
- node22, node24, node26
frames.height
OptionalPublished frames.height option.
- Type
number- Default
- —
- Allowed
- —
- Runtime
- node22, node24, node26
frames.onDrawCustom
OptionalPublished frames.onDrawCustom option.
- Type
(ctx: SKRSContext2D, canvas: Canvas) => void- Default
- —
- Allowed
- —
- Runtime
- node22, node24, node26
frames.pattern
OptionalPublished frames.pattern option.
- Type
{ source: string; repeat?: "repeat" | "no-repeat" | "repeat-x" | "repeat-y"; }- Default
- —
- Allowed
- —
- Runtime
- node22, node24, node26
frames.pattern.repeat
OptionalPublished frames.pattern.repeat option.
- Type
"repeat" | "no-repeat" | "repeat-x" | "repeat-y"- Default
- —
- Allowed
"repeat""no-repeat""repeat-x""repeat-y"- Runtime
- node22, node24, node26
frames.pattern.source
RequiredPublished frames.pattern.source option.
- Type
string- Default
- Required
- Allowed
- —
- Runtime
- node22, node24, node26
frames.source
OptionalPublished frames.source option.
- Type
string- Default
- —
- Allowed
- —
- Runtime
- node22, node24, node26
frames.transformations
OptionalPublished frames.transformations option.
- Type
{ scaleX?: number; scaleY?: number; rotate?: number; translateX?: number; translateY?: number; }- Default
- —
- Allowed
- —
- Runtime
- node22, node24, node26
frames.transformations.rotate
OptionalPublished frames.transformations.rotate option.
- Type
number- Default
- —
- Allowed
- —
- Runtime
- node22, node24, node26
frames.transformations.scaleX
OptionalPublished frames.transformations.scaleX option.
- Type
number- Default
- —
- Allowed
- —
- Runtime
- node22, node24, node26
frames.transformations.scaleY
OptionalPublished frames.transformations.scaleY option.
- Type
number- Default
- —
- Allowed
- —
- Runtime
- node22, node24, node26
Published frames.transformations.translateX option.
- Type
number- Default
- —
- Allowed
- —
- Runtime
- node22, node24, node26
Published frames.transformations.translateY option.
- Type
number- Default
- —
- Allowed
- —
- Runtime
- node22, node24, node26
frames.width
OptionalPublished frames.width option.
- Type
number- Default
- —
- Allowed
- —
- Runtime
- node22, node24, node26
options.gif
OptionalPublished options.gif option.
- Type
boolean- Default
- —
- Allowed
falsetrue- Runtime
- node22, node24, node26
options.gifPath
OptionalPublished options.gifPath option.
- Type
string- Default
- —
- Allowed
- —
- Runtime
- node22, node24, node26
options.onEnd
OptionalPublished options.onEnd option.
- Type
() => void- Default
- —
- Allowed
- —
- Runtime
- node22, node24, node26
options.onFrame
OptionalPublished options.onFrame option.
- Type
(index: number) => void- Default
- —
- Allowed
- —
- Runtime
- node22, node24, node26
options.onStart
OptionalPublished options.onStart option.
- Type
() => void- Default
- —
- Allowed
- —
- Runtime
- node22, node24, node26
options.signal
OptionalPublished options.signal option.
- Type
AbortSignal- Default
- —
- Allowed
- —
- Runtime
- node22, node24, node26
painterOpts.resolveAssetRefs
OptionalWhen **true**, string leaves in the payload are resolved via {@link AssetManager.resolve } (same rules as {@link ApexPainter.prepareForRender } / {@link ApexPainter.renderScene }).
- Type
boolean- Default
- —
- Allowed
falsetrue- Runtime
- node22, node24, node26
Types
Frame[]
- variant 1
Frame: Frame- backgroundColor?
string - gradient?
GradientConfig: GradientConfig- type
"linear" | "radial" | "conic"- variant 1
"linear" - variant 2
"radial" - variant 3
"conic"
- variant 1
- startX?
number - startY?
number - endX?
number - endY?
number - startRadius?
number - endRadius?
number - angle?
number - centerX?
number - centerY?
number - startAngle?
number - repeat?
"repeat" | "reflect" | "no-repeat"- variant 1
"repeat" - variant 2
"reflect" - variant 3
"no-repeat"
- variant 1
- colors
{ stop: number; color: string; }[]- variant 1
__type: { stop: number; color: string; }- stop
number - color
string
- stop
- variant 1
- type
- pattern?
__type: { source: string; repeat?: "repeat" | "no-repeat" | "repeat-x" | "repeat-y"; }- source
string - repeat?
"repeat" | "no-repeat" | "repeat-x" | "repeat-y"- variant 1
"repeat" - variant 2
"no-repeat" - variant 3
"repeat-x" - variant 4
"repeat-y"
- variant 1
- source
- source?
string - blendMode?
GlobalCompositeOperation- variant 1
"color" - variant 2
"color-burn" - variant 3
"color-dodge" - variant 4
"copy" - variant 5
"darken" - variant 6
"destination-atop" - variant 7
"destination-in" - variant 8
"destination-out" - variant 9
"destination-over" - variant 10
"difference" - variant 11
"exclusion" - variant 12
"hard-light" - variant 13
"hue" - variant 14
"lighten" - variant 15
"lighter" - variant 16
"luminosity" - variant 17
"multiply" - variant 18
"overlay" - variant 19
"saturation" - variant 20
"screen" - variant 21
"soft-light" - variant 22
"source-atop" - variant 23
"source-in" - variant 24
"source-out" - variant 25
"source-over" - variant 26
"xor"
- variant 1
- transformations?
__type: { scaleX?: number; scaleY?: number; rotate?: number; translateX?: number; translateY?: number; }- scaleX?
number - scaleY?
number - rotate?
number - translateX?
number - translateY?
number
- scaleX?
- duration?
number - width?
number - height?
number - onDrawCustom?
(ctx: SKRSContext2D, canvas: Canvas) => void
- backgroundColor?
AnimateOptions: AnimateOptions
- gif?
boolean - gifPath?
string - onStart?
() => void - onFrame?
(index: number) => void - onEnd?
() => void - signal?
AbortSignal
PainterAssetRefsOptions: PainterAssetRefsOptions
- resolveAssetRefs?
boolean
Return value
Promise<Buffer<ArrayBufferLike>[]>
The return contract is generated from the packed declaration. Async wrappers and nullable/undefined variants remain visible in the type model.
Errors
NOT APPLICABLE — no verified errors are bound to this API.
Limits
NOT APPLICABLE — no API-specific verified limits are bound to this API.
Related APIs
No explicit related API metadata.