/// <summary>Repeats should usually be an odd number: changing to the new colour is no repeat and back again is the first, so an odd number is required to finish on the colour we started on</summary> internal static void CreateStart(IBlendableColourDisplay target, Color newColour, int step = 16, int repeats = 0) { // only calls Start if there was no previous animation on this target if (Exists(target)) { return; } AnimationColourChange animation = (AnimationColourChange)Create(target, newColour, step, repeats); animation?.Start(); }
private static AnimationColourChange Create(IBlendableColourDisplay target, Color newColour, int step = 16, int repeats = 0) { if (Exists(target)) { return(Item(target) as AnimationColourChange); } Debug.Assert(repeats == 0 || repeats % 2 == 1); AnimationColourChange animation = new AnimationColourChange(newColour, step, repeats) { m_Target = target }; Add(animation); return(animation); }