OneJSO
OneJS3y ago
Singtaa

DOTween with OneJS

This following works for me:
import { h, render } from "preact"
import { useRef } from "preact/hooks"
import { Vector3 } from "UnityEngine"

const DOTween = require("DG/Tweening").DOTween

const App = () => {
    const ref = useRef<Dom>()

    function onClick() {
        const sequence = DOTween.Sequence()
        sequence.Append((ref.current.ve as any).DOScale(new Vector3(2, 2, 2), 2))
        sequence.Append((ref.current.ve as any).DORotate(125, 1))
    }

    return <div class="w-full h-full flex justify-center items-center">
        <div ref={ref} class="w-10 h-10 bg-teal-500" onClick={onClick}></div>
    </div>
}

render(<App />, document.body)
Was this page helpful?