import QtQuick 2.0 Rectangle { function randomInteger(min, max) { return Math.floor(Math.random() * (max - min + 1)) + min; } width:100 height:100 color:Qt.rgba(Math.random(),Math.random(),Math.random(),1); NumberAnimation on x {loops: Animation.Infinite; from: randomInteger(0, 1920); to: randomInteger(0, 1920); duration: 500 } NumberAnimation on y {loops: Animation.Infinite; from: randomInteger(0, 900); to: randomInteger(0, 900); duration: 500 } }