Wish A few additional Animation properties would be nice


Well-Known Member
Licensed User
Longtime User
I wanted to animate some views in my app so I went back and looked at Erel's animation tutorial which is pretty good

and I have a few questions.
  1. Why doesn't the Animation class have a View property (ReadOnly) that points to the view that is being animated? In the AnimationEnd method it would be nice if we could get the View that Sender is animating. In the demo's AnimationEnd event Erel compared Sender (animation) to 1 of 5 predefined global animation variables to determine the view that was being animated. But this won't work if the animation variables are created dynamically.
  2. Why doesn't the Animation class have an AnimationType property (ReadOnly) for the animation that is being performed? Namely Alpha, Rotate, RotateCenter, Scale, ScaleCenter, Translate. An Int would be fine for this property. We could then access this AnimationType property in the AnimationEnd event and know what to do next. Otherwise one has to create an AnimationEnd event for each type of animation.
  3. It would be nice if the Animation class had a Tag property so we could add some of this extraneous info to it.
I ended up solving the problem by creating a Map of Animations. I can store the Animation as the key and a Type containing the View and AnimationType is the data for this map key. In the AnimationEnd event I can then use the Sender (animation) to get the proper map entry with the View and AnimationType. I can of course access this info in timer events etc..

Using a Map is overkill for simple animations and it would be nice if one or more of the Properties I suggested could be implemented or the existing properties be made public for the Animation class.