PDA

View Full Version : DoubleAnimationUsingKeyFrames



Davood_amega
پنج شنبه 12 شهریور 1388, 23:00 عصر
DoubleAnimationUsingKeyFrames


LinearDoubleKeyFrame: به صورت خطی و پیوسته تغییرات انجام می شود.

DiscreteDoubleKeyFrame: به صورت گسسته و آنی تغییرات انجام می شود.

SplineDoubleKeyFrame : مثل LinearDoubleKeyFrame است با این تفاوت که دارای خصوصیت KeySpline است .


[
<BeginStoryboard>

<Storyboard>
<!-- Animate the TranslateTransform.X property using 3 KeyFrames
which animates the rectangle along a straight line.
This animation repeats indefinitely. -->
<DoubleAnimationUsingKeyFrames
Storyboard.TargetName="AnimatedTranslateTransform"
Storyboard.TargetProperty="X"
Duration="0:0:6"
RepeatBehavior="Forever">
<!-- Using a LinearDoubleKeyFrame, the rectangle moves
steadily from its starting position to 500 over
the first 3 seconds. -->
<LinearDoubleKeyFrame Value="500" KeyTime="0:0:3" />
<!-- Using a DiscreteDoubleKeyFrame, the rectangle suddenly
appears at 400 after the fourth second of the animation. -->
< DiscreteDoubleKeyFrame Value="400" KeyTime="0:0:4" />
<!-- Using a SplineDoubleKeyFrame, the rectangle moves
back to its starting point. The
animation starts out slowly at first and then speeds up.
This KeyFrame ends after the 6th
second. -->
<SplineDoubleKeyFrame KeySpline="0.6 0.0 0.9 0.00" Value="0" KeyTime="0:0:6" />
<!-- KeySpline="0.6,0.0,0.9,0.00" Or KeySpline="0.6,0.0 0.9,0.00" -->
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</BeginStoryboard>




نکته:
در مثال زیر برای اینکه می خواهیم تغییرات تا ثانیه 2 ثابت باشد به این صورت نوشتیم و از زمان 2 تا 3 تغییرات به صورت خطی انجام می شود.
<SplineDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
<SplineDoubleKeyFrame KeyTime="00:00:02" Value="0"/>
<SplineDoubleKeyFrame KeyTime="00:00:03" Value="1"/>

Davood_amega
جمعه 13 شهریور 1388, 12:22 عصر
یک سری مثال دارم که یادم نیست از کجا پیدا کردم که یکیشون در همین مورده.
با تشکر از منبعش!!!!!!!!!!!!!!!!