I looked for this thing because I thought it was very important and mysterious, but I did not find anything about this. I am thinking about time scaling in WPF and Silverlight animations.
Suppose we have a DoubleAnimation that lasts 4 seconds and animates a property from 0 to 100. This is an auto-reverse, or complementary animation that changes its effects, it doesn’t matter. Let's say that the event that triggers this animation is a simple MouseOver.
Here's the problem: I hover over an element. The property gains from 0 to 100 in 4 s. I move my cursor for 1 s, the property gets from 100 to 75, and then I go back. Now the property takes a form from 75 to 100 in 4 s. It’s obvious to the user that the animation works 4 times slower. Is there any way to scale animation time? If I wanted this animation to work from 75 to 100 in 1 s, how would I do it? I myself think, perhaps, about a converter that will take four parameters (absolute start and end, actual start and time for the entire interval), and then spit out the right time. Is there a more elegant way?
I noticed that this is not a problem at all when the animation is fast. A person does not really observe the difference in speed when the animation runs in 0.2 s or 0.1 s, and perhaps all animations should be as fast as possible so as not to worsen the experience. But please consider this question theoretically (therefore, do not use a sample code). I'm just wondering if there is a suitable way to scale the animation time.
If there is an answer to my question somewhere on the Internet, please just direct me there.
Paweł
PS Do not mind my English, I'm not a native speaker;)
source share