diff --git a/qml/cool-old-term/SettingsWindow.qml b/qml/cool-old-term/SettingsWindow.qml index 784265f..679d8f9 100644 --- a/qml/cool-old-term/SettingsWindow.qml +++ b/qml/cool-old-term/SettingsWindow.qml @@ -72,6 +72,11 @@ ApplicationWindow { onValueChanged: shadersettings.screen_distortion = value; Component.onCompleted: _value = shadersettings.screen_distortion; } + SettingComponent{ + name: "Screen flickering" + onValueChanged: shadersettings.brightness_flickering = value; + Component.onCompleted: _value = shadersettings.brightness_flickering; + } } } } diff --git a/qml/cool-old-term/main.qml b/qml/cool-old-term/main.qml index 2499ae9..96d54e1 100644 --- a/qml/cool-old-term/main.qml +++ b/qml/cool-old-term/main.qml @@ -91,15 +91,25 @@ ApplicationWindow{ property real scanlines: shadersettings.scanlines ? 1.0 : 0.0 - NumberAnimation on brightness{ - property real randval: 0 - to: 1.0 - duration: 300 - onStopped: { - to = 1 - Math.random() * shadersettings.brightness_flickering; - start(); + Behavior on brightness { + NumberAnimation{ + duration: 250 + onRunningChanged: + if(!running) shadercontainer.brightness = 1.0; } - running: false + } + + Timer{ + property real randval + id: flickertimer + interval: 500 + onTriggered: { + randval = Math.random(); + if(randval < shadersettings.brightness_flickering) + shadercontainer.brightness = Math.random() * 0.5 + 0.5; + } + running: true + repeat: true } property real deltay: 3 / terminal.height