menu Animation B15H rotation

void CarStatus::getKey(bool k1,bool k2,bool k3,bool k4){
    if(k1 != m_key1 && k1)
    {
        if(m_menu0)
        {
            m_menu1 = true;
            m_menu0 = false;
            emit menu1Changed(m_menu1);
            emit firstCurrentIndexChanged(m_firstCurrentIndex);
            return ;
        }
        if(m_menu1)
        {
            m_menu2 = true ;
            emit menu2Changed(m_menu2);
            m_menu1 = false;
            emit menu1Changed(m_menu1);
            switch (m_firstCurrentIndex) {
            case 0:
                m_lightMenu1 = true ;
                emit lightMenu1Changed(m_lightMenu1);
                break;
            case 1:
                m_carInfoMenu1 = true ;
                emit carInfoMenu1Changed(m_carInfoMenu1);
                break;
            case 2:
                m_limitMenu1 = true ;
                emit limitMenu1Changed(m_limitMenu1);
                break;
            case 3:
                m_maintanceMenu1 = true ;
                emit maintanceMenu1Changed(m_maintanceMenu1);
                break;
            case 4:
                m_naviSetmenu1 = true ;
                emit naviSetmenu1Changed(m_naviSetmenu1);
                break;
            case 5:
                m_themeMenu1 = true ;
                emit themeMenu1Changed(m_themeMenu1);
                break;
            case 6:
                m_timeSetMenu1 = true ;
                emit timeSetMenu1Changed(true);
                break;
            default:
                break;
            }
            return ;
        }
        if(m_menu2 && m_timeSetMenu1&& !m_timeSetMenu2Flag && !m_timeSetMenu3Flag)//loaction can delete !m_timeSetMenu2Flag
        {
            switch(m_timeSetMenu1Index)
            {
            case 0:
                m_timeSetMenu2Flag = true;
                emit timeSetMenu2FlagChanged(m_timeSetMenu2Flag);
                break;
            case 1:
                break;
            default:
                break;
            }
            return ;
        }
        if(m_menu2 && m_timeSetMenu1 && m_timeSetMenu2Flag)
        {
            switch(m_timeSetMenu2Index)
            {
            case 0:

            case 1:
                m_timeSetMenu3Flag = true;
                emit timeSetMenu3FlagChanged(m_timeSetMenu3Flag);
                m_timeSetMenu2Flag = false;
                emit timeSetMenu2FlagChanged(m_timeSetMenu2Flag);
                break;
            }
            return ;
        }

        if(m_menu2 && m_timeSetMenu1 && m_timeSetMenu3Flag && m_timeSetMenu2Index == 0)
        {
            if(m_selectHourFlag)
            {
                m_selectHourFlag = false;
                emit selectHourFlagChanged(m_selectHourFlag);
                //emit  m_hourIndex to mcu
            }
            else //设置好分钟后,ok确认并返回上一层菜单(即当前菜单消失,上一层菜单显示)
            {
                m_selectHourFlag =true;
                emit selectHourFlagChanged(m_selectHourFlag);
                m_timeSetMenu3Flag = false;
                emit timeSetMenu3FlagChanged(m_timeSetMenu3Flag);
                m_timeSetMenu2Flag = true;
                emit timeSetMenu2FlagChanged(m_timeSetMenu2Flag);
                //emit  m_minuteIndex to mcu
            }
        }

        if(m_menu2 && m_timeSetMenu1 && m_timeSetMenu3Flag && m_timeSetMenu2Index == 1)
        {
            m_timeSetMenu3Flag = false;
            emit timeSetMenu3FlagChanged(m_timeSetMenu3Flag);
            m_timeSetMenu2Flag = true;
            emit timeSetMenu2FlagChanged(m_timeSetMenu2Flag);
            //emit  m_timeMode to mcu
            return ;
        }
        if(m_menu2 && !m_timeSetMenu2Flag && !m_timeSetMenu3Flag) //ok确认返回一级菜单,不包括时间设置
            menu2ToMenu1();
    }

    if(k2 != m_key2 && k2)
    {
        //考虑代码放置的前后顺序
        if(m_menu2 && m_timeSetMenu1 && m_timeSetMenu3Flag)
        {
            m_timeSetMenu3Flag = false;
            emit timeSetMenu3FlagChanged(m_timeSetMenu3Flag);
            m_timeSetMenu2Flag = true;
            emit timeSetMenu2FlagChanged(m_timeSetMenu2Flag);
            return ;
        }

        if(m_menu2 && m_timeSetMenu2Flag )
        {
            m_timeSetMenu2Flag = false;
            emit timeSetMenu2FlagChanged(m_timeSetMenu2Flag);
            return ;
        }

        if(m_menu2)
        {
            menu2ToMenu1();
            return ;
        }

        if(m_menu1)
        {
            m_menu1 = false;
            emit menu1Changed(m_menu1);
            m_menu0 =true;
            emit menu0Changed(m_menu0);
            return ;
        }

    }

    if(k3 != m_key3 && k3)
    {
        if(m_menu1)
        {
            m_firstCurrentIndex++;
            if(m_firstCurrentIndex>6)
                m_firstCurrentIndex = 0;
            qDebug()<<"m_firstCurrentIndex"<<m_firstCurrentIndex;
            emit firstCurrentIndexChanged(m_firstCurrentIndex);
            return ;
        }
        switch(m_firstCurrentIndex)
        {
        case 0:
            m_bgLightNum ++;
            if(m_bgLightNum>6)
                m_bgLightNum =6;
            emit bgLightNumChanged(m_bgLightNum);
            return;
        case 1:
            m_carInfoIndex ++;
            if(m_carInfoIndex > 11)
                m_carInfoIndex = 0;
            emit carInfoIndexChanged(m_carInfoIndex);
            return;
        case 2:
            m_limitIndex ++;
            if(m_limitIndex>13)
                m_limitIndex = 0;
            emit limitIndexChanged(m_limitIndex);
            return;
        case 3:
            return;
        case 4:
            return;
        case 5:
            return;
        case 6:
            if(m_menu2 && m_timeSetMenu1 && !m_timeSetMenu2Flag && !m_timeSetMenu3Flag) //满足条件最宽松的放在最后,否则在其他条件下也会执行,
            {
                m_timeSetMenu1Index ++;
                if(m_timeSetMenu1Index>1)
                    m_timeSetMenu1Index = 0;
                emit timeSetMenu1IndexChanged(m_timeSetMenu1Index);
                return;
            }
            if(m_menu2 && m_timeSetMenu1 && m_timeSetMenu2Flag)
            {
                m_timeSetMenu2Index ++;
                if(m_timeSetMenu2Index>1)
                    m_timeSetMenu2Index = 0;
                emit timeSetMenu2IndexChanged(m_timeSetMenu2Index);
                return;
            }

            if(m_menu2 && m_timeSetMenu1 && m_timeSetMenu3Flag && m_timeSetMenu2Index == 1)
            {
                m_timeModeIndex ++;
                if(m_timeModeIndex>1)
                    m_timeModeIndex = 0;
                emit timeModeIndexChanged(m_timeModeIndex);
                return;
            }

            if(m_menu2 && m_timeSetMenu1 && m_timeSetMenu3Flag && m_timeSetMenu2Index == 0)
            {
                if(m_selectHourFlag)
                {
                    m_hourIndex++;
                    if(m_hourIndex>23)
                        m_hourIndex = 0;
                    emit hourIndexChanged(m_hourIndex);
                }
                else
                {
                    m_minuteIndex++;
                    if(m_minuteIndex>59)
                        m_minuteIndex = 0;
                    emit minuteIndexChanged(m_minuteIndex);
                }
            }
            return;
        default:
            return;
        }
    }
    if(k4 != m_key4 && k4)
    {
        if(m_menu1)
        {
            m_firstCurrentIndex--;
            if(m_firstCurrentIndex>6)
                m_firstCurrentIndex = 6;
            qDebug()<<"m_firstCurrentIndex"<<m_firstCurrentIndex;
            emit firstCurrentIndexChanged(m_firstCurrentIndex);
            return;
        }
        switch(m_firstCurrentIndex)
        {
        case 0:
            m_bgLightNum --;
            if(m_bgLightNum<1)
                m_bgLightNum =0;
            emit bgLightNumChanged(m_bgLightNum);
            return;
        case 1:
            m_carInfoIndex --;
            if(m_carInfoIndex < 0)
                m_carInfoIndex = 11;
                        emit carInfoIndexChanged(m_carInfoIndex);
            return;
        case 2:
            m_limitIndex --;
            if(m_limitIndex<0)
                m_limitIndex = 13;
            emit limitIndexChanged(m_limitIndex);
            return;
        case 3:
            return;
        case 4:
            return;
        case 5:
            return;
        case 6:
            if(m_menu2 && m_timeSetMenu1)
            {
                m_timeSetMenu1Index --;
                if(m_timeSetMenu1Index>1)
                    m_timeSetMenu1Index = 1;
                emit timeSetMenu1IndexChanged(m_timeSetMenu1Index);
            }
            if(m_menu2 && m_timeSetMenu1 && m_timeSetMenu2Flag)
            {
                m_timeSetMenu2Index --;
                if(m_timeSetMenu2Index>1)
                    m_timeSetMenu2Index = 1;
                emit timeSetMenu2IndexChanged(m_timeSetMenu2Index);
            }

            if(m_menu2 && m_timeSetMenu1 && m_timeSetMenu3Flag && m_timeSetMenu2Index == 1)
            {
                m_timeModeIndex --;
                if(m_timeModeIndex>1)
                    m_timeModeIndex = 1;
                emit timeModeIndexChanged(m_timeModeIndex);
            }

            if(m_menu2 && m_timeSetMenu1 && m_timeSetMenu3Flag && m_timeSetMenu2Index == 0)
            {
                if(m_selectHourFlag)
                {
                    m_hourIndex--;
                    if(m_hourIndex>23)
                        m_hourIndex = 23;
                    emit hourIndexChanged(m_hourIndex);
                }
                else
                {
                    m_minuteIndex--;
                    if(m_minuteIndex>59)
                        m_minuteIndex = 59;
                    emit minuteIndexChanged(m_minuteIndex);
                }
            }
        }
    }
}


