Implementation of _Story class.

Implements

  • _StoryImpl

Constructors

  • Sets up the Story and adds the Default Scenes.

    Parameters

    Returns _Story

Properties

_args: BeamToIXArgs = ...
_curScene: any = undefined
_frameCount: uint = 0
_frameCountChanged: boolean = false
_height: uint = 0
_isRendering: boolean = false
_isServerReady: boolean = false
_isTeleporting: boolean
_isVerbose: boolean
_logLevel: uint = 0

Defines the log level. Use LL_VERBOSE for debugging. The server can modify this mode.

_metadata: StoryMetadata = {}
_queueRenders: _RenderFrameOptionsEx[] = []
_renderDir: -1 | 1 = 1
_renderFrameCount: uint = 0
_renderFrameEnd: uint = 0
_renderFramePos: uint = 0
_renderPlaySpeed: uint = 0
_renderStage: uint = 0
_renderTimer: number
_renderTimeStamp: Date
_scenes: _SceneImpl[] = []
_strictMode: boolean = false

If true, the input parameters have strict checks and throw errors if fails. If false, BeamToIX is more relax and bypasses errors. The server can modify this mode on startup.

false
_teleporter: _Teleporter
_virtualAnimatorMap: {
    [selector: number]: VirtualAnimator;
} = {}

Internal map from selectors to VirtualAnimators. Each animator must have a unique selector, but future versions might support different animators have the selector.

_virtualAnimators?: VirtualAnimator[] = []
_waitMan: _WaitMan
_width: uint = 0
_wkFlyovers: _WorkFlyover[] = []
bestPlaySpeed: (() => uint) = ...

Returns the play speed that best matches the fps.

defaultUnit: TimeUnit = TimeUnit.f

Default unit used when input time values are used in numeric forms. Supports minutes, seconds, milliseconds and frames. TimeUnit.f = 0; TimeUnit.ms = 1; TimeUnit.s = 2; TimeUnit.m = 3;

fps: uint

Frames per second. All the time values is converted into frames using this value. Defined during the call to createStory.

#end-user

hasServer: boolean = false

True if it's running a supporting server program for frame storage.

#end-user

onAfterRenderFrame?: ((args?: BeamToIXArgs) => void)

Event triggered after a frame is rendered.

onBeforeRenderFrame?: ((args?: BeamToIXArgs) => void)

Event triggered before a frame is rendered.

onGetVirtualElement?: ((id: string, args?: BeamToIXArgs) => VirtualElement)

Maps Ids into Virtual Elements Used only in non-DOM elements such as WebGL elements.

Type declaration

    • (id, args?): VirtualElement
    • Parameters

      • id: string

        virtual element Id without '%'

      • Optionalargs: BeamToIXArgs

      Returns VirtualElement

onNextFrame?: ((args?: BeamToIXArgs) => void)

Event triggered during the rendering process after a frame is rendered and is ready to move to following frame.

onRenderFinished?: ((args?: BeamToIXArgs) => void)

Event triggered when render finished the rendering process. EXPERIMENTAL The behavior can changed or be deprecated.

onServerReady?: ((args?: BeamToIXArgs) => void)

Event triggered by server, stating that it's ready to receive frames. A server is usually a headless capture program such as puppeteer. If the animation is running without server, this event is never fired.

serverFeatures: ServerFeatures

Provides information about the running server.

serverName: string

The name of the server. The server will assign this property value.

#end-user

storyAdapter: SceneAdapter

Allows flyovers to find elements on the document body or in the virtual world.

toExitOnRenderFinished: boolean = true

If true, it terminates the server when the render call finishes or if it's aborted. For a serverless execution, it has no effect.

true

Accessors

  • get args(): BeamToIXArgs
  • Returns BeamToIXArgs. This should be used only in specific cases such the access to --var. In most cases, this property is passed as an argument to plugins and callbacks.

    #end-user

    Returns BeamToIXArgs

  • get curScene(): any
  • Current active and visible scene. Valid both for adding animations and rendering. Use gotoScene to change this value.

    #end-user

    Returns any

  • get frameCount(): uint
  • Total number of frames from all the scenes.

    #end-user

    Returns uint

  • get height(): uint
  • Numerical value of the frame height in pixels.

    #end-user

    Returns uint

  • get isRendering(): boolean
  • True if the rendering has started. Use finishRender to abort the rendering process.

    #end-user

    Returns boolean

  • get isTeleporting(): boolean
  • True if it's teleporting.

    #end-user

    Returns boolean

  • get isVerbose(): boolean
  • Returns boolean

  • get logLevel(): uint
  • Returns uint

  • set logLevel(newLogLevel): void
  • Parameters

    • newLogLevel: uint

    Returns void

  • get metadata(): StoryMetadata
  • Numerical value of the frame width in pixels.

    #end-user

    Returns StoryMetadata

  • get renderDir(): DirectionInt
  • Render direction. 1 for forward, -1 for backwards. Defined during the call to story.render.

    #end-user

    Returns DirectionInt

  • get renderFrameCount(): uint
  • The number of the current frame being rendered. Defined during the call to story.render. This value doesn't changes during the rendering process.

    #end-user

    Returns uint

  • get renderFrameEnd(): uint
  • The number of the last frame to be rendered within the story. Defined during the call to story.render. This value doesn't changes during the rendering process.

    #end-user

    Returns uint

  • get renderFramePos(): uint
  • The number of the current frame being rendered. Defined during the call to story.render. This value changes during the rendering process.

    #end-user

    Returns uint

  • get scenes(): Scene[]
  • List of the scenes.

    #end-user

    Returns Scene[]

  • get strictMode(): boolean
  • Returns boolean

  • set strictMode(newStrictMode): void
  • Parameters

    • newStrictMode: boolean

    Returns void

  • get virtualAnimators(): VirtualAnimator[]
  • Returns VirtualAnimator[]

    Use addVirtualAnimator instead. The direct access to virtualAnimators in future versions will likely be disabled

  • get width(): uint
  • Numerical value of the frame width in pixels.

    #end-user

    Returns uint

