캔버스의 오른쪽 하단 모서리에서 캔버스의 왼쪽 위 모서리까지 이미지를 가져와이 동작을 영원히 반복하려고합니다. 이미지는 왼쪽 상단 모서리에서 오른쪽 상단 모서리까지 반대 애니메이션을 수행해서는 안됩니다. 나는 애니메이션으로 새롭기 때문에 this example을 사용했습니다.애니메이션 AutoReverse = false이지만 어쨌든 시작 지점이 잘못되었습니다.
현재 내 이미지가 왼쪽 상단에서 오른쪽 하단 모서리로 이동 중입니다. 캔버스에서 이미지의 시작 위치를 변경해 보았습니다. 그 결과 애니메이션은이 위치를 새로운 시작점으로 사용했습니다. 나는 또한 음의 값을 사용하여 이미지를 반대 방향으로 이동 시키려고 시도했다. 세그먼트의 포인트를 줄이면 애니메이션 경로가 더 짧아졌지만 그 밖의 것은 없습니다. 또한 애니메이션 동작을 변경하지 않고 AutoReverse = false를 설정합니다.
제 아이디어는 입니다. 세그먼트 클래스는 포인트에서 원을 만들지 만 다른 클래스는 사용할 수 있습니까? - 시작 위치를 변경해야하지만 화면에서 아래로 움직이지 않고 개체를 위로 이동하려면 어떻게해야합니까?
내 코드,
Storyboard animationSB = new Storyboard();
//Image book = createImage(model.keywordCollection[0].cover.small);
Image rope1 = createImage("pack://application:,,,/GUI;component/Resources/rope_trans.png");
rope1.Height = 360.0;
rope1.Width = 185.0;
//Transform to move the book image
TranslateTransform aniRope1 = new TranslateTransform();
this.RegisterName("AnimatedRope1", aniRope1);
rope1.RenderTransform = aniRope1;
Canvas.SetLeft(rope1, 258.659);
Canvas.SetTop(rope1, 583.212);
LeftRope.Children.Add(rope1);
//Anitmation path
PathGeometry animationPath1 = new PathGeometry();
PathFigure pathFigure1 = new PathFigure();
PolyLineSegment lineSegments1 = new PolyLineSegment();
lineSegments1.Points.Add(new Point(LeftRope.ActualWidth, LeftRope.ActualHeight));
lineSegments1.Points.Add(new Point(258.659, 583.212));
lineSegments1.Points.Add(new Point(120.596, 272.665));
lineSegments1.Points.Add(new Point(0, 0));
pathFigure1.Segments.Add(lineSegments1);
animationPath1.Figures.Add(pathFigure1);
animationPath1.Freeze();
//Animate transform to move image along the path on the x-axis
DoubleAnimationUsingPath translateXAnimation1 = new DoubleAnimationUsingPath();
translateXAnimation1.PathGeometry = animationPath1;
translateXAnimation1.Duration = TimeSpan.FromSeconds(6);
translateXAnimation1.Source = PathAnimationSource.X;
translateXAnimation1.AutoReverse = false;
Storyboard.SetTargetName(translateXAnimation1, "AnimatedRope1");
Storyboard.SetTargetProperty(translateXAnimation1, new PropertyPath(TranslateTransform.XProperty));
//Animate transform to move image along the path on the y-axis
DoubleAnimationUsingPath translateYAnimation1 = new DoubleAnimationUsingPath();
translateYAnimation1.PathGeometry = animationPath1;
translateYAnimation1.Duration = TimeSpan.FromSeconds(6);
translateYAnimation1.Source = PathAnimationSource.Y;
translateYAnimation1.AutoReverse = false;
Storyboard.SetTargetName(translateYAnimation1, "AnimatedRope1");
Storyboard.SetTargetProperty(translateYAnimation1, new PropertyPath(TranslateTransform.YProperty));
//Create Storyboard containing and applying the animation
//animationSB.RepeatBehavior = RepeatBehavior.Forever;
animationSB.Children.Add(translateXAnimation1);
animationSB.Children.Add(translateYAnimation1);
animationSB.AutoReverse = false;
스토리 보드는 다른 방법에서 시작됩니다.
저는 Windows 8.1N .Net 4.5.1 C#으로 데스크톱 응용 프로그램을 개발 중입니다.
당신은 라인 교체해야