import QtQuick 2.0

Item {
    id:secondMenuRoot
    x:214
    y:152
    Item{
        id:secondMenuPanel
        //        Loader{
        //            id:timeSet
        //            x:-214
        //            y:-152
        //            active: false
        //            source: "qrc:/common/qml/common_qml/TimeSet.qml"
        //        }

        Item {
            id: time1Set
            x:-214
            y:-152
            scale: 0.0
            Image {
                id: timeSetbg
                x: 460
                y: 103
                source: "qrc:/menuImages/images/menu/timeSet/timeSetbg.png"
            }
            Image {
                id: selectSetTime
                x: 559
                y: 237
                opacity: 1.0
                source: "qrc:/menuImages/images/menu/timeSet/selectSetTime.png"
            }
            Image {
                id: gpsTime
                x: 774
                y: 238
                opacity: 0.7
                source: "qrc:/menuImages/images/menu/timeSet/gpsTime.png"
            }
            Image {
                id: selectIcon
                x: 524
                y: 236
                source: "qrc:/menuImages/images/menu/timeSet/selectIcon.png"
            }
            Image {
                id: gpsSelectIcon
                x:738
                y:236
                visible: false
                source: "qrc:/menuImages/images/menu/timeSet/selectIcon.png"
            }
        }

        Image {
            id: bgLightSet
            x:460 - 214
            y: 103 - 152
            scale: 0.0
            source: "qrc:/menuImages/images/menu/lightSetBg.png"
            Image {
                id: arcIcon
                x:537 - 460
                y:240 - 103
                source: "qrc:/menuImages/images/menu/arcIcon.png"
            }
        }
    }

    ListModel{
        id:secondModel
        ListElement{
            icon0:"qrc:/menuImages/images/menu/bgLightNW.png"
            icon1:"qrc:/menuImages/images/menu/bgLightSelect.png"
            word:"qrc:/menuImages/images/menu/bgLightW.png"
        }
        ListElement{
            icon0:"qrc:/menuImages/images/menu/carInfoNW.png"
            icon1:"qrc:/menuImages/images/menu/carInfoSelect.png"
            word:"qrc:/menuImages/images/menu/carInfoW.png"
        }
        ListElement{
            icon0:"qrc:/menuImages/images/menu/limiNW.png"
            icon1:"qrc:/menuImages/images/menu/limitSelect.png"
            word:"qrc:/menuImages/images/menu/limitW.png"
        }
        ListElement{
            icon0:"qrc:/menuImages/images/menu/maintanceNW.png"
            icon1:"qrc:/menuImages/images/menu/maintanceSelect.png"
            word:"qrc:/menuImages/images/menu/maintenceW.png"
        }
        ListElement{
            icon0:"qrc:/menuImages/images/menu/naviNW.png"
            icon1:"qrc:/menuImages/images/menu/naviSetSelect.png"
            word:"qrc:/menuImages/images/menu/naviW.png"
        }
        ListElement{
            icon0:"qrc:/menuImages/images/menu/tnemeNW.png"
            icon1:"qrc:/menuImages/images/menu/tnemeSelect.png"
            word:"qrc:/menuImages/images/menu/themeW.png"
        }
        ListElement{
            icon0:"qrc:/menuImages/images/menu/timeNW.png"
            icon1:"qrc:/menuImages/images/menu/timeSetSelect.png"
            word:"qrc:/menuImages/images/menu/timeW.png"
        }
    }

    property bool wordFlag: true//这边是关键技术
    property double currentScale: 1.1 //这边是关键技术
    Component{
        id:delegate
        Item {
            id: wrapper
            scale: PathView.itemScale
            z:PathView.itemZ
            transform: Rotation{
                origin.x: wrapper.PathView.itemX; origin.y: 0; axis { x: 0; y: 1; z: 0 } angle: wrapper.PathView.itemAngle
            }
            Image {
                id: menuIcon
                y:wrapper.PathView.isCurrentItem ? -8 : 0
                scale:wrapper.PathView.isCurrentItem ? secondMenuRoot.currentScale : 1.0 //这边是关键技术
                source: wrapper.PathView.isCurrentItem ? icon1 : icon0
            }
            Image {
                id: menuWord
                anchors.top: menuIcon.top
                anchors.horizontalCenter: menuIcon.horizontalCenter
                visible: secondMenuRoot.wordFlag         //这边是关键技术
                source: wrapper.PathView.isCurrentItem? "" :word
            }

       Rectangle{ //看旋转的中心的x坐标,来判断为什么重叠部分和角度不对称
                x:wrapper.PathView.itemX
                y:0
                color: "red"
                width: 6
                height: 6
                radius: 3
            }

        }
    }
    PathView{
        visible: true
        model: secondModel
        delegate: delegate
        currentIndex: HtCarStatus.firstCurrentIndex
        preferredHighlightBegin:0.5
        preferredHighlightEnd:0.5
        pathItemCount:5
        snapMode:PathView.SnapToItem
        path: Path{
            startX:100
            startY: 0;
            PathAttribute { name: "itemAlpha"; value: 0.4 }
            PathAttribute{name:"itemZ";value: 1}
            PathAttribute{name:"itemX";value:0}
            PathAttribute{id:angle1; name:"itemAngle";value:0}
            PathLine{id:line1;  x:430; y:0}
            PathPercent    {    value:    0.48;    }
            PathAttribute { name: "itemAlpha"; value: 1.0}
            PathAttribute{name:"itemZ";value: 10}
            PathAttribute{name:"itemX";value:50}
            PathAttribute{id:angle2;name:"itemAngle";value:0}
            PathLine{id:line2;  x:470; y:0}
            PathPercent    {    value:    0.52;    }
            PathLine{ x:800;    y:0 }
            PathAttribute { name: "itemAlpha"; value: 0.4}
            PathAttribute{name:"itemZ";value: 0}
            PathAttribute{name:"itemX";value:90}
            PathAttribute{id:angle3;name:"itemAngle";value:0}
        }

            

    }

    SequentialAnimation{
        id:bgLightAnimation_in
        alwaysRunToEnd: true
        running: HtCarStatus.lightMenu1
        ParallelAnimation{
            ScriptAction{script: secondMenuRoot.wordFlag = false}
            //            ScriptAction{script: menuWord.visible = false}  ReferenceError: menuWord is not defined
            NumberAnimation{target: line1 ; property: "x" ; to: 150 ; duration: 300 ; easing.type:Easing.Linear}
            NumberAnimation{target: line2 ; property: "x" ; to: 700+50 ; duration: 300 ; easing.type:Easing.Linear}

            NumberAnimation{target: angle1 ; property: "value" ; to: 60 ; duration: 300 ; easing.type:Easing.Linear}
            NumberAnimation{target: angle2 ; property: "value" ; to: 60 ; duration: 300 ; easing.type:Easing.Linear}
            NumberAnimation{target: angle3 ; property: "value" ; to: -60 ; duration: 300 ; easing.type:Easing.Linear}

            NumberAnimation{target: bgLightSet ; property: "scale" ; to: 1.0 ; duration: 300 ; easing.type:Easing.Linear}

            NumberAnimation{target: secondMenuRoot ; property: "currentScale" ; to: 0.0 ; duration: 300 ; easing.type:Easing.Linear} //这边是关键技术
        }
    }

    SequentialAnimation{
        id:bgLightAnimation_out
        alwaysRunToEnd: true
        running: false
        PauseAnimation{duration: 4000}
        ParallelAnimation{
            ScriptAction{script: secondMenuRoot.wordFlag = true}
            //            ScriptAction{script: menuWord.visible = false}  ReferenceError: menuWord is not defined
            NumberAnimation{target: line1 ; property: "x" ; to: 430 ; duration: 300 ; easing.type:Easing.Linear}
            NumberAnimation{target: line2 ; property: "x" ; to: 470 ; duration: 300 ; easing.type:Easing.Linear}

            NumberAnimation{target: angle1 ; property: "value" ; to: 0 ; duration: 300 ; easing.type:Easing.Linear}
            NumberAnimation{target: angle2 ; property: "value" ; to: 0 ; duration: 300 ; easing.type:Easing.Linear}
            NumberAnimation{target: angle3 ; property: "value" ; to: 0 ; duration: 300 ; easing.type:Easing.Linear}

            NumberAnimation{target: bgLightSet ; property: "scale" ; to: 0.0 ; duration: 300 ; easing.type:Easing.Linear}

            NumberAnimation{target: secondMenuRoot ; property: "currentScale" ; to: 1.1 ; duration: 300 ; easing.type:Easing.Linear}
        }
    }

    SequentialAnimation{
        id:time1SetAnimation_in
        alwaysRunToEnd: true
        running: HtCarStatus.timeSetMenu1
        ParallelAnimation{
            ScriptAction{script: secondMenuRoot.wordFlag = false}
            //            ScriptAction{script: menuWord.visible = false}  ReferenceError: menuWord is not defined
            NumberAnimation{target: line1 ; property: "x" ; to: 150 ; duration: 300 ; easing.type:Easing.Linear}
            NumberAnimation{target: line2 ; property: "x" ; to: 700+50 ; duration: 300 ; easing.type:Easing.Linear}

            NumberAnimation{target: angle1 ; property: "value" ; to: 60 ; duration: 300 ; easing.type:Easing.Linear}
            NumberAnimation{target: angle2 ; property: "value" ; to: 60 ; duration: 300 ; easing.type:Easing.Linear}
            NumberAnimation{target: angle3 ; property: "value" ; to: -60 ; duration: 300 ; easing.type:Easing.Linear}

            NumberAnimation{target: time1Set ; property: "scale" ; to: 1.0 ; duration: 300 ; easing.type:Easing.Linear}

            NumberAnimation{target: timeSetSelect ; property: "opacity" ; to: 0.0 ; duration: 300 ; easing.type:Easing.Linear}
            NumberAnimation{target: timeSetSelect ; property: "scale" ; to: 0.0 ; duration: 300 ; easing.type:Easing.Linear}
        }
    }

    SequentialAnimation{
        id:time1SetAnimation_out
        alwaysRunToEnd: true
        running: false
        PauseAnimation{duration: 4000}
        ParallelAnimation{
            ScriptAction{script: secondMenuRoot.wordFlag = true}
            //            ScriptAction{script: menuWord.visible = false}  ReferenceError: menuWord is not defined
            NumberAnimation{target: line1 ; property: "x" ; to: 430 ; duration: 300 ; easing.type:Easing.Linear}
            NumberAnimation{target: line2 ; property: "x" ; to: 470 ; duration: 300 ; easing.type:Easing.Linear}

            NumberAnimation{target: angle1 ; property: "value" ; to: 0 ; duration: 300 ; easing.type:Easing.Linear}
            NumberAnimation{target: angle2 ; property: "value" ; to: 0 ; duration: 300 ; easing.type:Easing.Linear}
            NumberAnimation{target: angle3 ; property: "value" ; to: 0 ; duration: 300 ; easing.type:Easing.Linear}

            NumberAnimation{target: time1Set ; property: "scale" ; to: 0.0 ; duration: 300 ; easing.type:Easing.Linear}

            NumberAnimation{target: timeSetSelect ; property: "opacity" ; to: 1.0 ; duration: 300 ; easing.type:Easing.Linear}
            NumberAnimation{target: timeSetSelect ; property: "scale" ; to: 1.1 ; duration: 300 ; easing.type:Easing.Linear}
        }
    }

    SequentialAnimation{
        id:abgLightAnimation_in
        alwaysRunToEnd: true
        running: HtCarStatus.lightMenu1
        ParallelAnimation{
            ScriptAction{script: secondMenuRoot.wordFlag = false}
            //            ScriptAction{script: menuWord.visible = false}  ReferenceError: menuWord is not defined
            NumberAnimation{target: line1 ; property: "x" ; to: 150 ; duration: 300 ; easing.type:Easing.Linear}
            NumberAnimation{target: line2 ; property: "x" ; to: 700+50 ; duration: 300 ; easing.type:Easing.Linear}

            NumberAnimation{target: angle1 ; property: "value" ; to: 60 ; duration: 300 ; easing.type:Easing.Linear}
            NumberAnimation{target: angle2 ; property: "value" ; to: 60 ; duration: 300 ; easing.type:Easing.Linear}
            NumberAnimation{target: angle3 ; property: "value" ; to: -60 ; duration: 300 ; easing.type:Easing.Linear}

            NumberAnimation{target: bgLightSet ; property: "scale" ; to: 1.0 ; duration: 300 ; easing.type:Easing.Linear}

            NumberAnimation{target: bgLightSelect ; property: "opacity" ; to: 0.0 ; duration: 300 ; easing.type:Easing.Linear}
            NumberAnimation{target: bgLightSelect ; property: "scale" ; to: 0.0 ; duration: 300 ; easing.type:Easing.Linear}
        }
    }

    SequentialAnimation{
        id:abgLightAnimation_out
        alwaysRunToEnd: true
        running: false
        PauseAnimation{duration: 4000}
        ParallelAnimation{
            ScriptAction{script: secondMenuRoot.wordFlag = true}
            //            ScriptAction{script: menuWord.visible = false}  ReferenceError: menuWord is not defined
            NumberAnimation{target: line1 ; property: "x" ; to: 430 ; duration: 300 ; easing.type:Easing.Linear}
            NumberAnimation{target: line2 ; property: "x" ; to: 470 ; duration: 300 ; easing.type:Easing.Linear}

            NumberAnimation{target: angle1 ; property: "value" ; to: 0 ; duration: 300 ; easing.type:Easing.Linear}
            NumberAnimation{target: angle2 ; property: "value" ; to: 0 ; duration: 300 ; easing.type:Easing.Linear}
            NumberAnimation{target: angle3 ; property: "value" ; to: 0 ; duration: 300 ; easing.type:Easing.Linear}

            NumberAnimation{target: bgLightSet ; property: "scale" ; to: 0.0 ; duration: 300 ; easing.type:Easing.Linear}

            NumberAnimation{target: bgLightSelect ; property: "opacity" ; to: 1.0 ; duration: 300 ; easing.type:Easing.Linear}
            NumberAnimation{target: bgLightSelect ; property: "scale" ; to: 1.1 ; duration: 300 ; easing.type:Easing.Linear}
        }
    }




















}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值