i have lebel that rotate throw the z axis but i want to attache that aplliction to anoter labels for that i need to style it but i dont know how to do it can someone else in the world can tell me the answer? <!--from here i want to style the code so i can reuse it agiane for other button or label--> <Viewport3D Grid.RowSpan="2" Grid.ColumnSpan="2" Grid.Column="1"> <Viewport3D.Camera> <PerspectiveCamera Position="0, -0.1, 4"/> </Viewport3D.Camera> <Viewport2DVisual3D x:Name="v2dv3d"> <Viewport2DVisual3D.Transform> <RotateTransform3D> <RotateTransform3D.Rotation> <AxisAngleRotation3D Angle="0" Axis="0, 1, 0" /> </RotateTransform3D.Rotation> </RotateTransform3D> </Viewport2DVisual3D.Transform> <Viewport2DVisual3D.Geometry> <MeshGeometry3D Positions="-1,1,0 -1,-1,0 1,-1,0 1,1,0" TextureCoordinates="0,0 0,1 1,1 1,0" TriangleIndices="0 1 2 0 2 3"/> </Viewport2DVisual3D.Geometry> <Viewport2DVisual3D.Material> <DiffuseMaterial Viewport2DVisual3D.IsVisualHostMaterial="True" Brush="White"/> </Viewport2DVisual3D.Material><!--here is the label rotate --> <Label Content="WpfPainter" Height="77" HorizontalAlignment="Left" Margin="54,45,0,0" Name="label1" VerticalAlignment="Top" Width="193" FontSize="26" FontFamily="Trajan Pro" Opacity="0.7" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" > <Label.Triggers> <EventTrigger RoutedEvent="MouseEnter"> <BeginStoryboard> <Storyboard RepeatBehavior="0:0:4"> <Rotation3DAnimation Storyboard.TargetName="v2dv3d" Storyboard.TargetProperty="(Viewport2DVisual3D.Transform).(RotateTransform3D.Rotation)" Duration="0:0:2" BeginTime="0:0:0"> <Rotation3DAnimation.From> <AxisAngleRotation3D Angle="0" Axis="0, 1, 0" /> </Rotation3DAnimation.From> <Rotation3DAnimation.To> <AxisAngleRotation3D Angle="90" Axis="0, 1, 0" /> </Rotation3DAnimation.To> </Rotation3DAnimation> <Rotation3DAnimation Storyboard.TargetName="v2dv3d" Storyboard.TargetProperty="(Viewport2DVisual3D.Transform).(RotateTransform3D.Rotation)" Duration="0:0:2" BeginTime="0:0:2"> <Rotation3DAnimation.From> <AxisAngleRotation3D Angle="-90" Axis="0, 1, 0" /> </Rotation3DAnimation.From> <Rotation3DAnimation.To> <AxisAngleRotation3D Angle="0" Axis="0, 1, 0" /> </Rotation3DAnimation.To> </Rotation3DAnimation> </Storyboard> </BeginStoryboard> </EventTrigger> </Label.Triggers> </Label> </Viewport2DVisual3D> <ModelVisual3D> <ModelVisual3D.Content> <DirectionalLight Color="#FFFFFFFF" Direction="0,0,-1"/> </ModelVisual3D.Content> </ModelVisual3D> </Viewport3D><!--end of the style --> 推荐答案 < window x:class =WpfApplication1.Window1xmlns:x =#unknown> xmlns =http:/ /schemas.microsoft.com/winfx/2006/xaml/presentation xmlns:x =http://schemas.microsoft.com / winfx / 2006 / xaml Title =Window1Height =600Width =600ResizeMode =CanResizeWithGripLoaded =Window_Loaded> < grid> <window x:class="WpfApplication1.Window1" xmlns:x="#unknown"> xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Window1" Height="600" Width="600" ResizeMode="CanResizeWithGrip" Loaded="Window_Loaded"> <grid> 这篇关于动画风格怎么样?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
10-23 11:28