Skip to content
pixi-silk
GitHub repository
Class

IslandFrame

import { IslandFrame } from 'pixi-silk/ui/island';

Bands along the edges of the viewport with a rounded window cut out of them. The canvas reads as a device with a bezel, and the app as the screen inside it. A band can be a side rail of icons, a thin bezel, or nothing. Bands spring to new sizes with IslandFrame.setBands.

inner is the window as a signal. Pass it as the viewport of a SmartContainer to lay the game out inside it, and as the viewport of an Island to grow islands out of the bezel.

Bands are plain rectangles (the fast path of the shader) and each inner corner is one small shape, so a frame costs little however big the canvas. Use an opaque colour: the bands overlap where they meet.

Example#

import { IslandFrame } from 'pixi-silk/ui/island';
import { SmartContainer } from 'pixi-silk/ui/layout';

const frame = new IslandFrame({ viewport: app, bands: { left: 64, top: 8, right: 8, bottom: 8 } });
const game = new SmartContainer({ viewport: frame.inner });

app.stage.addChild(game, frame);

Extends#

  • Container

Constructors#

Constructor#

new IslandFrame(options?: IslandFrameOptions): IslandFrame;

Parameters#

ParameterType
optionsIslandFrameOptions

Returns#

IslandFrame

Overrides#

Container.constructor

Properties#

PropertyModifierTypeDescriptionDefined in
innerreadonlyReadSignal<IslandRect>The content window inside the bands, in the parent’s space.packages/pixi-silk/src/ui/island/frame.ts:76
railreadonly| { end: IslandStack; side: IslandEdge; start: IslandStack; } | nullThe rail built from rail, if any.packages/pixi-silk/src/ui/island/frame.ts:78

Accessors#

bands#

Get Signature#

get bands(): Required<IslandInsets>;

Where the bands are heading, local units.

Returns

Required<IslandInsets>


radius#

Get Signature#

get radius(): number;

Radius of the inner corners, local units. Setting it redraws at once.

Returns

number

Set Signature#

set radius(value: number): void;
Parameters
ParameterType
valuenumber
Returns

void

Methods#

bandRect()#

bandRect(side: IslandEdge): IslandRect;

The band of one side right now, in the parent’s space.

Parameters#

ParameterType
sideIslandEdge

Returns#

IslandRect


destroy()#

destroy(options?: DestroyOptions): void;

Removes all internal references and listeners as well as removes children from the display list. Do not use a Container after calling destroy.

Parameters#

ParameterTypeDescription
options?DestroyOptionsOptions parameter. A boolean will act as if all options have been set to that value

Returns#

void

Example#

container.destroy();
container.destroy(true);
container.destroy({ children: true });
container.destroy({ children: true, texture: true, textureSource: true });

Overrides#

Container.destroy

setBands()#

setBands(bands: IslandInsets, instant?: boolean): this;

Springs the given bands to new thicknesses. instant jumps there.

Parameters#

ParameterTypeDefault value
bandsIslandInsetsundefined
instantbooleanfalse

Returns#

this


setViewport()#

setViewport(source: IslandViewport | null): this;

Follows a new viewport and redraws. null stops following.

Parameters#

ParameterType
sourceIslandViewport | null

Returns#

this


tick()#

tick(dt: number): boolean;

Advances the animation by dt seconds (for ticker: null). Returns true while it moves.

Parameters#

ParameterType
dtnumber

Returns#

boolean