using Artemis.Core; using RGB.NET.Core; namespace Artemis.VisualScripting.Nodes.Mathematics; [Node("Lerp", "Interpolates linear between the two values A and B", "Mathematics", InputType = typeof(Numeric), OutputType = typeof(Numeric))] public class LerpNode : Node { #region Properties & Fields public InputPin A { get; } public InputPin B { get; } public InputPin T { get; } public OutputPin Result { get; } #endregion #region Constructors public LerpNode() : base("Lerp", "Interpolates linear between the two values A and B") { A = CreateInputPin("A"); B = CreateInputPin("B"); T = CreateInputPin("T"); Result = CreateOutputPin(); } #endregion #region Methods /// public override void Evaluate() { float a = A.Value; float b = B.Value; float t = ((float)T.Value).Clamp(0f, 1f); Result.Value = ((b - a) * t) + a; } #endregion }