private void StartAni(Button btnMe) { //스토리보드 Storyboard story = new Storyboard(); DoubleAnimation daTemp = null; //트랜스폼 추가 //랜드트랜스폼 생성 TransformGroup tg = new TransformGroup(); tg.Children.Add(new TranslateTransform()); tg.Children.Add(new ScaleTransform()); tg.Children.Add(new RotateTransform()); tg.Children.Add(new SkewTransform()); //랜드트랜스폼 지정 btnMe.RenderTransform = tg; //1.시작 지점 //X축 위치 daTemp = new DoubleAnimation(); daTemp.To = 20; daTemp.Duration = new Duration(TimeSpan.FromSeconds(1.0)); Storyboard.SetTarget(daTemp, btnMe); Storyboard.SetTargetProperty(daTemp, new PropertyPath("(UIElement.RenderTransform).(TransformGroup.Children)[0].(TranslateTransform.X)")); story.Children.Add(daTemp); //Y축 위치 daTemp = new DoubleAnimation(); daTemp.To = 20; daTemp.Duration = new Duration(TimeSpan.FromSeconds(1.0)); Storyboard.SetTarget(daTemp, btnMe); Storyboard.SetTargetProperty(daTemp, new PropertyPath("(UIElement.RenderTransform).(TransformGroup.Children)[0].(TranslateTransform.Y)")); story.Children.Add(daTemp); //X축 스케일 daTemp = new DoubleAnimation(); daTemp.To = 1; daTemp.Duration = new Duration(TimeSpan.FromSeconds(1.0)); Storyboard.SetTarget(daTemp, btnMe); Storyboard.SetTargetProperty(daTemp, new PropertyPath("(UIElement.RenderTransform).(TransformGroup.Children)[1].(ScaleTransform.ScaleX)")); story.Children.Add(daTemp); //Y축 스케일 daTemp = new DoubleAnimation(); daTemp.To = 1; daTemp.Duration = new Duration(TimeSpan.FromSeconds(1.0)); Storyboard.SetTarget(daTemp, btnMe); Storyboard.SetTargetProperty(daTemp, new PropertyPath("(UIElement.RenderTransform).(TransformGroup.Children)[1].(ScaleTransform.ScaleY)")); story.Children.Add(daTemp); //각도 조절 daTemp = new DoubleAnimation(); daTemp.To = 0; daTemp.Duration = new Duration(TimeSpan.FromSeconds(1.0)); Storyboard.SetTarget(daTemp, btnMe); Storyboard.SetTargetProperty(daTemp, new PropertyPath("(UIElement.RenderTransform).(TransformGroup.Children)[2].(RotateTransform.Angle)")); story.Children.Add(daTemp); //2.목표지점 //X축 위치 daTemp = new DoubleAnimation(); daTemp.To = 200; daTemp.Duration = new Duration(TimeSpan.FromSeconds(2.0)); Storyboard.SetTarget(daTemp, btnMe); Storyboard.SetTargetProperty(daTemp, new PropertyPath("(UIElement.RenderTransform).(TransformGroup.Children)[0].(TranslateTransform.X)")); story.Children.Add(daTemp); //Y축 위치 daTemp = new DoubleAnimation(); daTemp.To = 200; daTemp.Duration = new Duration(TimeSpan.FromSeconds(2.0)); Storyboard.SetTarget(daTemp, btnMe); Storyboard.SetTargetProperty(daTemp, new PropertyPath("(UIElement.RenderTransform).(TransformGroup.Children)[0].(TranslateTransform.Y)")); story.Children.Add(daTemp); //X축 스케일 daTemp = new DoubleAnimation(); daTemp.To = 2; daTemp.Duration = new Duration(TimeSpan.FromSeconds(2.0)); Storyboard.SetTarget(daTemp, btnMe); Storyboard.SetTargetProperty(daTemp, new PropertyPath("(UIElement.RenderTransform).(TransformGroup.Children)[1].(ScaleTransform.ScaleX)")); story.Children.Add(daTemp); //Y축 스케일 daTemp = new DoubleAnimation(); daTemp.To = 2; daTemp.Duration = new Duration(TimeSpan.FromSeconds(2.0)); Storyboard.SetTarget(daTemp, btnMe); Storyboard.SetTargetProperty(daTemp, new PropertyPath("(UIElement.RenderTransform).(TransformGroup.Children)[1].(ScaleTransform.ScaleY)")); story.Children.Add(daTemp); //각도 조절 daTemp = new DoubleAnimation(); daTemp.To = 90; daTemp.Duration = new Duration(TimeSpan.FromSeconds(2.0)); Storyboard.SetTarget(daTemp, btnMe); Storyboard.SetTargetProperty(daTemp, new PropertyPath("(UIElement.RenderTransform).(TransformGroup.Children)[2].(RotateTransform.Angle)")); story.Children.Add(daTemp); //3. 원점으로 //X축 위치 daTemp = new DoubleAnimation(); daTemp.To = 20; daTemp.Duration = new Duration(TimeSpan.FromSeconds(3.0)); Storyboard.SetTarget(daTemp, btnMe); Storyboard.SetTargetProperty(daTemp, new PropertyPath("(UIElement.RenderTransform).(TransformGroup.Children)[0].(TranslateTransform.X)")); story.Children.Add(daTemp); //Y축 위치 daTemp = new DoubleAnimation(); daTemp.To = 20; daTemp.Duration = new Duration(TimeSpan.FromSeconds(3.0)); Storyboard.SetTarget(daTemp, btnMe); Storyboard.SetTargetProperty(daTemp, new PropertyPath("(UIElement.RenderTransform).(TransformGroup.Children)[0].(TranslateTransform.Y)")); story.Children.Add(daTemp); //X축 스케일 daTemp = new DoubleAnimation(); daTemp.To = 1; daTemp.Duration = new Duration(TimeSpan.FromSeconds(3.0)); Storyboard.SetTarget(daTemp, btnMe); Storyboard.SetTargetProperty(daTemp, new PropertyPath("(UIElement.RenderTransform).(TransformGroup.Children)[1].(ScaleTransform.ScaleX)")); story.Children.Add(daTemp); //Y축 스케일 daTemp = new DoubleAnimation(); daTemp.To = 1; daTemp.Duration = new Duration(TimeSpan.FromSeconds(3.0)); Storyboard.SetTarget(daTemp, btnMe); Storyboard.SetTargetProperty(daTemp, new PropertyPath("(UIElement.RenderTransform).(TransformGroup.Children)[1].(ScaleTransform.ScaleY)")); story.Children.Add(daTemp); //각도 조절 daTemp = new DoubleAnimation(); daTemp.To = 0; daTemp.Duration = new Duration(TimeSpan.FromSeconds(3.0)); Storyboard.SetTarget(daTemp, btnMe); Storyboard.SetTargetProperty(daTemp, new PropertyPath("(UIElement.RenderTransform).(TransformGroup.Children)[2].(RotateTransform.Angle)")); story.Children.Add(daTemp); story.Begin(); }