Methods

  • Recomputes the total number of frames as well as other scene parameters associated with frames.

    Returns void

  • Computes the render properties from the user frame params.

    Parameters

    Returns boolean

  • Throws exception if is rendering.

    Returns void

  • Parameters

    • scene: any

    Returns _SceneImpl

  • This method is called by the server to communicate with the client.

    Parameters

    • cmd: string
    • _value: string

    Returns void

  • Parameters

    • framePos: int

    Returns void

  • Internal and faster version of gotoScene.

    Parameters

    • scene: any

    Returns void

  • Parameters

    Returns void

  • Renders each frame at a pre-defined speed.

    Returns void

  • Parameters

    • cmd: string
    • Optionalvalue: string

    Returns void

  • Signals that there was a change in the number of frames. Usually used by addAnimations.

    Returns void

  • Returns void

  • Adds scenes defined in the html by .beamtoix-scene class. These classes are added automatically during Story constructor. Add only after a story.reset().

    Returns void

  • Adds a flyover, which is a function executed on every render step.

    Parameters

    • handler: FlyoverHandler
    • Optionalparams: FlyoverParams

    Returns void

    flyovers

  • Adds a scene to the story. HTML elements with beamtoix-scene class are added automatically.

    Parameters

    • sceneSelector: SceneSelector

      DOM selector, JQuery object or Virtual Scene

    Returns Scene

    A pointer to newly created scene

  • Adds a list scene/serial/parallel animations. In essence, it represents the complete storyline. Use this method to load the whole storyline from an external file. Otherwise is preferable to add animation scene by scene.

    Parameters

    • sceneSerialAnimes: Animations[][]

    Returns void

  • Adds a list of serial/parallel animations per scene Id. It requires that each scene has defined the id (DOM attribute). It bypasses invalid scene ids.

    Parameters

    • sceneSerialAnimes: {
          [sceneId: string]: Animation[][];
      }
      • [sceneId: string]: Animation[][]

    Returns void

  • Adds a to the story. Use story.removeVirtualAnimator to take it from the story.

    Parameters

    • animator: VirtualAnimator

    Returns void

  • Rewinds the animation to the start. Deletes all the scenes and frames from the story. The DOM is left untouched.

    Returns void

  • Terminates the server in case is a headless webpage capture program. In other cases, it has no effect.

    Returns void

  • Returns the Scene Object which has sceneName, undefined otherwise

    Parameters

    • sceneName: string

    Returns Scene

  • Aborts the rendering process.

    Returns void

  • Parameters

    • selector: ElSelectorHandler

    Returns ElementAdapter[]

  • Returns the animations, html, CSS as an object. Use only if isTeleporting = true. Send this information via Ajax to the remote server. Due CORS, it requires a live server to access CSS information. Set frameOpts, if you need segment rendering. Set isPretty = true, to test only, since this mode will return a formatted output but bigger in size.

    Parameters

    Returns string

  • Same as getStoryToTeleport() but it returns as StoryConfig object. Use this function instead of getStoryToTeleport, if you need to add extra fields. Modifying the content of config.beamtoix is forbidden for 3rd-party remote server rendering.

    Parameters

    Returns StoryConfig

  • Moves the current render Position when is not rendering by consuming the pipeline. Use this only if you need to compute parameters at certain position. When render starts

    Parameters

    • framePos: int

    Returns void

  • Changes the active and visible to a different scene.

    Parameters

    • scene: Scene

    Returns void

  • If a server is present and supports logging, it sends a error message to server otherwise it sends to the browser console.

    Parameters

    • msg: string

    Returns void

  • Formats a log using a format supported by exact test framework. This is mostly used internally for testing, but it's publicly available.

    Parameters

    • tag: string
    • params: (string | number)[][]

      list of [name, value]

    • OptionallogType: LogType

    Returns void

  • If a server is present and supports logging, it sends a log message to server otherwise it sends to the browser console.

    Parameters

    • msg: string

    Returns void

  • If a server is present and supports logging, it sends a warn message to server otherwise it sends to the browser console.

    Parameters

    • msg: string

    Returns void

  • Removes a frame from scene list and removes the its rendering pipeline but its DOM elements aren't removed.

    Parameters

    • scene: Scene

    Returns void

  • Removes a to the story. Use story.addVirtualAnimator to add it to the story.

    Parameters

    • animator: VirtualAnimator

    Returns void

  • Starts the Rendering process. It can render the whole storyline or just a segment. Forward and backward rending is supported. If it has a server, such as headless webpage capture program, it will render a frame, and send a message to the server to store it on the disk. If it's running on the browser, it will render and wait playSpeedMs time.

    Parameters

    • OptionalplaySpeedMs: any

      Play speed in milliseconds, ignored on server mode. BeamToIX doesn't guarantee the exact timing. If it's undefined, it will play at full speed.

    • OptionalframeOpts: RenderFrameOptions

    Returns void

  • Rewinds the animation to the start.

    Returns void

  • Use this method only if you have created the story with toTeleport = true and toStartTeleporting = false, because you need to inject html/css code into the page before the teleporting process starts. Otherwise, you won't need to call this method since it's called automatically if teleporting a story.

    Returns void

  • Stores the complete story on a file in the disk. Use this method only for testing. This method requires that:

    1. Is on teleporting mode isTeleporting === true
    2. The render server agent. beamtoix render ...

    Use this method instead of getStoryToTeleport.

    Parameters

    Returns void