LensStudio:Ui.Movie
ClassRepresents 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
| Parameter | Type |
|---|---|
filename | Path |
Returns
Movie
Overrides
ScriptObject.constructor
Properties
cacheMode
cacheMode:
CacheMode
Caching strategy controlling how decoded frames are retained in memory.
frameCount
readonlyframeCount: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()
staticgetTypeName():string
Returns the type name of this class.
Returns
string
Overrides
getTypeName()
getTypeName():
string
Returns the name of this object's type.
Returns
string
Inherited from
isOfType()
isOfType(
type):boolean
Returns true if the object is of the specified type.
Parameters
| Parameter | Type |
|---|---|
type | string |
Returns
boolean
Inherited from
isSame()
isSame(
other):boolean
Returns true if this object refers to the same instance as the given object.
Parameters
| Parameter | Type |
|---|---|
other | ScriptObject |
Returns
boolean
Inherited from
jumpToFrame()
jumpToFrame(
frame):boolean
Seeks playback to the specified frame index, returning true on success.
Parameters
| Parameter | Type |
|---|---|
frame | number |
Returns
boolean
resize()
resize(
width,height):void
Resizes the movie to the specified width and height
Parameters
| Parameter | Type |
|---|---|
width | number |
height | number |
Returns
void
Nested types
Enumerations
| Enumeration | Description |
|---|---|
| CacheMode | Enum specifying how a Movie caches decoded frames. |