Home > Back-end >  QML implementation effect of entertaining diversions
QML implementation effect of entertaining diversions

Time:09-25

this article through the QML entertaining diversions effect is achieved, as the topic, on this basis to achieve more control,
a, the effect is:
1, the gradient background;
2, the word placed at the top, from left to right, monkey cycle,

2, directly on the code, flat and agile:
QML:
//RunHorseText QML 
The import QtQuick 2.0
The import QtGraphicalEffects 1.0
The import QtQuick. Controls 1.2
Item {
Id: rootWidget
Width: 1080
Height: 100

The Text {
Id: linearLabel
The font, bold: true
The font. PixelSize: 50
Color: "red"
The font family: "Microsoft jas black
"Text: "You are welcome!"
Z: 1
}

That LinearGradient {
Anchors. The fill: parent
Start: Qt. Point (0, the parent. Height/2)
End: Qt. Point (the parent. The width, the parent. Height/2)
Gradient: gradient {
//position can change the linear position of the transparent, color is the color of the font (on both sides should be transparent)
//this is the font background behind
GradientStop {position: 0.0; Color: Qt rgba (255255255,0.1)}
GradientStop {position: 0.3; Color: blue ""}
GradientStop {position: 0.7; Color: blue ""}
GradientStop {position: 1.0; Color: Qt rgba (255255255,0.1)}
}
}

PathAnimation {
Id: pathTextMove
Target: linearLabel
The duration of the//animation
Duration: 6000
//the number of animation for
Loops: 2000
OrientationEntryDuration: 0;
OrientationExitDuration: 0;
Orientation: PathAnimation LeftFirst
Path: the path {
StartX: rootWidget. Width + linearLabel. Width/2
StartY: rootWidget. Height/2 - linearLabel. Height/2
PathLine {
X: 0 - linearLabel. Width
Y: rootWidget. Height/2 - linearLabel. Height/2
}
}
Running: true
}
}
  • Related