From bd1c28a82c2ff955e0d154fac2e2df8d5a110dd7 Mon Sep 17 00:00:00 2001 From: Jonas Karlsson Date: Tue, 23 Jun 2020 13:25:39 +0200 Subject: Reimplement UniformAnimator for ShaderEffect Fixes: QTBUG-83976 Change-Id: I307e96be0d3d2edeb8d9065d100c1ef38c8824c7 Reviewed-by: Laszlo Agocs --- src/quick/doc/snippets/qml/animators.qml | 82 +++++++++++++------------------- 1 file changed, 33 insertions(+), 49 deletions(-) (limited to 'src/quick/doc') diff --git a/src/quick/doc/snippets/qml/animators.qml b/src/quick/doc/snippets/qml/animators.qml index 87684f2792..73c8097974 100644 --- a/src/quick/doc/snippets/qml/animators.qml +++ b/src/quick/doc/snippets/qml/animators.qml @@ -219,55 +219,39 @@ Rectangle { } } //! [opacity target] -//![shaderon] -// Uniform animators are not yet ported to Qt 6 -//ShaderEffect { -// width: 50 -// height: 50 -// property variant t; -// UniformAnimator on t { -// from: 0 -// to: 1 -// duration: 1000 -// } -// fragmentShader: -// " -// uniform lowp float t; -// varying highp vec2 qt_TexCoord0; -// void main() { -// lowp float c = qt_TexCoord0.y; -// gl_FragColor = vec4(c * t, 0, 0, 1); -// } -// " -//} -//![shaderon] -//![shader target] -// Uniform animators are not yet ported to Qt 6 -//ShaderEffect { -// id: shader -// width: 50 -// height: 50 -// property variant t; -// UniformAnimator { -// target: shader -// uniform: "t" -// from: 0 -// to: 1 -// duration: 1000 -// running: true -// } -// fragmentShader: -// " -// uniform lowp float t; -// varying highp vec2 qt_TexCoord0; -// void main() { -// lowp float c = qt_TexCoord0.y; -// gl_FragColor = vec4(0, 0, c * t, 1); -// } -// " -//} -//![shader target] -//![mixed] +//! [shaderon] +ShaderEffect { + width: 50 + height: 50 + property variant t; + UniformAnimator on t { + from: 0 + to: 1 + duration: 1000 + } + fragmentShader: "qrc:shader.frag.qsb" +} + +//! [shaderon] +//! [shader target] +ShaderEffect { + id: shader + width: 50 + height: 50 + property variant t; + UniformAnimator { + target: shader + uniform: "t" + from: 0 + to: 1 + duration: 1000 + running: true + } + fragmentShader: "qrc:shader.frag.qsb" +} + +//! [shader target] +//! [mixed] Rectangle { id: mixBox width: 50 -- cgit v1.2.3