silverlight - WPF/SL Animation Time Scaling -


i looked particular thing, because thought it's quite important , puzzling thing, didn't find on matter. i'm thinking time scaling in wpf , silverlight animations.

suppose have doubleanimation lasts 4s , animates property 0 100. it's autoreversed, or there's complementing animation reverses effects, that's not important. let's event triggering animation simple mouseover.

here's problem: hover cursor on element. property gets 0 100 in 4s. move cursor away 1s, property gets 100 75, , hover back. property gets form 75 100 in 4s. it's obvious user, animation runs 4 times slower. there way scale time of animation? if want animation run 75 100 in 1s, how that? myself thinking maybe of converter take 4 parameters (absolute beginning , end, actual beginning, , timespan whole interval) , spit out proper time. there more elegant way?

i noticed it's not problem when animations fast. human not observe difference in speed when animation runs in 0.2s or 0.1s, , maybe animations should fast possible not deteriorate experience. please treat question theoretically (hence no code sample). i'm curious if there proper way scale animation time.

if there answer question somewhere on web, please direct me there.

paweł

p.s. don't mind english, i'm not native speaker ;)

i know not answer exact question, 1 way approach capture mouseenter , mouseleave, check current animation state , pause or resume it:

<usercontrol     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"     x:class="animationtest.mainpage"     width="640" height="480">     <usercontrol.resources>         <storyboard x:name="rotate" autoreverse="true">             <doubleanimationusingkeyframes storyboard.targetproperty="(uielement.rendertransform).(compositetransform.rotation)" storyboard.targetname="textblock">                 <easingdoublekeyframe keytime="0" value="0"/>                 <easingdoublekeyframe keytime="0:0:4" value="100"/>             </doubleanimationusingkeyframes>         </storyboard>     </usercontrol.resources>      <grid x:name="layoutroot" background="white">         <textblock x:name="textblock" margin="197,216,200,215" textwrapping="wrap" text="my funky text" fontsize="32" rendertransformorigin="0.5,0.5" mouseenter="textblock_mouseenter" mouseleave="textblock_mouseleave">             <textblock.rendertransform>                 <compositetransform/>             </textblock.rendertransform>         </textblock>     </grid> </usercontrol> 

code:

private void textblock_mouseenter(object sender, mouseeventargs e) {     var state = rotate.getcurrentstate();     if (state == clockstate.stopped || state == clockstate.filling) { rotate.begin(); } else rotate.resume(); }  private void textblock_mouseleave(object sender, mouseeventargs e) {     rotate.pause(); } 

Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -