Switching Two transform
Hi, please help me.
I have two transform that I want to switch using tween value.
I wanted to switch between two transform using tween value so there will be smooth animation upon switching. But I dont know how..
here is my initial code
// -----JS CODE-----
// @input SceneObject mainCam
// @input SceneObject worldTracking
// @input SceneObject animationTracking
script.api.myPercentageHandler = 0
var updateEvent = script.createEvent("UpdateEvent")
updateEvent.bind(function(){
var myWorldTracking = script.worldTracking.getTransform()
var myAnimationTracking = script.animationTracking.getTransform()
var myNewPos = ((myWorldTracking - myAnimationTracking) * script.api.myPercentageHandler) + myWorldTracking
script.mainCam.getTransform().setWorldTransform(myNewPos);
})
Hope you can help me. Thanks!
You can set the start and end values of a tween via your script and then start the tween.
https://lensstudio.snapchat.com/guides/scripting/helper-scripts/tween-manager/