Qt5 - 圖形特效

Qt5 - 圖形特效
 
安裝QtGraphicalEffects 插件:
git clone [email protected]:qt-labs/qtgraphicaleffects.git
cd qtgraphicaleffects
qmake && nmake && nmake install
 
字體發光 (Glow Text):
.qml

import QtQuick 2.0
import QtGraphicalEffects 1.0
Rectangle {
    width: 640
    height: 480
    color: "black"
    Text  {
        id: xd
        anchors.centerIn: parent
        text: qsTr("\u6211\u662f\u4e2d\u6587Hello Qt")
        color: "red"
        font.pixelSize: 80
    }
    Glow {
        id: effect
        anchors.fill: xd
        color: "#FFFFFFFF"
//        spread: 0.8
        radius: 10
        NumberAnimation on spread {
            from: 0; to: 0.8; duration: 1000
            loops: NumberAnimation.Infinite
            easing.type: Easing.InOutQuad
        }
        // Worse
//        NumberAnimation on radius {
//            from: 1.0; to: 10; duration: 1000;
//            loops: NumberAnimation.Infinite
//            easing.type: Easing.InOutQuad
//        }
        samples: 20
        visible: true
        source: xd
    }
    MouseArea {
        anchors.fill: parent
        onClicked: {
            Qt.quit();
        }
    }
}



 
參考:
發佈了27 篇原創文章 · 獲贊 1 · 訪問量 4萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章