■ TextBlock 엘리먼트의 TextEffects 속성을 사용하는 방법을 보여준다.
▶ MainWindow.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 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
<Window x:Class="TestProject.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Width="800" Height="600" Title="TextBlock 엘리먼트 : TextEffects 속성 사용하기" FontFamily="나눔고딕코딩" FontSize="16"> <Grid> <Border HorizontalAlignment="Center" VerticalAlignment="Center"> <TextBlock Margin="50" FontSize="96"> icodebroker <TextBlock.TextEffects> <TextEffect x:Name="textEffect" PositionCount="1"> <TextEffect.Transform> <RotateTransform x:Name="rotateTransform" CenterX="10" CenterY="10" Angle="0" /> </TextEffect.Transform> </TextEffect> </TextBlock.TextEffects> <TextBlock.Triggers> <EventTrigger RoutedEvent="TextBlock.Loaded"> <EventTrigger.Actions> <BeginStoryboard> <Storyboard> <ParallelTimeline RepeatBehavior="Forever"> <DoubleAnimation Storyboard.TargetName="rotateTransform" Storyboard.TargetProperty="Angle" From="0" To="360" BeginTime="0:0:0.25" Duration="00:00:0.75" /> </ParallelTimeline> <DoubleAnimation Storyboard.TargetName="rotateTransform" Storyboard.TargetProperty="CenterX" RepeatBehavior="Forever" AutoReverse="True" From="30" To="370" Duration="00:00:13" /> <Int32AnimationUsingKeyFrames Storyboard.TargetName="textEffect" Storyboard.TargetProperty="PositionStart" RepeatBehavior="Forever" AutoReverse="True" Duration="0:0:11"> <Int32AnimationUsingKeyFrames.KeyFrames> <DiscreteInt32KeyFrame Value="0" KeyTime="0:0:0" /> <DiscreteInt32KeyFrame Value="1" KeyTime="0:0:1" /> <DiscreteInt32KeyFrame Value="2" KeyTime="0:0:2" /> <DiscreteInt32KeyFrame Value="3" KeyTime="0:0:3" /> <DiscreteInt32KeyFrame Value="4" KeyTime="0:0:4" /> <DiscreteInt32KeyFrame Value="5" KeyTime="0:0:5" /> <DiscreteInt32KeyFrame Value="6" KeyTime="0:0:6" /> <DiscreteInt32KeyFrame Value="7" KeyTime="0:0:7" /> <DiscreteInt32KeyFrame Value="8" KeyTime="0:0:8" /> <DiscreteInt32KeyFrame Value="9" KeyTime="0:0:9" /> <DiscreteInt32KeyFrame Value="10" KeyTime="0:0:10" /> </Int32AnimationUsingKeyFrames.KeyFrames> </Int32AnimationUsingKeyFrames> </Storyboard> </BeginStoryboard> </EventTrigger.Actions> </EventTrigger> </TextBlock.Triggers> </TextBlock> </Border> </Grid> </Window> |