Storyboard Pro
Scripting Interface Documentation
frame Class Reference

The frame JavaScript global object get, set and offset the current frame. More...

Public Slots

void setCurrent (int frameNb)
 Change the current frame to the given frame number. More...
 
int current ()
 Get the number of the current frame. More...
 
bool moveFrames (int offset)
 Offsets the current frame by the given number of frames. More...
 

Detailed Description

The frame JavaScript global object get, set and offset the current frame.

This interface is used obtain and change the number of current frame. The current frame is the frame at which the red playhead is in the Timeline view. It is based on the amount of frames since the first frame of the project which, in this interface, is frame 1.

function insertMarkersAtFrame(int myFrame)
{
// Return the current frame.
var curFrame = frame.current();
// If the current frame is not the same as the one passed as argument, move to it.
if(curFrame <= myFrame)
frame.moveFrames(curFrame-myFrame);
else
frame.moveFrames(myFrame-curFrame);
}

Member Function Documentation

◆ current

int frame::current ( )
slot

Get the number of the current frame.

Returns
the number of the current frame.

◆ moveFrames

bool frame::moveFrames ( int  offset)
slot

Offsets the current frame by the given number of frames.

Parameters
offsetThe amount of frames to offset the current frame by. A positive value offsets the current frame to the right and a negative value offsets the current frame to the left.
Returns
true if the current frame has been moved, false if it was not.

◆ setCurrent

void frame::setCurrent ( int  frameNb)
slot

Change the current frame to the given frame number.

Parameters
frameNbThe number of the frame to move to. The value must be between 1 (first frame) and the amount of frames in the project.