[QT] 自转的圆形Image描画

版权声明: https://blog.csdn.net/u010210864/article/details/80755303

import QtGraphicalEffects 1.0

        Item{
            id:iIcon
            x:0
            anchors.verticalCenter: parent.verticalCenter
            width: 50
            height: 50

            Image
            {
                id:idefault
                source: "./2.png"
                anchors.fill: parent
                sourceSize: Qt.size(parent.width, parent.height)
                smooth: true
                visible: false
            }

            Image
            {
                id:imask
                source: "./b.png" // 圆形图片,模具宽50,高50
                anchors.fill: parent
                smooth: true
                visible: false
            }

            OpacityMask
            {
                id:iOpacityMask
                anchors.fill: parent
                source: idefault
                maskSource: imask

                PropertyAnimation
                {
                    id:iconAni
                    running: true
                    loops: Animation.Infinite
                    target: iOpacityMask
                    from: 0
                    to: 360
                    property: "rotation"
                    duration: 5000 // 5秒转一圈
                    easing.type: Easing.Linear
                }
            }

        }
 

猜你喜欢

转载自blog.csdn.net/u010210864/article/details/80755303
QT
今日推荐