Skip to content

Latest commit

 

History

History
223 lines (150 loc) · 5.74 KB

File metadata and controls

223 lines (150 loc) · 5.74 KB

Performs API

setSpeed( speed: Number )

Changes the speed of the animation player.

  • speed: New speed. Negative values means playing the animations backwards


setBackPlaneColor( color: String ) 

Changes the color of the scene background.

  • color: The color in Hex sRGB space


setBackground( type: Number, image:* String (base64), THREE.Texture or THREE.VideoTexture)

Changes the background style. It can be an open space, an studio or a photocall. The studio can have an image or a video in the background. The photocall can have an image/logo that can be repeated.

  • type: Type of background. The values can be PERFORMS.Backgrounds.OPEN (0), PERFORMS.Backgrounds.STUDIO (1), PERFORMS.Backgrounds.PHOTOCALL (2)

  • image: Optional. The image or the video that has to be on the background.



setPhotocallOffset( offset: Number )

Changes the space between the repeatitive images for the photocall background.

  • offset: New offset.


setBackgroundSettings( settings: String )

Changes how to fits the image or the video in the studio background based on the passed configuration.

  • settings: Adjustment of background image or video. The values can be: "Expand", "Fill", "Extend" and "Adjust". Default value is "Expand".


setBackgroundTextureScale( scale: Number )

Changes the scale of the image or video for studio background.

  • scale: New scale. Default value is 1.


setBackgroundTexturePosition( position: Array)

Changes the position of the image or video for studio background.

  • position: New position. Default value is center [0,0].


setConfiguration( configuration: JSON,  callback:* function )

configuration: JSON with configuration options (position, rotation, scale, animations, autoplay, etc). See available options for more info.

  • callback: Optional. Function called when all configuration is loaded.


changeMode( mode: Number )

Changes animation player mode. The two modes of Performs are Script (BML,SiGML based instructions) and Keyframe (bvh, bvhe, glb animations).

  • mode: New mode.Performs.Modes.SCRIPT (0) or Performs.Modes.KEYFRAME (1). Default is Script mode 0.


changeAnimation( animation: String, needsUpdate:* Boolean )
  • animation: Name of a preloaded animation.

  • needsUpdate: Optional. If its true, forces to bound animation to the current character



changePlayState( play:* Boolean )
  • play: Optional. New play state. For Keyframe mode, play/stop current animation. If play is NULL, switches the current state. For Script mode, replay the animation from the begining.


getSpeed(): Number

Returns the current speed of the animation player.

getBackPlaneColor(): String(Hex)

Returns the current color of the scene background.

init( options: JSON)

Initializes the application, creates the scene and loads the assets.

  • options: Configuration options (position, rotation, scale, animations, autoplay, etc). See available options for more info.


setConfiguration( options: JSON, callback*: function)

Changes the current configuration of the scene based on passed options.

  • options: Configuration options (position, rotation, scale, animations, autoplay, etc). See available options for more info.

  • callback: Optional. Function called when changers are completed.



loadAvatar( avatarURL: String, configFile: File URL or JSON, avatarRotation:* THREE.Quaternion, avatarName: String, callback:* function, onerror:* function)

Loads an avatar given a public URL and with a specific configuration for Script animations.

  • avatarURL: Public URL where the avatar is hosted. Supported extensions are glb and gltf.

  • configFile: Avatar configuration for Script animations (it can be generated through Atelier).

  • avatarRotation: Optional. Avatar rotation. It can be NULL.

  • avatarName: Avatar name.

  • callback: Optional. Function called when loading is completed.

  • onerror: Optional. Function called when the avatar can not be loaded.



changeAvatar( avatarName: String)

Changes the current avatar given the name of a preloaded avatar.

  • avatarName: Name of the new avatar.


changeCameraMode( restrictView: Boolean )

Changes the camera mode movements.

  • restrictView: true restricts zoom, panning, etc. and false lets any camera movement.


appendCanvasTo( element: HTML element )

If there isn't the default GUI, appends as a child the renderer DOM element of Performs (canvas) to the passed element. Useful when custom GUI is added and you want to append Performs into another element. Otherwise, Performs is appended to the HTML body.

  • element: HTML element to be the parent of Performs' canvas.


onLoading( text: String )

If there isn't the default GUI, it's automatically called when an asset is loaded. Overwrite the function with your code. Useful to make/show custom modals while asset is loading. By default is NULL.

  • text: Text to put in the modal.


onLoadingEnded( )

If there isn't the default GUI, it's automatically called when loading of the asset is completed. Overwrite the function with your code. Useful to remove/hide custom modals. By default is NULL.