Advertisement
Guest User

not working animation

a guest
Mar 7th, 2020
360
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
QML 2.46 KB | None | 0 0
  1. import QtQuick 2.12
  2. import QtQuick.Controls 2.12
  3. import Diary 1.0
  4.  
  5. Rectangle {
  6.     property alias myPassword:password.text
  7.     property bool locked: true
  8.     id:pWindow
  9.     Image {
  10.         id: background
  11.         source: "qrc:/resources/images/concrete-wall-3847504.svg"
  12.         z:0
  13.         anchors.fill: parent
  14.     }
  15.  
  16.     Image {
  17.         id: lock
  18.         anchors.centerIn: parent
  19.         width: 150
  20.         height: 150
  21.         source: {
  22.             if(locked==true){
  23.                 return "qrc:/resources/images/lock.svg"
  24.             }
  25.             else{
  26.                 return "qrc:/resources/images/unlock2.svg"
  27.             }
  28.         }
  29.         PropertyAnimation { id: unlockedAnim
  30.             target: lock
  31.             property: "y"
  32.             easing.type: Easing.OutBounce
  33.             from:0
  34.             to: -100
  35.             duration: 1200
  36.         }
  37.     }
  38.  
  39.     TextField{
  40.         id:password
  41.         z:2
  42.         width: 200
  43.         height: 30
  44.         anchors.top: lock.bottom
  45.         anchors.horizontalCenter: lock.horizontalCenter
  46.         anchors.topMargin: 20
  47.  
  48.         echoMode: "Password"
  49.         font.pixelSize: 18
  50.         color: "black"
  51.         horizontalAlignment: Text.AlignHCenter
  52.         placeholderText: "Password"
  53.         background:
  54.             Rectangle {
  55.             color: "#CC9966"
  56.         }
  57.     }
  58.     Button{
  59.         id:confirmButton
  60.         text: "Confirm"
  61.         onClicked: {
  62.             if(myPassword==="12345"){
  63.                 locked=false
  64.                 unlockedAnim.start()
  65.                 acceptedTimer.running=true;
  66.                 // подпрыгивание
  67.             }
  68.             else{
  69.                 // движение из стороны в сторону             }
  70.         }
  71.         width: 100
  72.         height: 30
  73.         anchors.top: password.bottom
  74.         anchors.horizontalCenter: password.horizontalCenter
  75.         anchors.topMargin: 10
  76.         z:2
  77.     }
  78.  
  79.     Image {
  80.         id: animeImage
  81.         x: 383
  82.         y: 89
  83.         z:1
  84.  
  85.  
  86.         width:282
  87.         height: 401
  88.         anchors.bottomMargin: -10
  89.         anchors.rightMargin: -25
  90.         anchors.right: parent.right
  91.         anchors.bottom: parent.bottom
  92.         source: { return backEnd.generateAnimeGirl()}
  93.     }
  94.  
  95.     Timer {
  96.         id:acceptedTimer
  97.         interval: 2000;
  98.         onTriggered:pWindow.visible=false
  99.  
  100.     }
  101.  
  102. }
  103.  
  104. /*##^##
  105. Designer {
  106.     D{i:0;autoSize:true;height:480;width:640}
  107. }
  108. ##^##*/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement