GIF Elements
GIF elements add animated GIF assets to a project. The hosted API accepts GIFs as media-like visual elements, including timing, transform, resize, zoom, crop, filters, and chroma key options.
Interface
interface GIFItem {
type: "GIF";
src: string;
x?: number;
y?: number;
width?: number;
height?: number;
anchor?: Anchor;
position?: PositionPreset;
resize?: "contain" | "cover";
enterBegin?: number;
enterEnd?: number;
exitBegin?: number;
exitEnd?: number;
track?: number;
opacity?: number;
angle?: number;
flipV?: boolean;
flipH?: boolean;
enterAnimation?: XFadeEffect | null;
exitAnimation?: XFadeEffect | null;
filter?: FilterOptions;
cropParams?: CropParams;
chromaKey?: ChromaKey;
zoom?: boolean;
}
Required Fields
| Property | Type | Notes |
|---|---|---|
type | "GIF" | Case-insensitive in API validation. |
src | string | Remote http or https URL. |
Common Property Reference
| Property | Quick notes | Full reference |
|---|---|---|
position | Preset placement such as center-center. | PositionPreset |
anchor | Transform origin for placement and rotation. | Anchor |
resize | contain or cover. | ResizeMode |
zoom | Center-based zoom during visible duration. | zoom |
filter | Brightness, contrast, blur, tint, and related effects. | FilterOptions |
cropParams | Pixel crop rectangle. | CropParams |
chromaKey | Remove pixels matching a color. | ChromaKey |
| animations | Enter and exit xfade effects. | XFadeEffect |
Properties
GIF supports the same common visual timing and transform properties as images:
x,y,width,heightposition,anchor,resizeenterBegin,enterEnd,exitBegin,exitEndtrack,opacity,angle,flipV,flipHenterAnimation,exitAnimationzoom
It also accepts filter, cropParams, and chromaKey.
Examples
Simple GIF
{
"type": "GIF",
"src": "https://media.giphy.com/media/3oEjI6SIIHBdRxXI40/giphy.gif",
"position": "center-center",
"track": 10
}
Resized GIF
{
"type": "GIF",
"src": "https://media.giphy.com/media/3oEjI6SIIHBdRxXI40/giphy.gif",
"width": 300,
"height": 300,
"resize": "contain",
"position": "bottom-right",
"opacity": 0.8
}
Cropped GIF
{
"type": "GIF",
"src": "https://media.giphy.com/media/3oEjI6SIIHBdRxXI40/giphy.gif",
"width": 300,
"height": 200,
"cropParams": {
"x": 50,
"y": 25,
"width": 400,
"height": 300
}
}