1. 程式人生 > >QTI圖片顏色變化大小縮放實現

QTI圖片顏色變化大小縮放實現

Image {

        id: icon
        source: "image.png"
        visible: true
        Colorize {
            anchors.fill: parent
            source: icon
            hue: 0.1 - (158 - icon.width) / 58 * 0.1  //色調
            saturation: 1  //飽和度
            lightness: -0.2  //亮度
        }
        SequentialAnimation {
            id: iconAnimation
            property real widthEnd: 100
            property real heightEnd: 90
            ParallelAnimation {
                NumberAnimation { target: icon; property: "width"; to: iconAnimation.widthEnd; duration: 300 }
                NumberAnimation { target: icon; property: "height"; to: iconAnimation.heightEnd; duration: 300 }
            }
        }
    }

Image.png
放大效果
縮小效果