using osu.Framework.Graphics;
using osu.Framework.Graphics.Transforms;
namespace osu.Game.Storyboards.Drawables
{
public static class DrawablesExtensions
{
///
/// Adjusts after a delay.
///
/// A to which further transforms can be added.
public static TransformSequence TransformBlendingMode(this T drawable, BlendingMode newValue, double delay = 0)
where T : Drawable
=> drawable.TransformTo(drawable.PopulateTransform(new TransformBlendingMode(), newValue, delay));
}
public class TransformBlendingMode : Transform
{
private BlendingMode valueAt(double time)
=> time < EndTime ? StartValue : EndValue;
public override string TargetMember => nameof(Drawable.BlendingMode);
protected override void Apply(Drawable d, double time) => d.BlendingMode = valueAt(time);
protected override void ReadIntoStartValue(Drawable d) => StartValue = d.BlendingMode;
}
}