2012-09-15 8 views

답변

7

많은 번거 로움없이 이렇게하십시오. 이 방법으로 실행 애니메이션 :

Image { 
    id: toBeCreated 
    NumberAnimation on opacity { 
     id: createAnimation 
     from: 0 
     to: 1 
     duration: 2000 
    } 
    Component.onCompleted: createAnimation.start() 
} 

Image { 
    id: toBeDeleted 
    NumberAnimation on opacity { 
     id: destroyAnimation // start this animation from the function where you want to create new Images 
     to: 0 
     duration: 2000 
     onRunningChanged: { 
      if (!running) { 
       console.log("Destroying...") 
       toBeDeleted.destroy(); 
      } 
     } 
    }  
} 
0

나는 그에게 조금 늦게 알고 있지만

내가 FadeInOut 이미지 뷰

import QtQuick 2.0 

    Item { 

     property string imageSource : "" 
     property string imageSourceTemp : "" 

     property real parentWidth: 0 
     property real parentHeight: 0 

     onImageSourceChanged: 
     { 

      destroyAnimation.start() 
      createAnimation.start() 


     } 
     Image { 
      id: toBeDeleted 
      source: imageSourceTemp 
      width: parentWidth 
      height: parentHeight 

      NumberAnimation on opacity { 
       id: destroyAnimation 
       to: 0.5 
       duration: 400 
       onRunningChanged: { 
        if (!running) { 

        } 
       } 
      } 
     } 

     Image { 
      id: toBeCreated 
      source: imageSource 
      width: parentWidth 
      height: parentHeight 

      NumberAnimation on opacity { 
       id: createAnimation 
       from: 0 
       to: 1 
       duration: 800 

       onRunningChanged: { 
        if (!running) { 
         imageSourceTemp = imageSource 
        } 
       } 
      } 


     } 

    } 
에 대한

QML 같은 시도 RajaRaviVarma ANS에서 영감을 공유하는 같은 느낌

및 사용 방법

FadeinFadeOutImage { 
     id: song_image 
     imageSource: songImage 
     parentWidth: width 
     parentHeight: height 
     width: 406*scaleFactor 
     height: 406*scaleFactor 
    } 
관련 문제