using System.Collections.Generic; using System.Threading; using R3; using UnityEngine.UIElements; namespace KitsuneCafe.UI { public readonly struct AddTransitionEffect : IUiEffect { public readonly StylePropertyName PropertyName; public readonly TimeValue Duration; public readonly EasingFunction Easing; public readonly TimeValue Delay; public readonly IUiEffect Effect; public AddTransitionEffect(StylePropertyName name, TimeValue duration, EasingFunction easing, TimeValue delay, IUiEffect effect) { PropertyName = name; Duration = duration; Easing = easing; Delay = delay; Effect = effect; } private static StyleList ToStyleList(T value) { return new StyleList(new List { value }); } public Observable Execute(VisualElement target, CancellationToken token) { target.style.transitionProperty = ToStyleList(PropertyName); target.style.transitionDuration = ToStyleList(Duration); target.style.transitionTimingFunction = ToStyleList(Easing); target.style.transitionDelay = ToStyleList(Delay); return Effect.Execute(target, token); } } }