Skip to content

Commit

Permalink
🟦 [Nodes] Added "MIDI Multi-Select with Transition"
Browse files Browse the repository at this point in the history
  • Loading branch information
JulesFouchy committed May 16, 2024
1 parent 54c7b96 commit 8bc9e2b
Show file tree
Hide file tree
Showing 15 changed files with 1,545 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Cool
63 changes: 63 additions & 0 deletions Nodes/12 Image Blend/MIDI Multi-Select with Transition.clbnode
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
// To learn how to write nodes, see https://coollab-art.com/Tutorials/Writing%20Nodes/Intro

INPUT float 'Transition Duration';

INPUT UV->Oklab_PremultipliedA 'Image 1';
INPUT int 'ID 1';

INPUT UV->Oklab_PremultipliedA 'Image 2';
INPUT int 'ID 2';

INPUT UV->Oklab_PremultipliedA 'Image 3';
INPUT int 'ID 3';

INPUT UV->Oklab_PremultipliedA 'Image 4';
INPUT int 'ID 4';

INPUT UV->Oklab_PremultipliedA 'Image 5';
INPUT int 'ID 5';

INPUT UV->Oklab_PremultipliedA 'Image 6';
INPUT int 'ID 6';

INPUT UV->Oklab_PremultipliedA 'Image 7';
INPUT int 'ID 7';

INPUT UV->Oklab_PremultipliedA 'Image 8';
INPUT int 'ID 8';

INPUT UV->Oklab_PremultipliedA 'Image 9';
INPUT int 'ID 9';

vec4 get_image(int id, vec2 uv)
{
return id == 'ID 1'
? 'Image 1'(uv)
: id == 'ID 2'
? 'Image 2'(uv)
: id == 'ID 3'
? 'Image 3'(uv)
: id == 'ID 4'
? 'Image 4'(uv)
: id == 'ID 5'
? 'Image 5'(uv)
: id == 'ID 6'
? 'Image 6'(uv)
: id == 'ID 7'
? 'Image 7'(uv)
: id == 'ID 8'
? 'Image 8'(uv)
: id == 'ID 9'
? 'Image 9'(uv)
: vec4(0., 0., 0., 1.);
}

Oklab_PremultipliedA main(UV uv)
{
float mix_factor = _time_since_last_midi_button_pressed / 'Transition Duration';
if (mix_factor < 0.)
return get_image(_last_last_midi_button_pressed, uv);
if (mix_factor > 1.)
return get_image(_last_midi_button_pressed, uv);
return mix(get_image(_last_last_midi_button_pressed, uv), get_image(_last_midi_button_pressed, uv), mix_factor);
}
Loading

0 comments on commit 8bc9e2b

Please sign in to comment.