/// <inheritdoc /> public override bool UpdateCell(Cell cell) { Color oldForeground = cell.Foreground; Color oldBackground = cell.Background; if (FadeForeground) { if (UseCellForeground) { DestinationForeground.Stops[UseCellDestinationReverse ? DestinationForeground.Stops.Length - 1 : 0].Color = cell.State.Value.Foreground; } cell.Foreground = DestinationForeground.Lerp((float)_calculatedValue); } if (FadeBackground) { if (UseCellBackground) { DestinationBackground.Stops[UseCellDestinationReverse ? DestinationBackground.Stops.Length - 1 : 0].Color = cell.State.Value.Background; } cell.Background = DestinationBackground.Lerp((float)_calculatedValue); } return(oldForeground != cell.Foreground || oldBackground != cell.Background); }
public override bool Apply(Cell cell) { if (cell.State == null) { cell.SaveState(); } var oldForeground = cell.Foreground; var oldBackground = cell.Background; if (FadeForeground) { if (UseCellForeground) { DestinationForeground.Stops[0].Color = cell.State.Value.Foreground; } cell.Foreground = DestinationForeground.Lerp((float)_calculatedValue); } if (FadeBackground) { if (UseCellBackground) { DestinationBackground.Stops[0].Color = cell.State.Value.Background; } cell.Background = DestinationBackground.Lerp((float)_calculatedValue); } return(oldForeground != cell.Foreground || oldBackground != cell.Background); }
/// <inheritdoc /> public override bool ApplyToCell(ColoredGlyph cell, EffectsManager.ColoredGlyphState originalState) { Color oldForeground = cell.Foreground; Color oldBackground = cell.Background; if (FadeForeground) { if (UseCellForeground) { DestinationForeground.Stops[UseCellDestinationReverse ? DestinationForeground.Stops.Length - 1 : 0].Color = originalState.Foreground; } cell.Foreground = DestinationForeground.Lerp((float)_calculatedValue); } if (FadeBackground) { if (UseCellBackground) { DestinationBackground.Stops[UseCellDestinationReverse ? DestinationBackground.Stops.Length - 1 : 0].Color = originalState.Background; } cell.Background = DestinationBackground.Lerp((float)_calculatedValue); } return(oldForeground != cell.Foreground || oldBackground != cell.Background); }
public override void Apply(Cell cell) { if (FadeForeground) { if (UseCellForeground) { DestinationForeground.Stops[0].Color = cell.Foreground; } cell.ActualForeground = DestinationForeground.Lerp((float)_calculatedValue); } if (FadeBackground) { if (UseCellBackground) { DestinationBackground.Stops[0].Color = cell.Background; } cell.ActualBackground = DestinationBackground.Lerp((float)_calculatedValue); } }
//public override bool Equals(ICellEffect effect) //{ // if (effect is Fade) // { // if (base.Equals(effect)) // { // var effect2 = (Fade)effect; // return DestinationBackground == effect2.DestinationBackground && // DestinationForeground == effect2.DestinationForeground && // FadeForeground == effect2.FadeForeground && // FadeBackground == effect2.FadeBackground && // UseCellForeground == effect2.UseCellForeground && // UseCellBackground == effect2.UseCellBackground && // FadeDuration == effect2.FadeDuration && // Permanent == effect2.Permanent && // RemoveOnFinished == effect2.RemoveOnFinished && // StartDelay == effect2.StartDelay; // } // } // return false; //} /// <inheritdoc /> public override string ToString() => string.Format("FADE-{0}-{1}-{2}-{3}-{4}-{5}-{6}-{7}", DestinationBackground.ToString(), DestinationForeground.ToString(), FadeBackground, FadeForeground, FadeDuration, Permanent, StartDelay, RemoveOnFinished);