🔧 Tweak glitch effect

This commit is contained in:
Simon Schneegans
2023-01-03 12:52:07 +01:00
parent 88a51ea0dc
commit ab079efc90
3 changed files with 28 additions and 20 deletions
+5
View File
@@ -43,6 +43,7 @@ var Glitch = class {
const Clutter = imports.gi.Clutter;
// Store uniform locations of newly created shaders.
shader._uSeed = shader.get_uniform_location('uSeed');
shader._uColor = shader.get_uniform_location('uColor');
shader._uScale = shader.get_uniform_location('uScale');
shader._uStrength = shader.get_uniform_location('uStrength');
@@ -52,7 +53,11 @@ var Glitch = class {
shader.connect('begin-animation', (shader, settings) => {
const c = Clutter.Color.from_string(settings.get_string('glitch-color'))[1];
// If we are performing an integration tests, we use a fixed seed.
const testMode = settings.get_boolean('test-mode');
// clang-format off
shader.set_uniform_float(shader._uSeed, 1, [testMode ? 0 : Math.random()]);
shader.set_uniform_float(shader._uColor, 3, [c.red / 255, c.green / 255, c.blue / 255]);
shader.set_uniform_float(shader._uScale, 1, [settings.get_double('glitch-scale')]);
shader.set_uniform_float(shader._uStrength, 1, [settings.get_double('glitch-strength')]);