Skip to content

Instantly share code, notes, and snippets.

@HamedMasafi
Created January 18, 2019 08:15
Show Gist options
  • Save HamedMasafi/1ad404dafce3993285e4f38be91976c6 to your computer and use it in GitHub Desktop.
Save HamedMasafi/1ad404dafce3993285e4f38be91976c6 to your computer and use it in GitHub Desktop.
import QtQml 2.2
import QtQuick 2.12
import QtQuick.Shapes 1.0
import QtQuick.Window 2.2
Item {
width: 300
height: 300
Shape {
id: shape
anchors.fill: parent
ShapePath {
id: circlePath1
strokeWidth: 1
strokeColor: 'black'
fillColor: 'transparent'
PathAngleArc{
id: circle1
radiusX: 30
radiusY: 30
centerX: shape.width / 2
centerY: shape.height / 2
startAngle: 0
sweepAngle: 360
}
}
ShapePath {
id: circlePath2
strokeWidth: 1
strokeColor: 'black'
fillColor: 'transparent'
PathAngleArc{
id: circle2
radiusX: 70
radiusY: 70
centerX: shape.width / 2
centerY: shape.height / 2
startAngle: 0
sweepAngle: 360
}
}
ShapePath {
id: circlePath3
strokeWidth: 1
strokeColor: 'black'
fillColor: 'transparent'
PathAngleArc{
id: circle3
radiusX: 110
radiusY: 110
centerX: shape.width / 2
centerY: shape.height / 2
startAngle: 0
sweepAngle: 360
}
}
}
Rectangle{
id: ball1
height: 20
width: 20
radius: 10
border.color: 'black'
}
Rectangle{
id: ball2
height: 20
width: 20
radius: 10
border.color: 'black'
}
Rectangle{
id: ball3
height: 20
width: 20
radius: 10
border.color: 'black'
}
PathAnimation{
path: circlePath1
running: true
loops: Animation.Infinite
duration: 2000
orientation: PathAnimation.RightFirst
anchorPoint: Qt.point(5, 9)
target: ball1
}
PathAnimation{
path: circlePath2
running: true
loops: Animation.Infinite
duration: 5000
orientation: PathAnimation.RightFirst
anchorPoint: Qt.point(5, 9)
target: ball2
}
PathAnimation{
path: circlePath3
running: true
loops: Animation.Infinite
duration: 8000
orientation: PathAnimation.RightFirst
anchorPoint: Qt.point(5, 9)
target: ball3
}
}
import QtQuick 2.12
import QtQuick.Shapes 1.0
import QtQuick.Window 2.2
Window {
visible: true
width: 640
height: 480
title: qsTr("Hello World")
Anim {
id: shape
width: 200
height: 150
anchors.centerIn: parent
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment