-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The radius of the Wave can be easily computed with the Pythagorean theorem.
- Loading branch information
Showing
2 changed files
with
42 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import QtQuick | ||
import QtQuick.Controls.Material | ||
import QtQuick.Effects | ||
|
||
Rectangle { | ||
id: wave | ||
property real size: 0.0 | ||
property int centreX: width / 2 | ||
property int centreY: height / 2 | ||
color: Material.primary | ||
visible: size > 0.0 | ||
Behavior on size { | ||
NumberAnimation { duration: 300; easing.type: Easing.InOutSine; } | ||
} | ||
layer.enabled: true | ||
layer.effect: MultiEffect { | ||
maskEnabled: true | ||
maskSource: ShaderEffectSource { | ||
sourceItem: Item { | ||
width: wave.width | ||
height: wave.height | ||
Rectangle { | ||
radius: Math.ceil(Math.sqrt(Math.pow(wave.width / 2 + Math.abs(wave.centreX - wave.width / 2), 2) + Math.pow(wave.height / 2 + Math.abs(wave.centreY - wave.height / 2), 2))) | ||
width: wave.size * 2 * radius | ||
height: width | ||
x: wave.centreX - width / 2 | ||
y: wave.centreY - height / 2 | ||
} | ||
} | ||
} | ||
} | ||
} |