Forums

OverviewV-Play 1 SupportTriggeredOnStart question › Reply To: TriggeredOnStart question

OverviewV-Play 1 SupportTriggeredOnStart question › Reply To: TriggeredOnStart question
#4352

marta.wierszak

Here it is:

Image {
    id: cloudsWHITE
    x: 37
    y: -59
    width: 396
    height: 429
    source: "../../Desktop/vplayPapi/clouds.png"
    MovementAnimation {
      id: movClouds
      target: parent
      property: "pos"
      running: false
      velocity: Qt.point(0, 60)
    }
  }
  Timer {
    id: timerCloud
    running: true
    repeat: true
    onTriggered: {
      cloudsWHITE.y = -549;
      interval = 5000
      if(movClouds.running === false){
        interval = 14000;
        movClouds.start();
        movClouds.running = true
      }
      else{
        interval = 1;
        movClouds.stop();
        movClouds.running = false;
      }
    }
  }

 

In this code I repeat the image movement from the top of the window to the bottom.

To have fluent movement (moving background) I wanted to add the same image in the second timer that would start after (14/2=)7 seconds
(the first image needs 14 sec to pass all window). So I set the interval = 7 s. But the timers start working at the same time.
I don’t know if there is any esier way to create moving background, so that’s what I did.

Hopefully it is somehow clear what I wrote 😉

Voted #1 for:

  • Easiest to learn
  • Most time saving
  • Best support

Develop Cross-Platform Apps and Games 50% Faster!

  • Voted the best supported, most time-saving and easiest to learn cross-platform development tool
  • Based on the Qt framework, with native performance and appearance on all platforms including iOS and Android
  • Offers a variety of plugins to monetize, analyze and engage users
FREE!
create apps
create games
cross platform
native performance
3rd party services
game network
multiplayer
level editor
easiest to learn
biggest time saving
best support