Change Blend Mode Script
Hey guys, I'm in the process of making a new lens (almost done). And what I'm trying to do is:
~Create a Script which will allow the Selection of an Image or Scene Object
~User Taps the Screen and the Blend Mode of the Image or Scene Object will change
~But I select before-hand (publish) certain Blend Modes that the user can then Cycle through
Because the current Script for my other Lenses / Projects has been:
########## - Start
// ----JS 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);
########## - End
~ And I'd like to be able to change it or modify it for what I'm after but, 1 I don't know how to script and 2 I can't find any tutorials or Script Examples on such case of a script where the user is able to change the Blend Mode
So if someone can reply back and answer my cry for help, that would be nice :)
Hi, Aa John Brown!
Blendmode documentation is here
You can change blendmode of material like this:
Here is a simple script that scrolls through blend modes of material of an Image
In this case, since you want to affect multiple images you can do something like this:
On each of your image, you can have a script that that passes it's image pass to the blend mode changing script:
Then in the blend mode changing script, provide an API to pass the pass over:
Best
Olha