■ PlaneProjection 엘리먼트의 GlobalOffsetZ 속성을 사용하는 방법을 보여준다.
▶ 예제 코드 (XAML)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
<Grid x:Name="rootGrid" Background="Gray"> <Grid.Resources> <Storyboard x:Name="storyboard"> <DoubleAnimation Storyboard.TargetName="planeProjection" Storyboard.TargetProperty="RotationX" RepeatBehavior="Forever" AutoReverse="True" Duration="0:0:3" From="0" To="60" /> <DoubleAnimation Storyboard.TargetName="planeProjection" Storyboard.TargetProperty="GlobalOffsetZ" RepeatBehavior="Forever" AutoReverse="True" Duration="0:0:3" From="0" To="400" /> </Storyboard> </Grid.Resources> <Canvas Width="400" Height="400" Background="White"> <Canvas.Effect> <DropShadowEffect /> </Canvas.Effect> </Canvas> <Image Width="400" Height="400" Source="http://127.0.0.1/sample.jpg" MouseLeftButtonDown="image_MouseLeftButtonDown"> <Image.Effect> <DropShadowEffect /> </Image.Effect> <Image.Projection> <PlaneProjection x:Name="planeProjection" /> </Image.Projection> </Image> </Grid> |
▶ 예제 코드 (C#)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
using System.Windows.Input; #region 이미지 마우스 왼쪽 버튼 DOWN시 처리하기 - image_MouseLeftButtonDown(sender, e) /// <summary> /// 이미지 마우스 왼쪽 버튼 DOWN시 처리하기 /// </summary> /// <param name="sender">이벤트 발생자</param> /// <param name="e">이벤트 인자</param> private void image_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { this.storyboard.Begin(); } #endregion |