How to combine tweens with tap to change texture?
Hello,
I'm working on a project in which I want to have the function of Tap to change texture and having tweens scale and rotate animation at the same time. I only have two image textures that I want to rotate(and two animation state). The idea is to first swap the image and then perform the animation, or swap and animate at the same time.
Here I have the tween animation script which works good.
// -----JS CODE-----
//@input SceneObject objectWithTweens
var count = 0;
var actions = ["rotateScale", "orginalPosition"]
function onTapped(eventData)
{
if (count == 0)
{
global.tweenManager.startTween(script.objectWithTweens, "rotate");
global.tweenManager.startTween(script.objectWithTweens, "scale");
}
if (count == 1)
{
global.tweenManager.startTween(script.objectWithTweens, "rotateBack");
global.tweenManager.startTween(script.objectWithTweens, "scaleBack");
}
count++
if (count == actions.length)
{
count = 0;
}
}
var event = script.createEvent("TapEvent");
event.bind(onTapped);
I have also find some script that allows tap to change texture. But how do I add tap to change between two texture in this script?
Thanks a lot for the help!
Cheers
Hello,
Never mind, I have found the solution by integrating a new script using this tutorial.
https://www.youtube.com/watch?v=FzHGZmdg9bE
Cheers!