Files
Server/frontend/src/lib/components/scripting/ScriptEffect.svelte
T
2023-10-06 13:15:19 +02:00

74 lines
2.3 KiB
Svelte

<script lang="ts">
import type { EffectRaw } from "$lib/models/assignment";
import BFormOption from "../bforms/BFormOption.svelte";
import BFormParameter from "../bforms/BFormParameter.svelte";
export let value: EffectRaw
</script>
<BFormOption unclickable state icon="play">
<BFormParameter
narrow label="Effect" type="select" bind:value={value.kind}
options={[
{ value:"solid", label:"Solid" },
{ value:"gradient", label:"Gradient" },
{ value:"pattern", label:"Pattern" },
{ value:"random", label:"Random" },
{ value:"vrange", label:"V. Range" },
]}
/>
</BFormOption>
{#if value.kind !== "manual" && value.kind !== "vrange"}
<BFormOption alwaysOpen unclickable state={value.animationMs > 0} icon="clock_rotate_left">
<BFormParameter
narrow label="Milliseconds" type="number"
min={0} max={10000000} step={100}
bind:value={value.animationMs}
/>
{#if value.kind === "solid"}
<BFormParameter
narrower label="Interpolate" type="number"
min={0} max={10} step={1}
bind:value={value.interleave}
/>
{/if}
{#if value.kind === "gradient"}
<BFormParameter
narrower label="Reverse" type="checkbox"
bind:value={value.reverse}
/>
{/if}
{#if value.kind === "gradient" || value.kind === "random"}
<BFormParameter
narrower label="Interpolate" type="checkbox"
bind:value={value.interpolate}
/>
{/if}
</BFormOption>
{/if}
{#if value.kind === "vrange"}
<BFormOption unclickable state icon="temperature_half">
<BFormParameter
label="Variable" type="select" bind:value={value.variable}
options={[
{ value:"motion.min", label:"Min Motion" },
{ value:"motion.max", label:"Max Motion" },
{ value:"motion.avg", label:"Avg Motion" },
{ value:"temperature.min", label:"Min Temperature" },
{ value:"temperature.max", label:"Max Temperature" },
{ value:"temperature.avg", label:"Avg Temperature" },
]}
/>
<BFormParameter
narrower label="Min" type="number"
min={0} max={1000} step={1}
bind:value={value.min}
/>
<BFormParameter
narrower label="Max" type="number"
min={0} max={1000} step={1}
bind:value={value.max}
/>
</BFormOption>
{/if}