1
Vote

allow naming of animations for debugging purposes

description

Allow animations to be named. This name should appear in the ToString() representation (along with its duration, etc.) of the animation for debugging purposes.
 
In C# 3.0, either all animation methods need two overloads (one with and the other without the name parameter), or (less bothersome) the Name property will have to be set outside the animation's factory extension method. If C# 4.0 is used, an optional and/or named parameter would probably be the best choice.
 
// C# 3.0
var anim = GamePiece.RotateBy(GamePiece.GetCenter(), 45, 0.5.seconds());
anim.Name = "FirstRotation";
 
// C# 4.0
var anim = GamePiece.RotateBy(GamePiece.GetCenter(), 45, 0.5.seconds(), Name="FirstRotation");
 
 
Also allow referencing animations within a group by name. Do this hierarchically.
 
var anim = Animate.Group(
Element.FadeIn(0.5.seconds(), Name="FadeIn"),
Element.RotateBy(Element.GetCenter(), 360, 1.5.seconds(), Name="RotateCompletely"),
Animate.Wait(1.seconds(),
    Element.FadeOut(0.5.seconds(), Name="FadeOut"),
    Name="InnerGroup"
    )
);
 
anim["InnerGroup"].WhenComplete(a => ...);
anim["FadeOut"].Cancel();
anim.Begin();

comments