[Tutorial] How to create a Tap To Change Lens
Hey Lens Creator,
I`ll show you how to create a Tap To Change Lens, at first create New Projekt.
Press the "+" in the Resources Panel and add Script, click with an double click on the Script and it will open the Script Editor. Copy and Past the Script below:
// -----CRX CODE-----
// @input SceneObject[] obj
var count = 0;
script.obj[0].enabled = true;
for (var i = 1; i < script.obj.length; i++)
{
script.obj[i].enabled = false;
}
function onTapped(eventData)
{
count++
for (var i = 0; i < script.obj.length; i++)
{
if (count == i)
{
script.obj[i].enabled = true;
}
else
{
script.obj[i].enabled = false;
}
}
if (count == script.obj.length)
{
count = 0;
script.obj[0].enabled = true;
}
}
var event = script.createEvent("TapEvent");
event.bind(onTapped);
If you have copied the Script into the Script Editor, press the task combination (CTRL + S) to save the Script.
With a right click in the Objekt Panel u can add a new "Scene Objekt". Rename it to "Tap To Change" or whatever u want.
On the right side its a "Inspector Panel" click on "On Component" and Add a Script!
Click in the field where "None" is written and select the script.
Now you will see "Obj Values" there you can add as many "Values" as you need by clicking "Add Values".
I have added 2 Color Color Corrections in 2 different Values and if u tap on the Preview the Color Correction will change.
If you have any Questions, let me know in the comments!
Best,
justin.crx
Thanks
No problem Maha