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.
Item Index
Methods
Properties
- anchor
- angle
- blendingMode
- breathIntensity
- color
- currentMotion
- disposed
- effects
- expressionManager
- eyeBlink
- id
- idleIntensity
- index
- lipSyncSensitivity
- loopMotion
- mask
- model
- motionManager
- onIndexChange
- opacity
- ox
- oy
- positionAnchor
- talking
- talkingVolume
- tilesetConfig static
- tileSize static
- tone
- transform
- visible
- x
- y
- z
- zoomX
- zoomY
Methods
dispose
()
Disposes the graphic object.
draw
()
Draws the Live2D object. Needs to be called once per frame.
expand
-
anAutotile
Expands an autotile.
Parameters:
-
anAutotile
gs.Bitmap- The autotile bitmap to expand
Returns:
The expanded autotile bitmap.
getParameter
-
name
Gets a Live2D parameter from the Live2D model like "PARAM_ANGLE_X", etc.
Parameters:
-
name
String- The name of the parameter to get.
Returns:
The value of the parameter.
initialize
()
protected
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:
-
name
String- The name of the motion.group to play.
-
playType
gs.Live2DMotionPlayTypes- The play type to use.
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
()
Updates the Live2D object. Needs to be called once per frame.
Properties
anchor
gs.Point
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.
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
Indicates if the object is disposed. A disposed object is not rendered.
effects
gs.EffectCollection
The effect settings for different kind of visual effect like wobble, etc.
expressionManager
MotionQueueManager
The expression manager.
eyeBlink
L2DEyeBlink
Eye-Blink object to support eye blinking.
id
Number
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
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.
onIndexChange
Function
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
The x-coordinate of the origin.
oy
Number
The y-coordinate of the origin.
positionAnchor
gs.Point
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.
tileSize
Number
static
The size of a single tile.
Default: 32
transform
Mat2d
The transformation matrix of the graphic object.
visible
Boolean
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
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.