File: WigglyEffect.qml

package info (click to toggle)
qt6-quickeffectmaker 6.8.2-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 6,452 kB
  • sloc: cpp: 6,271; makefile: 12
file content (47 lines) | stat: -rw-r--r-- 1,925 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// Copyright (C) 2023 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
// Created with Qt Quick Effect Maker (version 0.43), Fri Feb 17 09:45:06 2023

import QtQuick

Item {
    id: rootItem

    // This is the main source for the effect
    property Item source: null
    // Enable this to animate iTime property
    property bool timeRunning: false
    // When timeRunning is false, this can be used to control iTime manually
    property real animatedTime: frameAnimation.elapsedTime

    property real wigglyAmountX: 20
    property real wigglyAmountY: 50
    property real wigglyShadows: 0.5
    // The levels of details for the electic clouds. Bigger value means more detailed rending which also requires more processing power. The default value is 6 and practical range is between 1 and 10.
    property int electricCloudLevels: 6
    // The color used for the clouds. Alpha channel defines the amount of opacity this effect has.
    property color electricCloudColor: Qt.rgba(1, 1, 1, 1)

    FrameAnimation {
        id: frameAnimation
        running: rootItem.timeRunning
    }

    ShaderEffect {
        readonly property alias iSource: rootItem.source
        readonly property alias iTime: rootItem.animatedTime
        readonly property vector3d iResolution: Qt.vector3d(width, height, 1.0)
        readonly property alias wigglyAmountX: rootItem.wigglyAmountX
        readonly property alias wigglyAmountY: rootItem.wigglyAmountY
        readonly property alias wigglyShadows: rootItem.wigglyShadows
        readonly property alias electricCloudLevels: rootItem.electricCloudLevels
        readonly property alias electricCloudColor: rootItem.electricCloudColor

        vertexShader: 'wigglyeffect.vert.qsb'
        fragmentShader: 'wigglyeffect.frag.qsb'
        anchors.fill: parent
        mesh: GridMesh {
            resolution: Qt.size(63, 1)
        }
    }
}