티스토리 뷰
반응형
WPF 에니메이션 팀에서 이번에 탱탱볼을 만들었습니다.
바닥에 닿으면 약간 찌그러지다가 위로 튕겨나가는거죠!! 핫핫
이건 2탄입니다.
1탄은 당연히 이전강좌(움직이는 그림을 만들어보자) 편을 참고하세요.
코드 살펴보기 |
<!-- Animation for X value -->
<DoubleAnimation Storyboard.TargetName="myTranslate"
Storyboard.TargetProperty="X"
To="500"
Duration="0:0:10"
AutoReverse="True"
RepeatBehavior="Forever"/>
<!--
Animation for Y value --><DoubleAnimationUsingKeyFrames Duration="0:0:4.5"
Storyboard.TargetName="myTranslate"
Storyboard.TargetProperty="Y"
RepeatBehavior="Forever">
<LinearDoubleKeyFrame Value="-250" KeyTime="0:0:0"/>
<SplineDoubleKeyFrame Value="0" KeyTime="0:0:2.2" KeySpline="0, 0, 0.5, 0"/>
<LinearDoubleKeyFrame Value="0" KeyTime="0:0:2.25"/>
<SplineDoubleKeyFrame Value="-250" KeyTime="0:0:4.5" KeySpline="0, 0, 0, 0.5"/>
</DoubleAnimationUsingKeyFrames>
<!--
<DoubleAnimationUsingKeyFrames Duration="0:0:4.5"
Storyboard.TargetName="myScale"
Storyboard.TargetProperty="ScaleX"
RepeatBehavior="Forever">
<LinearDoubleKeyFrame Value="1" KeyTime="0:0:0"/>
<LinearDoubleKeyFrame Value="1" KeyTime="0:0:2"/>
<LinearDoubleKeyFrame Value="1.3" KeyTime="0:0:2.25"/>
<LinearDoubleKeyFrame Value="1" KeyTime="0:0:2.5"/>
</DoubleAnimationUsingKeyFrames>
<!--
<DoubleAnimationUsingKeyFrames Duration="0:0:4.5"
Storyboard.TargetName="myScale"
Storyboard.TargetProperty="ScaleY"
RepeatBehavior="Forever">
<LinearDoubleKeyFrame Value="1" KeyTime="0:0:0"/>
<LinearDoubleKeyFrame Value="1" KeyTime="0:0:2"/>
<LinearDoubleKeyFrame Value="0.7" KeyTime="0:0:2.25"/>
<LinearDoubleKeyFrame Value="1" KeyTime="0:0:2.5"/>
</DoubleAnimationUsingKeyFrames> 여기서 이전편보다 달라진게 있다면 바로 SppedRatio!
이 속성은 Storyboard 객체에 있는것인데 시간에 따른 속도를 정의할대 씁니다.
default값은 1이구요. 0.5등으로 수정하면 느려지겠지요.
<
Storyboard SpeedRatio="0.5">자 탱탱볼이 완성되었습니다. ^^
- Lorin 씀.
반응형
댓글