Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I have not tried your animation approach, i tried to implement my own logic to to this.</p> <p>First i am inspired by zooming animation used by <a href="http://picasa.google.com" rel="nofollow">Picasa</a>. So i tried to implement similar type of animation and this works fine for me on my core2duo processor with image size of 10000x5000 without any lag. This approach consumed a lot of memory, but when i compared my memory usage with <a href="http://picasa.google.com" rel="nofollow">Picasa ImageViewer</a> it was almost same. This approach may increase the loading time of your application but this can be handled and not a problem here.</p> <p>Here is the Code for Main Window Grid that i have Used.</p> <pre><code>&lt;Grid&gt; &lt;Grid.RowDefinitions&gt; &lt;RowDefinition Height="Auto" /&gt; &lt;RowDefinition Height="*" /&gt; &lt;/Grid.RowDefinitions&gt; &lt;Button Grid.Row="0" Height="30" Width="100" Content="Zoom" Click="ButtonZoom_OnClick" /&gt; &lt;Image RenderOptions.BitmapScalingMode="HighQuality" Stretch="Uniform" Width="100" Height="100" Grid.Row="1" Margin="30" VerticalAlignment="Center" HorizontalAlignment="Center" Source="mad1.jpg" Name="ImageMain" x:FieldModifier="private" /&gt; &lt;/Grid&gt; </code></pre> <p>Button Click event Code</p> <pre><code>private void ButtonZoom_OnClick(object sender, RoutedEventArgs e) { Task.Factory.StartNew(() =&gt; { var i = 0; while (i++ &lt; 100) { var i1 = i; //var i1 = (-0.00092)*(i*i) + (0.092)*i + 0.2; Dispatcher.Invoke(new Action(() =&gt; { if (i1 &lt; 10 || i1 &gt; 90) { ImageMain.Height += 0.5; ImageMain.Width += 0.5; } else if (i1 &lt; 30 || i1 &gt; 70) { ImageMain.Height += 1; ImageMain.Width += 1; } else { ImageMain.Height += 3; ImageMain.Width += 3; } })); Thread.Sleep(30); } }); } </code></pre> <p>The commented line in this code is a quadratic equation for a smooth animation for acceleration and acceleration of animation. the roots are calculated for starting zooming by 0.2 and half at 2.5 and stops at 0.2 with in range of [0-100]. if you want to create your fully customized animation you may use <a href="http://www.wolframalpha.com/" rel="nofollow">WolframAlpha</a> to check your animation graph. but the simple approach is to use simple control statements to control your animation.</p> <p>This code is only for zooming your image, your approach will be similar for zoom out.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload