API Docs for:
Show:

gs.Live2DObject Class

Displays an associated Live2D model on screen.

Constructor

gs.Live2DObject

(
  • [viewport=Graphics.viewport]
)

Parameters:

  • [viewport=Graphics.viewport] gs.Viewport optional
    • The viewport.

Methods

dispose

()

Inherited from gs.GraphicObject:

Disposes the graphic object.

draw

()

Inherited from gs.GraphicObject

Draws the Live2D object. Needs to be called once per frame.

expand

(
  • anAutotile
)
gs.Bitmap static

Expands an autotile.

Parameters:

  • anAutotile gs.Bitmap
    • The autotile bitmap to expand

Returns:

gs.Bitmap:

The expanded autotile bitmap.

getParameter

(
  • name
)
Number

Gets a Live2D parameter from the Live2D model like "PARAM_ANGLE_X", etc.

Parameters:

  • name String
    • The name of the parameter to get.

Returns:

Number:

The value of the parameter.

initialize

() protected

Inherited from gs.GraphicObject:

Initializes the graphic object.

playMotionGroup

(
  • name
  • fadeTime
)

Plays the specified motion.

Parameters:

  • name String
    • The name of the motion to play
  • fadeTime Number
    • The fade-in time of the motion

playMotionGroup

(
  • name
  • playType
)

Plays the specified motion-group.

Parameters:

setExpression

(
  • name
  • fadeTime
)

Sets the specified face expression.

Parameters:

  • name String
    • The name of the face expression to set.
  • fadeTime Number
    • The fade-in time of the expression.

setParameter

(
  • name
  • value
)

Passes a Live2D parameter to the Live2D model like "PARAM_ANGLE_X", etc.

Parameters:

  • name String
    • The name of the parameter to set.
  • value Number
    • The value.

setPose

(
  • index
)

Sets the specified pose.

Parameters:

  • index String
    • The index of the pose to set.

update

()

Inherited from gs.GraphicObject

Updates the Live2D object. Needs to be called once per frame.

Properties

anchor

gs.Point

Inherited from gs.GraphicObject:

The anchor point. For example: An anchor-point with 0,0 rotates the object around its top-left corner but with an 0.5, 0.5 anchor-point the object rotates around its center. An anchor-point of 1,1 rotates the object around its lower-right corner. It has not effect on the object's positioning. For positioning, take a look at positionAnchor property.

angle

Number

The rotation-angle in degrees.

blendingMode

gs.BlendMode

The blend mode used for alpha-blending.

breathIntensity

Number

The intensity of the breath-animation. The higher the value the more intensive the breath-animation will become. A value of 0 disables the breath-animation. The default is 1.0.

Default: 1.0

color

Boolean

The color. Can be used for flashing-effects, etc.

currentMotion

gs.Live2DMotion

The current motion.

disposed

Boolean

Inherited from gs.GraphicObject:

Indicates if the object is disposed. A disposed object is not rendered.

effects

gs.EffectCollection

Inherited from gs.GraphicObject:

The effect settings for different kind of visual effect like wobble, etc.

expressionManager

MotionQueueManager

The expression manager.

id

Number

Inherited from gs.GraphicObject:

The unique identifier of the graphic object.

idleIntensity

Number

The intensity of the default idle-animation. The higher the value the more intensive the idle-animation will become. A value of 0 disables the default idle-animation. The default is 1.0.

Default: 1.0

index

Number

Inherited from gs.GraphicObject:

The current index in the global rendering list. This property is read-only and automatically calculated at runtime depending on z-property.

lipSyncSensitivity

Number

The sensitivity of the lip-sync if the Live2D model is talking. The higher the value the more open the mouth will become on high volume. A value of 0 disables lip-sync. The default is 1.0.

Default: 1.0

loopMotion

Boolean

Indicates if the motion should be looped.

mask

gs.Mask

The mask used for masking-effects.

model

gs.Live2DModel

The Live2D model to render.

motionManager

gs.Live2DMotionManager

The motion manager.

onIndexChange

Function

Inherited from gs.GraphicObject:

Fired if the graphic object's current index in the global rendering list was changed.

Default: null

opacity

Number

The opacity. Goes from 0 to 255.

ox

Number

Inherited from gs.GraphicObject:

The x-coordinate of the origin.

oy

Number

Inherited from gs.GraphicObject:

The y-coordinate of the origin.

positionAnchor

gs.Point

Inherited from gs.GraphicObject:

The position anchor point. For example: An anchor-point with 0,0 places the object with its top-left corner at its position but with an 0.5, 0.5 anchor-point the object will be placed with its center. An anchor-point of 1,1 will place the object with its lower-right corner. It has not effect on the object's rotation/zoom anchor. For that, take a look at anchor property.

talking

Boolean

Indicates if the Live2D model is currently talking.

talkingVolume

Number

The talking-volume if the Live2D model is talking. Goes from 0.0 to 1.0. The larger the value the more open is the mouth of the Live2D model.

tilesetConfig

gs.TilesetConfiguration static

The current tileset configuration.

tileSize

Number static

The size of a single tile.

Default: 32

tone

gs.Tone

The color tone.

transform

Mat2d

Inherited from gs.GraphicObject:

The transformation matrix of the graphic object.

visible

Boolean

Inherited from gs.GraphicObject:

Indicates if the object is rendered.

x

Number

The x-coordinate of the object's position.

y

Number

The y-coordinate of the object's position.

z

Number

Inherited from gs.GraphicObject:

The z-index controls rendering-order/image-overlapping. An object with a smaller z-index is rendered before an object with a larger index. For example: To make sure a graphic object is always on top of the screen, it should have the largest z-index of all graphic objects.

zoomX

Number

The zoom-factor on x-axis.

zoomY

Number

The zoom-factor on y-axis.