diff --git a/spine-ts/spine-webgl/example/webcomponent-tutorial.html b/spine-ts/spine-webgl/example/webcomponent-tutorial.html index d0bd8fa9a..6b0796ea1 100644 --- a/spine-ts/spine-webgl/example/webcomponent-tutorial.html +++ b/spine-ts/spine-webgl/example/webcomponent-tutorial.html @@ -2378,13 +2378,14 @@ customElements.whenDefined('spine-widget').then(async () => { const widget = spine.getSpineWidget(\`owl\${i}\`); await widget.loadingPromise; - widget.state.setAnimation(1, "blink", true) + widget.state.setAnimation(1, "blink", true); const control = widget.skeleton.findBone("control"); const tempVector = new spine.Vector3(); - const mouse = Ola({ x: 0, y: 0 }, 200); + const mouseX = Smooth(0, 200); + const mouseY = Smooth(0, 200); widget.afterUpdateWorldTransforms = () => { - updateControl(widget, control, mouse, tempVector); + updateControl(widget, control, mouseX, mouseY, tempVector); } }); @@ -2401,7 +2402,7 @@ let limitOwl = true; checkbox.addEventListener('change', () => limitOwl = checkbox.checked); -const updateControl = (widget, controlBone, mouse, tempVector) => { +const updateControl = (widget, controlBone, mouseX, mouseY, tempVector) => { controlBone.parent.worldToLocal(tempVector.set( widget.cursorWorldX, widget.cursorWorldY, @@ -2415,10 +2416,8 @@ y = y / widget.overlay.canvas.height * 30; } - mouse.set({ x, y }); - - controlBone.x = controlBone.data.x + mouse.x; - controlBone.y = controlBone.data.y + mouse.y; + controlBone.x = controlBone.data.x + mouseX(x); + controlBone.y = controlBone.data.y + mouseY(y); } ` ); @@ -2429,99 +2428,98 @@