57 lines
1.3 KiB
Plaintext
57 lines
1.3 KiB
Plaintext
@startuml dz-v1-editor-animation-flow
|
||
title ДЗ.В1 — анимация (EditorViewModel)
|
||
|
||
skinparam shadowing false
|
||
skinparam ActivityFontSize 11
|
||
skinparam ActivityBackgroundColor #F8F8F8
|
||
|
||
start
|
||
|
||
partition PlayAnimation {
|
||
if (Container == null || Documents.Count < 2?) then (да)
|
||
stop
|
||
endif
|
||
if (IsPlaying?) then (да)
|
||
stop
|
||
endif
|
||
:IsPlaying = true;
|
||
:_animationFrameIndex = индекс ActiveDocument;
|
||
}
|
||
|
||
partition AdvanceAnimationFrame {
|
||
if (Container == null || !IsPlaying?) then (да)
|
||
:StopAnimation();
|
||
stop
|
||
endif
|
||
if (Documents.Count == 0?) then (да)
|
||
:StopAnimation();
|
||
stop
|
||
endif
|
||
:index %= Count; doc = Documents[index];
|
||
:suppress on; ActiveDocument = doc; suppress off;
|
||
:RefreshCanvasFor(doc);
|
||
:delay = max(FrameDelayMs, 10);
|
||
:новый DispatcherTimer(delay);
|
||
note right
|
||
Tick: Stop timer, index++,
|
||
снова AdvanceAnimationFrame
|
||
end note
|
||
:Start();
|
||
}
|
||
|
||
floating note left
|
||
Цикл: каждый Tick на UI-потоке
|
||
снова вызывает AdvanceAnimationFrame.
|
||
Пауза кадра — FrameDelayMs документа.
|
||
end note
|
||
|
||
stop
|
||
|
||
legend right
|
||
StopAnimation: стоп таймера, IsPlaying=false,
|
||
SyncLayersAndCanvas. Команда Stop или
|
||
выход из Advance при ошибке состояния.
|
||
end legend
|
||
|
||
@enduml
|