fix: deterministic media bg shape sizes
Also tweak opacities
This commit is contained in:
parent
a4163d2c7c
commit
89cdfc9367
1 changed files with 5 additions and 5 deletions
|
|
@ -17,8 +17,8 @@ Item {
|
||||||
property real maxSpeed: 18
|
property real maxSpeed: 18
|
||||||
property real minRotSpeed: -12
|
property real minRotSpeed: -12
|
||||||
property real maxRotSpeed: 12
|
property real maxRotSpeed: 12
|
||||||
property list<real> lightOpacities: [0.34, 0.34, 0.08, 0.16]
|
property list<real> lightOpacities: [0.34, 0.34, 0.08, 0.2]
|
||||||
property list<real> darkOpacities: [0.16, 0.16, 0.05, 0.16]
|
property list<real> darkOpacities: [0.16, 0.16, 0.04, 0.16]
|
||||||
|
|
||||||
function rand(min: real, max: real): real {
|
function rand(min: real, max: real): real {
|
||||||
return min + Math.random() * (max - min);
|
return min + Math.random() * (max - min);
|
||||||
|
|
@ -73,15 +73,15 @@ Item {
|
||||||
property real vr: root.rand(root.minRotSpeed, root.maxRotSpeed)
|
property real vr: root.rand(root.minRotSpeed, root.maxRotSpeed)
|
||||||
readonly property int colourIdx: Math.floor(Math.random() * 4)
|
readonly property int colourIdx: Math.floor(Math.random() * 4)
|
||||||
|
|
||||||
implicitSize: root.rand(root.minSize, root.maxSize)
|
implicitSize: root.minSize + (index / root.count) * (root.maxSize - root.minSize)
|
||||||
shape: root.shapePool[Math.floor(Math.random() * root.shapePool.length)]
|
shape: root.shapePool[Math.floor(Math.random() * root.shapePool.length)]
|
||||||
color: [Colours.palette.m3primaryContainer, Colours.palette.m3secondaryContainer, Colours.palette.m3tertiaryContainer, Colours.palette.m3outlineVariant][colourIdx]
|
color: [Colours.palette.m3primaryContainer, Colours.palette.m3secondaryContainer, Colours.palette.m3tertiaryContainer, Colours.palette.m3outlineVariant][colourIdx]
|
||||||
opacity: Colours.light ? root.lightOpacities[colourIdx] : root.darkOpacities[colourIdx]
|
opacity: Colours.light ? root.lightOpacities[colourIdx] : root.darkOpacities[colourIdx]
|
||||||
rotation: root.rand(0, 360)
|
rotation: root.rand(0, 360)
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
shapeItem.x = root.rand(-shapeItem.implicitSize / 2, root.width - shapeItem.implicitSize / 2);
|
x = root.rand(0, root.width - implicitSize);
|
||||||
shapeItem.y = root.rand(-shapeItem.implicitSize / 2, root.height - shapeItem.implicitSize / 2);
|
y = root.rand(0, root.height - implicitSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
Behavior on color {
|
Behavior on color {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue