import {Op, html, css} from "@benev/slate" import {styles} from "./styles.js" import {Tooltip} from "../../views/tooltip/view.js" import {shadow_component} from "../../context/context.js" import {tooltipStyles} from "../../views/tooltip/styles.js" import {StateHandler} from "../../views/state-handler/view.js" import {ImageEffect, VideoEffect} from "../../context/types.js" import circleInfoSvg from "../../icons/gravity-ui/circle-info.svg.js" import animationSvg from "../../icons/material-design-icons/animation.svg.js" import {AnimationFor, animationIn, animationNone, animationOut} from "../../context/controllers/compositor/parts/animation-manager.js" export const OmniAnim = shadow_component(use => { use.styles([styles, tooltipStyles, css` #icon-container { position: relative; top: -25px; } `]) use.watch(() => use.context.state) const controllers = use.context.controllers const [kind, setKind] = use.state<"in" | "out">("in") const manager = use.context.controllers.compositor.managers.animationManager const selectedImageOrVideoEffect = use.context.state.selected_effect?.kind === "video" || use.context.state.selected_effect?.kind === "image" ? use.context.state.effects.find(effect => effect.id === use.context.state.selected_effect!.id)! as ImageEffect | VideoEffect : null use.mount(() => { const dispose = manager.onChange(() => use.rerender()) return () => dispose() }) const getAnimationDuration = () => { if(selectedImageOrVideoEffect) { const effect = use.context.state.animations.find(a => a.targetEffect.id === selectedImageOrVideoEffect.id && a.type === kind && a.for === "Animation") const duration = effect?.duration if(duration) { return duration } else return 520 } else return 520 } const imageAndVideoEffects = () => use.context.state.effects.filter(effect => effect.kind === "image" || effect.kind === "video") as VideoEffect[] | ImageEffect[] const duration = getAnimationDuration() const renderAnimationsIn = () => { return animationIn.map(animation => { const [name, type] = animation.split("-") const anim = { type: "in" as "in" | "out", name: animation, targetEffect: selectedImageOrVideoEffect!, duration, for: "Animation" as AnimationFor } return html`
Select video or image either from dropdown menu here, timeline or scene
` ) } return StateHandler(Op.all( use.context.helpers.ffmpeg.is_loading.value, use.context.is_webcodecs_supported.value), () => html`