UWP에서 회전 할 때 나는 꽤 새로운 것이므로 잘못된 방향으로 가고있다.UWP 회전 SunBurst
내 앱에서 햇살 이미지가 정사각형으로 많이 회전하고 싶습니다. video. 1,000x1000px 햇살 이미지를 만들었습니다. 나는 XAML과 C#을 통해 그것을 회전 시키려고했지만 내 노력으로 회전하는 사각형을 보았다. 나는 다음과 같은 방법을 시도
:
XAML :
<Page.Resources>
<Storyboard x:Key="Storyboard" x:Name="sb" >
<DoubleAnimation Storyboard.TargetName="RotateImage"
Storyboard.TargetProperty="(UIElement.RenderTransform).(RotateTransform.Angle)"
From="0" To="360" RepeatBehavior="Forever" BeginTime="00:00:00.000" Duration="00:00:5.000" />
</Storyboard>
</Page.Resources>
<Grid RelativePanel.AlignTopWithPanel="True" RelativePanel.AlignLeftWithPanel="True"
Width="300" Height="300">
<Image Source="ms-appx:///Assets/SunBurst.png" x:Name="RotateImage" Stretch="Fill">
<Image.RenderTransform>
<RotateTransform Angle="0" CenterX="150" CenterY="150" />
</Image.RenderTransform>
</Image>
</Grid>
C 번호 :
BitmapImage btpImg = new BitmapImage();
btpImg.UriSource = new Uri(@"ms-appx:///Assets/SunBurst.png");
Image img = new Image
{
Source = btpImg,
RenderTransform = new RotateTransform()
{
CenterX = 150,
CenterY = 150
},
Stretch = Stretch.Fill
};
Grid rect = new Grid
{
Width = 300,
Height = 300,
};
rect.Children.Add(img);
Storyboard storyboard = new Storyboard();
DoubleAnimation rotateAnimation = new DoubleAnimation()
{
From = 0,
To = 360,
Duration = new Duration(TimeSpan.FromSeconds(5)),
RepeatBehavior = RepeatBehavior.Forever,
};
Storyboard.SetTarget(rotateAnimation, rect);
Storyboard.SetTargetProperty(rotateAnimation, "(UIElement.RenderTransform).(RotateTransform.Angle)");
storyboard.Children.Add(rotateAnimation);
Board.Children.Add(rect);
storyboard.Begin();
사람이 원하는 효과 내가 크게 감사 것을 얻기에 어떤 프로 팁이있는 경우 .
이미지 크기가 표시되는 화면의 * 표시 가능 영역보다 커야합니다. – Pratyay