Skip to main content

LensStudio:Ui.Movie

Class

Represents an animated movie or video file.

Index

Example

export class MoviePanel extends PanelPlugin {
connections: any[];
static descriptor() {
const d = new Descriptor();
d.id = 'com.docs.UiMovieExample';
d.name = 'Movie Example';
d.defaultDockState = DockState.Detached;
d.defaultSize = new Size(350, 300);
return d;
}
constructor(pluginSystem: Editor.PluginSystem, descriptor?: Descriptor) {
super(pluginSystem, descriptor);
this.connections = [];
}
createWidget(parent: Widget): Widget {
const root = new Widget(parent);
const layout = new BoxLayout();
layout.setDirection(Direction.TopToBottom);
layout.spacing = 8;
root.layout = layout;

const title = new Label(root);
title.text = 'Movie Demo';
title.fontRole = FontRole.TitleBold;
layout.addWidget(title);

// Movie loads an animated image (GIF, APNG) from a file path
const movie = new Movie(new Editor.Path('spinner.gif'));
movie.speed = 100;
movie.resize(64, 64);

// MovieView displays a Movie animation
const view = new MovieView(root);
view.movie = movie;
view.animated = true;
view.scaledContents = true;
layout.addWidget(view);

const info = new Label(root);
info.text = 'Movie: speed=' + movie.speed + ', size=' + movie.width + 'x' + movie.height;
layout.addWidget(info);

return root;
}
deinit(): void {
this.connections.forEach((c: any) => c?.disconnect());
this.connections = [];
}
}

Extends

Constructors

Constructor

new Movie(filename): Movie

Constructs a new Movie UI element within the LensStudio:Ui namespace.

Parameters

ParameterType
filenamePath

Returns

Movie

Overrides

ScriptObject.constructor

Properties

cacheMode

cacheMode: CacheMode

Caching strategy controlling how decoded frames are retained in memory.


frameCount

readonly frameCount: number

Total number of frames in the movie.


height

height: number

The width of the movie in pixels


speed

speed: number

The height of the movie in pixels


width

width: number

The playback speed of the movie

Methods

getTypeName()

static getTypeName(): string

Returns the type name of this class.

Returns

string

Overrides

ScriptObject.getTypeName


getTypeName()

getTypeName(): string

Returns the name of this object's type.

Returns

string

Inherited from

ScriptObject.getTypeName


isOfType()

isOfType(type): boolean

Returns true if the object is of the specified type.

Parameters

ParameterType
typestring

Returns

boolean

Inherited from

ScriptObject.isOfType


isSame()

isSame(other): boolean

Returns true if this object refers to the same instance as the given object.

Parameters

ParameterType
otherScriptObject

Returns

boolean

Inherited from

ScriptObject.isSame


jumpToFrame()

jumpToFrame(frame): boolean

Seeks playback to the specified frame index, returning true on success.

Parameters

ParameterType
framenumber

Returns

boolean


resize()

resize(width, height): void

Resizes the movie to the specified width and height

Parameters

ParameterType
widthnumber
heightnumber

Returns

void

Nested types

Enumerations

EnumerationDescription
CacheModeEnum specifying how a Movie caches decoded frames.