<spine-widget> tag allows you to place your Spine animations into a web page.
fit attribute.
fit="fill". Default fit value is fit="contain".
fit="none".
In combination with that, you can use the scale attribute to choose you desired scale.
width, width, height, cover,and scaleDown.
width and height in pixels (without the px unit).
style attribute. There you have more styling options.
origin center the animation world origin with the center of the HTML element.
x-axis and y-axis respectively.
offset-x and offset-y to move you skeleton left or right by the pixel amount you specify.
pad-left, pad-right, pad-top, pad-bottom.
bounds-x, bounds-y, bounds-width and bounds-height allows to define custom bounds.
clip in this case to avoid the skeleton overflow.
identifier to your widget to get it by using the spine.getSpineWidget function.
You can easily access the Skeleton and the AnimationState of your character, and use them as if you were using spine-webgl.
inside mode, but not in origin mode.
debug to true.
spinner="false".
skin and animation attributes.
pages the atlas pages you want to load as a comma concatenated list of indices.
spine.createSpineWidget allows you to create a spine widget.
manual-start="false".
Then add the widget to the dom using the asynchronous method appendTo. It's your responsibility to call start() on the widget.
As usual, just wait on the loadingPromise to act on the skeleton or the state.
onScreenFunction is invoked.
onScreenAtLeastOnce to true when the widget enters the viewport the first timemanual-start and on-screen-manual-start are set the widget start is invoked
the first time the widget enters the viewport and the assets are loaded only in that moment.onScreenFunction behaviour. For example, the raptor below changes animation everytime the widget enters the viewport.
pages="".
update, and the skeleton apply and the skeleton updateWorldTransform functions are not invoked when the widget is off screen.
offscreen=update.
offscreen=pose.
update property of the widget.
In that it's your responsibility to skip the update/apply. You can use the onScreen property for convinience.
clip property to clip everything is outside the html container.
clip attribute.
spine-overlay webcomponent as a direct child of the container.
Moreover, it is necessary to perform the following actions: transform css attribute. If it hasn't this attribute the spine-overlay will add it for you.
If your scrollable container has already this css attribute, or if you prefer to add it by yourself (example: transform: translateZ(0);), set the scrollable-tweak-off to the spine-overlay.
spine-overlay must have the scrollable attribute
spine-overlay must have an overlay-id attribute. Choose the value you prefer.
spine-widget must have an overlay-id attribute. The same as the hosting spine-overlay.
overflow-top, overflow-bottom, overflow-left, overflow-right attributes to the spine-overlay in order to make the canvas bigger and prevent scrolling artifacts.
isdraggable property to true.
spine-widget:
cursorWorldX and cursorWorldY are the x and y of the cursor relative to the skeleton root (spine world).worldX and worldY are the x and y of the root relative to the canvas/webgl context origin (spine world).spine-overlay:
cursorCanvasX and cursorCanvasY are the x and y of the cursor relative to the canvas top-left corner (screen world).cursorWorldX and cursorWorldY are the x and y of the cursor relative to the canvas/webgl context origin (spine world).
isinteractive.
bounds or with slots.
The available events are down, up, enter, leave, move, and drag.
head-base slot (the face), you can change the normal and dark tint with the colors selected in the two following selectors.