2017-09-26 1 views
0

Xamarin Forms에서 360도 이미지를 회전하고 싶습니다. 이 이미지는 런타임에 애니메이션과 함께 계속 회전합니다. 또한이 이미지에는 서로 다른보기의 6 가지 버전이 있습니다. 유리를 손으로 돌리는 것과 같이 생각하십시오.Xamarin Forms에서 360도 이미지 회전

나는이 하나를 시도하지만 쓸모가 : 여기

<Image Source="glass.png" RotateToY="30"/> 
+0

당신은이 페이지의 기능을 검토 할 수 있습니다. 나는 360도를위한 클래스가 있다고 생각하지 않지만, 당신은이 속성들로 당신 자신의 클래스를 작성할 수 있습니다. https://developer.xamarin.com/recipes/cross-platform/xamarin-forms/controls/rotation/ –

+0

나는이 방법을 시도한다. 그러나 나는 그걸 정확하게 원하지 않는다. 내 자신의 수업을 쓰는 것이 옳다고 생각합니다. – xamarin

답변

0

a similar question and answers on Xamarin Forums입니다.

private async Task RotateElement(VisualElement element, CancellationToken cancellation) 
{ 
    while (!cancellation.IsCancellationRequested) 
    { 
     await element.RotateTo(360, 800, Easing.Linear); 
     await element.RotateTo(0, 0); // reset to initial position 
    } 
} 
0

당신은 이미지 "회전"속성을 사용하고 필요한 경우 백그라운드 스레드를 통해 변경 및 회전 속도를 제어하기 위해 RotateTo 통해에 애니메이션을 추가 할 수 있습니다 :

허용 대답이 제안 엔드 포인트 속도/시작 :

async Task RotateImageContinously() 
{ 
    while (true) // a CancellationToken in real life ;-) 
    { 
     for (int i = 1; i < 7; i++) 
     { 
      if (image.Rotation >= 360f) image.Rotation = 0; 
      await image.RotateTo(i * (360/6), 1000, Easing.CubicInOut); 
     } 
    } 
} 

바운스 :

enter image description here

선형 :

enter image description here

큐빅 :

enter image description here

+0

완벽하게 어울립니다. – xamarin

관련 문제