File size: 1,915 Bytes
6ce4ca6
 
 
 
3165745
6ce4ca6
 
2d0da8c
 
6ce4ca6
 
2d0da8c
6ce4ca6
 
 
2d0da8c
 
6ce4ca6
 
67a499d
 
 
 
 
 
 
 
6ce4ca6
 
 
2d0da8c
67a499d
 
 
 
 
 
 
 
 
 
 
 
6ce4ca6
 
2d0da8c
 
 
 
 
 
 
 
 
6ce4ca6
 
 
 
2d0da8c
6ce4ca6
 
 
 
 
2d0da8c
6ce4ca6
 
 
 
 
 
2d0da8c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<script lang="ts">
	import InputVideoBoxUIKit from "./InputVideoBoxUIKit.svelte";
	import OutputVideoBoxUIKit from "./OutputVideoBoxUIKit.svelte";
	import VideoBoxUIKit from "./VideoBoxUIKit.svelte";
	import type { VideoInstance } from "$lib/elements/video/VideoManager.svelte";
	import { Container } from "threlte-uikit";
	import { StatusArrow } from "$lib/components/3d/ui";
	import { Tween } from "svelte/motion";
	import { cubicOut } from "svelte/easing";

	interface Props {
		visible: boolean;
		video: VideoInstance;
		onInputBoxClick: (video: VideoInstance) => void;
		onOutputBoxClick: (video: VideoInstance) => void;
		duration?: number;
		delay?: number;
	}

	let {
		visible,
		video,
		onInputBoxClick,
		onOutputBoxClick,
		duration = 100,
		delay = 0
	}: Props = $props();

	const inputColor = "rgb(34, 197, 94)";
	const outputColor = "rgb(59, 130, 246)";

	const tweenedScale = Tween.of(
		() => {
			return visible ? 1 : 0;
		},
		{ duration: duration, easing: cubicOut, delay: delay }
	);
	const tweenedOpacity = Tween.of(
		() => {
			return visible ? 1 : 0;
		},
		{ duration: duration, easing: cubicOut, delay: delay }
	);
</script>

<Container
	flexDirection="row"
	alignItems="center"
	gap={12}
	transformScaleX={tweenedScale.current}
	transformScaleY={tweenedScale.current}
	transformScaleZ={tweenedScale.current}
	opacity={tweenedOpacity.current}
>
	<!-- Input Video Box -->
	<InputVideoBoxUIKit {video} handleClick={() => onInputBoxClick(video)} />

	<!-- Arrow 1: Input to Video -->
	<StatusArrow color={inputColor} opacity={video.hasInput ? 1 : 0.5} />

	<!-- Video Box -->
	<VideoBoxUIKit {video} />

	<!-- Arrow 2: Video to Output -->
	<StatusArrow
		color={outputColor}
		opacity={video.hasInput && video.hasOutput ? 1 : video.hasInput && video.canOutput ? 0.7 : 0.5}
	/>

	<!-- Output Box -->
	<OutputVideoBoxUIKit {video} handleClick={() => onOutputBoxClick(video)} />
</Container>