变幻:旋转,缩放,平移

RotateTransform:旋转

ScaleTransform:缩放

TranslateTransform:平移

旋转

        <Button Content="button">
            <Button.Background>
                <SolidColorBrush Color="Gold"></SolidColorBrush>
            </Button.Background>
            <Button.RenderTransform>
                <RotateTransform Angle="95" CenterX="90" CenterY="90"></RotateTransform><!--这里还有一个CenterX,CenterY属性,就是指围绕哪个点旋转,相当于绝对路径-->
            </Button.RenderTransform>
        </Button>
        <Button Content="button">
            <Button.Background>
                <SolidColorBrush Color="Gold"></SolidColorBrush>
            </Button.Background>
            <Button.RenderTransform>
                <ScaleTransform ScaleX="3" ScaleY="5"></ScaleTransform><!--这里的值是倍数,可以是负值,如果是负的,就是倒过来的效果(倒影)-->
            </Button.RenderTransform>
        </Button>
        <Button Content="button">
            <Button.Background>
                <SolidColorBrush Color="Gold"></SolidColorBrush>
            </Button.Background>
            <Button.RenderTransform>
                <TranslateTransform X="100" Y="100"></TranslateTransform>
            </Button.RenderTransform>
        </Button>

投射(围绕某个轴旋转)

        <Button Content="button">
            <Button.Background>
                <SolidColorBrush Color="Gold"></SolidColorBrush>
            </Button.Background>
            <Button.Projection>
                <PlaneProjection RotationY="30" x:Name="pp1"><!--围绕Y轴转30度-->
                    
                </PlaneProjection>
            </Button.Projection>
        </Button>
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            DispatcherTimer timer = new DispatcherTimer();
            timer.Interval = TimeSpan.FromMilliseconds(200);
            timer.Tick += timer_Tick;
            timer.Start();
        }

        private void timer_Tick(object sender, object e)
        {
            gc1.Offset += 0.01;
            gc2.Offset += 0.01;
            pp1.RotationY += 2;
        }

 

你可能感兴趣的:(缩放)