Sprites.Media.Sprite.Frames
The animation frames: add, delete and step through the frames of the sprite. Window is an independent floating window, shown while its own flag is true, so it can be open in any combination with the other panels, and it carries a close button. Its buttons are Add, Delete, Previous and Next, stand-ins for now until the frame actions land. The Windows buttons that open it, the selector and the Tools window live in Sprites.Media.Sprite.Tool.
- Sprites.Media.Sprite.Frames.Preview
- Sprites.Media.Sprite.Frames.Card
- Sprites.Media.Sprite.Frames.Strip
- Sprites.Media.Sprite.Frames.Buttons
- Sprites.Media.Sprite.Frames.Window
Sprites.Media.Sprite.Frames.Preview Void
Sprites.Media.Sprite.Frames.Preview(thumb)
One frame's thumbnail preview: a small fixed square on a white ground, holding the frame's visible layers flattened and drawn to fit. The image scales to contain the thumbnail, keeps its pixels crisp, and rounds its corners.
| Input | Type | Description |
|---|---|---|
thumb | String or Sprites.Reactive.Value | The frame's PNG data URL, which the image follows. |
Returns nothing.
const frame = Sprites.Media.Sprite.NewFrame(16, 16);
const thumb = Sprites.Media.Sprite.FrameThumbnail(frame, 16, 16, undefined, 1);
Sprites.Media.Sprite.Frames.Preview(thumb);
Sprites.Media.Sprite.Frames.Card Void
Sprites.Media.Sprite.Frames.Card(frame, index, width, height, optionalSlots, aspect)
One frame card: a selectable thumbnail option, so a click selects the frame and the selected card darkens like a button group. It builds the frame's flattened thumbnail and shows it inside the option.
| Input | Type | Description |
|---|---|---|
frame | Sprites.Reactive.Value | The frame value, its layers flattened for the thumbnail. |
index | Number | The frame's position in the frames list, the option's value. |
width | Number or Sprites.Reactive.Value | The document width, for the thumbnail. |
height | Number or Sprites.Reactive.Value | The document height, for the thumbnail. |
optionalSlots | Array or Sprites.Reactive.Value | The slot colours for an indexed sprite, or absent for freeform. |
aspect | Number or Sprites.Reactive.Value | The pixel aspect baked into the thumbnail. |
Returns nothing.
const frame = Sprites.Media.Sprite.NewFrame(16, 16);
const selected = Sprites.Reactive.Value(0);
Sprites.Ui.Button.Select(selected, () => {
Sprites.Media.Sprite.Frames.Card(frame, 0, 16, 16, undefined, 1);
});
Sprites.Media.Sprite.Frames.Strip Void
Sprites.Media.Sprite.Frames.Strip(frames, selectedFrame, width, height, optionalSlots, aspect)
The scrolling strip of frame cards: a select over the selected frame so exactly one card darkens, and an each over the frames in play order, laid in a row that scrolls left and right.
| Input | Type | Description |
|---|---|---|
frames | Sprites.Reactive.Value | The frames list, drawn in play order. |
selectedFrame | Sprites.Reactive.Value | The two way pick, the card that darkens. |
width | Number or Sprites.Reactive.Value | The document width, for each thumbnail. |
height | Number or Sprites.Reactive.Value | The document height, for each thumbnail. |
optionalSlots | Array or Sprites.Reactive.Value | The slot colours for an indexed sprite, or absent for freeform. |
aspect | Number or Sprites.Reactive.Value | The pixel aspect baked into each thumbnail. |
Returns nothing.
const first = { layers: [ { pixels: [], visible: true } ] };
const second = { layers: [ { pixels: [], visible: true } ] };
const frames = Sprites.Reactive.Value([first, second]);
const selectedFrame = Sprites.Reactive.Value(0);
Sprites.Media.Sprite.Frames.Strip(frames, selectedFrame, 16, 16, undefined, 1);
Sprites.Media.Sprite.Frames.Window Void
Sprites.Media.Sprite.Frames.Window(visible, frames, selectedFrame, frameIndex, width, height, optionalSlots, aspect)
The Frames panel's window: a floating panel of Add, Delete, Previous and Next, shown while visible is true, with a close button that clears visible. The buttons are stand-ins for now, each doing nothing until the frame actions land.
| Input | Type | Description |
|---|---|---|
visible | Sprites.Reactive.Value | Shows the window while true. |
Returns nothing.
const visible = Sprites.Reactive.Value(false);
Sprites.Ui.Button.SetValue(visible, true, 'Open Frames window');
Sprites.Media.Sprite.Frames.Window(visible);