by looseopinions » Sat Jul 02, 2022 9:24 pm
Great! Thanks for getting me unstuck. I added a decay to the flash, and an easing curve in either direction. Next up I'm going to work on a full featured Attack / Hold / Decay and I also plan to add bpm sync.
It would be great if I could figure out how to not make it fire on its own the first time. In other words is there a way to pause it on the last frame, and only trigger it from the beginning when I hit Restart?
Here is what I have so far:
/*{
"CREDIT": "One Flash",
"DESCRIPTION": "the material will flash white once",
"TAGS": "flash",
"VSN": "1.0",
"INPUTS": [
{"LABEL": "Duration", "NAME": "mat_duration", "TYPE": "float", "MIN": 0.0, "MAX": 10.0, "DEFAULT": 1.0 },
{"LABEL": "Curve", "NAME": "mat_curve", "TYPE": "float", "MIN": 0.25, "MAX": 2.0, "DEFAULT": 1.0 },
{"LABEL": "Reverse", "NAME": "mat_reverse", "TYPE": "bool", "DEFAULT": false, "FLAGS": "button" },
],
"GENERATORS": [
{"NAME": "mat_time", "TYPE": "time_base" },
],
}*/
vec4 materialColorForPixel( vec2 texCoord )
{
if (mat_time < mat_duration)
if(mat_reverse) return vec4((mat_time/mat_curve)/mat_duration);
else return vec4((mat_duration - (mat_time/mat_curve))/mat_duration);
}