qml 动画 PathAnimation

import QtQuick 2.0

Item {

    Rectangle{
        id: m_rect
        width: 100
        height: 100
        color: "red"

        PathAnimation {
            target: m_rect
            running: true
            duration: 8000
            path: Path {
                //注:没有开始点

                PathLine { x: 200; y: 0}

                PathLine { x: 200; y: 200}

                PathLine { x: 0; y: 200}

                PathLine {}    //写空值表示回到原位
            }
        }
    }

}

import QtQuick 2.0

Item {

    Rectangle{
        id: m_rect
        width: 100
        height: 100
        color: "red"

        PathAnimation {
            target: m_rect
            running: true
            duration: 8000
            path: Path {
                //注:没有开始点

                PathQuad { x: 200; y: 0}

                PathQuad { x: 200; y: 200}

                PathQuad { x: 0; y: 200}

                PathQuad {}    //写空值表示回到原位
            }
        }
    }

}

import QtQuick 2.0

Item {

    Rectangle{
        id: m_rect
        width: 100
        height: 100
        color: "red"

        PathAnimation {
            target: m_rect
            running: true
            duration: 8000
            path: Path {
                //注:没有开始点

                PathCubic { x: 200; y: 0}

                PathCubic { x: 200; y: 200}

                PathCubic { x: 0; y: 200}

                PathCubic {}    //写空值表示回到原位
            }
        }
    }

}

import QtQuick 2.0

Item {

    Rectangle{
        id: m_rect
        width: 100
        height: 100
        color: "red"

        PathAnimation {
            target: m_rect
            running: true
            duration: 8000
            path: Path {
                //注:没有开始点

                PathCurve { x: 200; y: 0}

                PathCurve { x: 200; y: 200}

                PathCurve { x: 0; y: 200}

                PathCurve {}    //写空值表示回到原位
            }
        }
    }

}

猜你喜欢

转载自blog.csdn.net/yongwoozzang/article/details/110846479
今日推荐