360 degree image rotating in Xamarin Forms

后端 未结 3 370
一生所求
一生所求 2021-01-19 22:55

In Xamarin Forms, I want to rotate an image as 360 degree. This image rotates with animation constantly at run time. Also, this image has 6 versions of different views. Thin

3条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-19 23:47

    Here is a similar question and answers on Xamarin Forums.

    The accepted answer suggests this:

    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
        }
    }
    

提交回复
热议问题