здравствуйте,
ниже привожу кусок кода, который листает картинки (аналогично слайд-шоу), расположенные по кругу.Число картинок 6 штук. Код написан тупо в лоб. Фрагменты, соответствующие каждому из 6 состояний цикла разделены пустой строкой.
SequentialAnimation {
running: true
loops: Animation.Infinite
NumberAnimation {
target: main_camera; property: "index_z"
from: 25; to: 15
easing.type: Easing.OutExpo
duration: 1000
}
PauseAnimation { duration: 1000 }
NumberAnimation {
target: main_camera; property: "index_z"
from: 15; to: 25
easing.type: Easing.OutExpo
duration: 1000
}
PauseAnimation { duration: 3000 }
NumberAnimation {
target: main_camera; property: "index_1"
from: 0; to: 1
easing.type: Easing.OutExpo
duration: 3000
}
PauseAnimation { duration: 300 }
NumberAnimation {
target: main_camera; property: "index_z"
from: 25; to: 15
easing.type: Easing.OutExpo
duration: 1000
}
PauseAnimation { duration: 1000 }
NumberAnimation {
target: main_camera; property: "index_z"
from: 15; to: 25
easing.type: Easing.OutExpo
duration: 1000
}
PauseAnimation { duration: 3000 }
NumberAnimation {
target: main_camera; property: "index_1"
from: 1; to: 2
easing.type: Easing.OutExpo
duration: 3000
}
PauseAnimation { duration: 300 }
NumberAnimation {
target: main_camera; property: "index_z"
from: 25; to: 15
easing.type: Easing.OutExpo
duration: 1000
}
PauseAnimation { duration: 1000 }
NumberAnimation {
target: main_camera; property: "index_z"
from: 15; to: 25
easing.type: Easing.OutExpo
duration: 1000
}
PauseAnimation { duration: 3000 }
NumberAnimation {
target: main_camera; property: "index_1"
from: 2; to: 3
easing.type: Easing.OutExpo
duration: 3000
}
PauseAnimation { duration: 300 }
NumberAnimation {
target: main_camera; property: "index_z"
from: 25; to: 15
easing.type: Easing.OutExpo
duration: 1000
}
PauseAnimation { duration: 1000 }
NumberAnimation {
target: main_camera; property: "index_z"
from: 15; to: 25
easing.type: Easing.OutExpo
duration: 1000
}
PauseAnimation { duration: 3000 }
NumberAnimation {
target: main_camera; property: "index_1"
from: 3; to: 4
easing.type: Easing.OutExpo
duration: 3000
}
PauseAnimation { duration: 300 }
NumberAnimation {
target: main_camera; property: "index_z"
from: 25; to: 15
easing.type: Easing.OutExpo
duration: 1000
}
PauseAnimation { duration: 1000 }
NumberAnimation {
target: main_camera; property: "index_z"
from: 15; to: 25
easing.type: Easing.OutExpo
duration: 1000
}
PauseAnimation { duration: 3000 }
NumberAnimation {
target: main_camera; property: "index_1"
from: 4; to: 5
easing.type: Easing.OutExpo
duration: 3000
}
PauseAnimation { duration: 300 }
NumberAnimation {
target: main_camera; property: "index_z"
from: 25; to: 15
easing.type: Easing.OutExpo
duration: 1000
}
PauseAnimation { duration: 1000 }
NumberAnimation {
target: main_camera; property: "index_z"
from: 15; to: 25
easing.type: Easing.OutExpo
duration: 1000
}
PauseAnimation { duration: 3000 }
NumberAnimation {
target: main_camera; property: "index_1"
from: 5; to: 6
easing.type: Easing.OutExpo
duration: 3000
}
PauseAnimation { duration: 300 }
NumberAnimation {
target: main_camera; property: "index_z"
from: 25; to: 15
easing.type: Easing.OutExpo
duration: 1000
}
PauseAnimation { duration: 1000 }
NumberAnimation {
target: main_camera; property: "index_z"
from: 15; to: 25
easing.type: Easing.OutExpo
duration: 1000
}
PauseAnimation { duration: 3000 }
}
В каждом фрагменте меняются только две переменные: from: 0; to:1 (from: 1; to:2 и т.д. до 6):
NumberAnimation {
target: main_camera; property: "index_1"
from: 1; to: 2
easing.type: Easing.OutExpo
duration: 3000
}
скажите пожалуйста, можно ли это реализовать в цикле, не дублируя код?
спасибо