feat(CaterpillarAnimation): add style file

This commit is contained in:
Ronan Abhamon 2016-10-20 09:24:45 +02:00
parent 3fdaa51c01
commit debef9a9bc
4 changed files with 51 additions and 29 deletions

View file

@ -55,6 +55,7 @@
<file>ui/modules/Common/Popup/PopupShadow.qml</file>
<file>ui/modules/Common/qmldir</file>
<file>ui/modules/Common/SearchBox.qml</file>
<file>ui/modules/Common/Styles/Animations/CaterpillarAnimationStyle.qml</file>
<file>ui/modules/Common/Styles/CollapseStyle.qml</file>
<file>ui/modules/Common/Styles/DialogStyle.qml</file>
<file>ui/modules/Common/Styles/DroppableTextAreaStyle.qml</file>

View file

@ -1,13 +1,15 @@
import QtQuick 2.7
import Common.Styles 1.0
Row {
id: container
property int duration: 200
property int nSpheres: 3
property color sphereColor: '#8F8F8F'
property int sphereSize: 10
property int sphereSpaceSize: 10
property color sphereColor: CaterpillarAnimationStyle.sphere.color
property int animationDuration: CaterpillarAnimationStyle.animation.duration
property int nSpheres: CaterpillarAnimationStyle.nSpheres
property int sphereSize: CaterpillarAnimationStyle.sphere.size
property int animationSpace: CaterpillarAnimationStyle.animation.space
spacing: 6
@ -41,7 +43,7 @@ Row {
return
}
if (y === (sphereSpaceSize / 2) && previousY === 0) {
if (y === (animationSpace / 2) && previousY === 0) {
repeater.itemAt(index + 1).startAnimation()
}
@ -56,19 +58,19 @@ Row {
}
YAnimator on y {
duration: container.duration
duration: container.animationDuration
from: 0
id: animator
running: false
to: sphereSpaceSize / 2
to: animationSpace / 2
onRunningChanged: {
if (running) {
return
}
var mid = sphereSpaceSize / 2
if (from === sphereSpaceSize && to === mid) {
var mid = animationSpace / 2
if (from === animationSpace && to === mid) {
from = mid
to = 0
} else if (from === mid && to === 0) {
@ -80,9 +82,9 @@ Row {
}
} else if (from === 0 && to === mid) {
from = mid
to = sphereSpaceSize
to = animationSpace
} else {
from = sphereSpaceSize
from = animationSpace
to = mid
}

View file

@ -0,0 +1,17 @@
pragma Singleton
import QtQuick 2.7
QtObject {
property int nSpheres: 3
property QtObject animation: QtObject {
property int duration: 200
property int space: 10
}
property QtObject sphere: QtObject {
property color color: '#8F8F8F'
property int size: 10
}
}

View file

@ -3,22 +3,24 @@
module Common.Styles
# Components styles.
singleton CollapseStyle 1.0 CollapseStyle.qml
singleton DialogStyle 1.0 DialogStyle.qml
singleton DroppableTextAreaStyle 1.0 DroppableTextAreaStyle.qml
singleton CaterpillarAnimationStyle 1.0 Animations/CaterpillarAnimationStyle.qml
singleton ForceScrollBarStyle 1.0 ForceScrollBarStyle.qml
singleton MenuStyle 1.0 MenuStyle.qml
singleton PanedStyle 1.0 PanedStyle.qml
singleton PopupStyle 1.0 PopupStyle.qml
singleton SearchBoxStyle 1.0 SearchBoxStyle.qml
singleton CollapseStyle 1.0 CollapseStyle.qml
singleton DialogStyle 1.0 DialogStyle.qml
singleton DroppableTextAreaStyle 1.0 DroppableTextAreaStyle.qml
singleton AbstractTextButtonStyle 1.0 Form/AbstractTextButtonStyle.qml
singleton ActionBarStyle 1.0 Form/ActionBarStyle.qml
singleton CheckBoxTextStyle 1.0 Form/CheckBoxTextStyle.qml
singleton ExclusiveButtonsStyle 1.0 Form/ExclusiveButtonsStyle.qml
singleton ListFormStyle 1.0 Form/ListFormStyle.qml
singleton SmallButtonStyle 1.0 Form/SmallButtonStyle.qml
singleton TextButtonAStyle 1.0 Form/TextButtonAStyle.qml
singleton TextButtonBStyle 1.0 Form/TextButtonBStyle.qml
singleton TransparentComboBoxStyle 1.0 Form/TransparentComboBoxStyle.qml
singleton ForceScrollBarStyle 1.0 ForceScrollBarStyle.qml
singleton MenuStyle 1.0 MenuStyle.qml
singleton PanedStyle 1.0 PanedStyle.qml
singleton PopupStyle 1.0 PopupStyle.qml
singleton SearchBoxStyle 1.0 SearchBoxStyle.qml
singleton AbstractTextButtonStyle 1.0 Form/AbstractTextButtonStyle.qml
singleton ActionBarStyle 1.0 Form/ActionBarStyle.qml
singleton CheckBoxTextStyle 1.0 Form/CheckBoxTextStyle.qml
singleton ExclusiveButtonsStyle 1.0 Form/ExclusiveButtonsStyle.qml
singleton ListFormStyle 1.0 Form/ListFormStyle.qml
singleton SmallButtonStyle 1.0 Form/SmallButtonStyle.qml
singleton TextButtonAStyle 1.0 Form/TextButtonAStyle.qml
singleton TextButtonBStyle 1.0 Form/TextButtonBStyle.qml
singleton TransparentComboBoxStyle 1.0 Form/TransparentComboBoxStyle.qml