Gitea CI / Assemble and validate CI artifacts (push) Successful in 1m47s
Gitea CI / Check code and tests (push) Successful in 7m15s
Gitea CI / Build Android APK (push) Successful in 4m6s
Gitea CI / Build Windows x64 app (push) Successful in 3m34s
Gitea CI / Audit and package Windows x64 (push) Successful in 1m29s
Gitea CI / Gitea CI passed (push) Successful in 1s
Gitea Release / Prepare draft Release (push) Failing after 8s
Gitea Release / Upload Android to draft Release (push) Skipped
Gitea Release / Upload Windows to draft Release (push) Skipped
Gitea Release / Verify and publish Release (push) Skipped
185 lines
6.0 KiB
Dart
185 lines
6.0 KiB
Dart
import 'package:cutdex_core/timeline/engine.dart';
|
|
import 'package:cutdex_core/timeline/layout.dart';
|
|
import 'package:cutdex_core/timeline/model.dart';
|
|
import 'package:cutdex_timeline_ui/cutdex_timeline_ui.dart';
|
|
|
|
/// The demo host owns this media catalog; payload references remain opaque to
|
|
/// the UI and Kernel. The same classifier also builds Layout's media index.
|
|
LayoutMediaLeafClass classifyDemoMedia(ElementRecord record) =>
|
|
record.payloadRef == PayloadRef('demo-audio')
|
|
? LayoutMediaLeafClass.audioOnly
|
|
: LayoutMediaLeafClass.nonAudio;
|
|
|
|
TimelineCamera initialDemoCamera() => TimelineCamera(
|
|
baseTick: 0,
|
|
pixelsPerTick: 24 / TimelineClock.ticksPerSecond,
|
|
);
|
|
|
|
/// Optional deterministic three-hour scene; synthetic metadata, not real media.
|
|
TimelineViewController createDemoController({bool longTimeline = false}) {
|
|
final tailCount = longTimeline ? 359 : 0;
|
|
final kernel = TimelineKernel.importDto(
|
|
TimelineDto(
|
|
id: SequenceId('demo'),
|
|
format: TimelineFormat.fps24,
|
|
primaryStorylineId: StorylineId('primary'),
|
|
storylines: [
|
|
StorylineDto(
|
|
id: StorylineId('primary'),
|
|
elementIds: [
|
|
for (final id in [
|
|
'opening',
|
|
'street',
|
|
'gap',
|
|
'compound',
|
|
'voice',
|
|
'ending',
|
|
])
|
|
ElementId(id),
|
|
for (var i = 0; i < tailCount; i++) ElementId('long-$i'),
|
|
],
|
|
),
|
|
StorylineDto(
|
|
id: StorylineId('compound-content'),
|
|
elementIds: [ElementId('inside-a'), ElementId('inside-b')],
|
|
),
|
|
],
|
|
elements: [
|
|
_clip('opening', 8),
|
|
_clip('street', 10),
|
|
_clip('gap', 3, structure: ElementStructure.gap),
|
|
_clip('compound', 8, structure: ElementStructure.container),
|
|
_clip('voice', 6, audio: true),
|
|
_clip('ending', 8, enabled: false),
|
|
_clip('inside-a', 4),
|
|
_clip('inside-b', 4),
|
|
_clip('title', 5, extendable: true),
|
|
_clip('overlay', 7),
|
|
_clip('music', 18, audio: true),
|
|
_clip('ambience', 14, audio: true),
|
|
// Base scene is 42 seconds: 358 * 30 + 18 brings it to exactly 3h.
|
|
for (var i = 0; i < tailCount; i++) ...[
|
|
_clip('long-$i', i == tailCount - 1 ? 18 : 30, audio: i % 11 == 7),
|
|
if (i % 3 == 0) ...[
|
|
_clip('long-title-$i', 8, extendable: true),
|
|
_clip('long-overlay-$i', 12),
|
|
],
|
|
if (i % 5 == 0) _clip('long-audio-$i', 25, audio: true),
|
|
],
|
|
],
|
|
connections: [
|
|
_connection('title', 'opening', 2, ConnectionSide.above),
|
|
_connection('overlay', 'opening', 4, ConnectionSide.above),
|
|
_connection('music', 'opening', 0, ConnectionSide.below),
|
|
_connection('ambience', 'street', 2, ConnectionSide.below),
|
|
for (var i = 0; i < tailCount; i++) ...[
|
|
if (i % 3 == 0) ...[
|
|
_connection('long-title-$i', 'long-$i', 2, ConnectionSide.above),
|
|
_connection('long-overlay-$i', 'long-$i', 4, ConnectionSide.above),
|
|
],
|
|
if (i % 5 == 0)
|
|
_connection('long-audio-$i', 'long-$i', 0, ConnectionSide.below),
|
|
],
|
|
],
|
|
transitions: [
|
|
TransitionDto(
|
|
id: TransitionId('dissolve'),
|
|
storylineId: StorylineId('primary'),
|
|
leftId: ElementId('opening'),
|
|
rightId: ElementId('street'),
|
|
duration: RationalTime.seconds(1),
|
|
timing: TransitionTiming.overlap,
|
|
),
|
|
],
|
|
),
|
|
);
|
|
final primary = kernel.current.query().primaryStoryline;
|
|
final media = TimelineLayoutMediaIndex.build(
|
|
version: kernel.current,
|
|
classify: classifyDemoMedia,
|
|
);
|
|
const domain = LayoutDomainId('main');
|
|
final projection = const TimelineLayoutSceneBuilder()
|
|
.projectDefinitionWithMedia(
|
|
media: media,
|
|
definition: primary,
|
|
geometry: (_, _, _) => (height: 44, domain: domain),
|
|
);
|
|
final engine = TimelineLayoutEngine(kernel: kernel);
|
|
engine.buildComponents(
|
|
kernel: kernel,
|
|
components: TimelineLayoutComponents.build(
|
|
semantic: projection,
|
|
expanded: const [],
|
|
resolve: (_, _, _, _) => const [],
|
|
),
|
|
policy: LayoutPolicy(
|
|
version: 1,
|
|
stacks: [
|
|
for (final side in ConnectionSide.values)
|
|
LayoutStackPolicy(
|
|
stack: LayoutStackKey(scope: primary, side: side),
|
|
primaryBoundary: side == ConnectionSide.above ? 150 : 206,
|
|
domains: const [domain],
|
|
innerGap: 16,
|
|
bodyGap: 8,
|
|
),
|
|
],
|
|
),
|
|
);
|
|
var nextId = 0;
|
|
return TimelineViewController.editable(
|
|
engine: engine,
|
|
createConnectionId: () => ConnectionId('demo-link-${nextId++}'),
|
|
createElementId: () => ElementId('demo-blade-${nextId++}'),
|
|
geometry: TimelineViewportGeometry(primaryTop: 150, primaryHeight: 56),
|
|
camera: initialDemoCamera(),
|
|
);
|
|
}
|
|
|
|
ElementDto _clip(
|
|
String id,
|
|
int seconds, {
|
|
bool audio = false,
|
|
bool extendable = false,
|
|
bool enabled = true,
|
|
ElementStructure structure = ElementStructure.content,
|
|
}) => ElementDto(
|
|
id: ElementId(id),
|
|
name: id,
|
|
structure: structure,
|
|
sourceRange: TimeRange(
|
|
start: RationalTime.zero,
|
|
duration: RationalTime.seconds(seconds),
|
|
),
|
|
duration: RationalTime.seconds(seconds),
|
|
sourceExtendable: extendable,
|
|
mediaRange: structure == ElementStructure.content && !extendable
|
|
? TimeRange(
|
|
start: RationalTime.zero,
|
|
duration: RationalTime.seconds(seconds),
|
|
)
|
|
: null,
|
|
enabled: enabled,
|
|
payloadRef: structure == ElementStructure.content
|
|
? PayloadRef(audio ? 'demo-audio' : 'demo-visual')
|
|
: null,
|
|
containerStorylineId: structure == ElementStructure.container
|
|
? StorylineId('compound-content')
|
|
: null,
|
|
);
|
|
|
|
ConnectionDto _connection(
|
|
String target,
|
|
String anchor,
|
|
int seconds,
|
|
ConnectionSide side,
|
|
) => ConnectionDto(
|
|
id: ConnectionId(target),
|
|
anchorId: ElementId(anchor),
|
|
targetId: ElementId(target),
|
|
anchorTime: RationalTime.seconds(seconds),
|
|
targetTime: RationalTime.zero,
|
|
side: side,
|
|
);
|