/// <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 void StartWarningAnimation() { if (this.DesignMode) { return; } if (AnimationController.HasAnimation(this)) { return; } this.BackColor = Color.White; // linen ' Color.Yellow, 6 AnimationColourChange.CreateStart((IBlendableColourDisplay)this, Color.MistyRose, 2, int.MaxValue); }
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); }
/// <summary>Stores any text changes, returning null on success or error message</summary> private string StoreTextChanges() { if (m_TextChanged) { string error = m_Script.ParseFromScript(txtScript.Text, false); if (error != null) { AnimationColourChange.CreateStart(btnAbandonText, Color.LightYellow, 8, 1); return(error); } FillCommandList(); m_TextChanged = false; } return(null); }