O
OneJS2y 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)
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)
3 Replies
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Singtaa
SingtaaOP2y ago
Yea, that type of generic extension method doesn't seem to be supported by Jint. Current workaround may be to just rewrap the TweenSettingsExtensions:
public static Sequence SetLoops(this Sequence s, int loops) {
return TweenSettingsExtensions.SetLoops(s, loops);
}
public static Sequence SetLoops(this Sequence s, int loops) {
return TweenSettingsExtensions.SetLoops(s, loops);
}
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Want results from more Discord servers?
Add your server