• wpf 3d文字


    这是原来参考的地址

     <Viewport3D>
            <src:SolidText  Text="中国" FontSize="0.5"
                           FontFamily="Times New Roman"
                           FontWeight="Bold" 
                           Origin="-1.1 0.5" Depth="0.3">
                <src:SolidText.Material>
                    <MaterialGroup>
                        <DiffuseMaterial Brush="Blue" />
                        <SpecularMaterial Brush="White" />
                    </MaterialGroup>
                </src:SolidText.Material>
    
                <src:SolidText.BackMaterial>
                    <MaterialGroup>
                        <DiffuseMaterial Brush="Red" />
                        <SpecularMaterial Brush="White" />
                    </MaterialGroup>
                </src:SolidText.BackMaterial>
    
                <src:SolidText.SideMaterial>
                    <MaterialGroup>
                        <DiffuseMaterial>
                            <DiffuseMaterial.Brush>
                                <LinearGradientBrush StartPoint="0 0" 
                                                     EndPoint="0 1">
                                    <GradientStop Offset="0" Color="Blue" />
                                    <GradientStop Offset="1" Color="Red" />
                                </LinearGradientBrush>
                            </DiffuseMaterial.Brush>
                        </DiffuseMaterial>
                        <SpecularMaterial Brush="White" />
                    </MaterialGroup>
                </src:SolidText.SideMaterial>
            
                <!-- Transform. -->
                <src:SolidText.Transform>
                    <RotateTransform3D>
                        <RotateTransform3D.Rotation>
                            <AxisAngleRotation3D x:Name="rotate" Axis="1 1 0" />
                        </RotateTransform3D.Rotation>
                    </RotateTransform3D>
                </src:SolidText.Transform>
            </src:SolidText>
    
            <!-- Lights. -->
            <ModelVisual3D>
                <ModelVisual3D.Content>
                    <Model3DGroup>
                        <AmbientLight Color="#404040" />
                        <DirectionalLight Color="#C0C0C0" Direction="2 -3 -1" />
                    </Model3DGroup>
                </ModelVisual3D.Content>
            </ModelVisual3D>
    
            <!-- Camera. -->
            <Viewport3D.Camera>
                <PerspectiveCamera Position="0 0 8" UpDirection="0 1 0"
                                   LookDirection="0 0 -1" FieldOfView="45" />
            </Viewport3D.Camera>
        </Viewport3D>
    Viewport3D
    <Page.Triggers>
            <EventTrigger RoutedEvent="Page.Loaded">
                <BeginStoryboard>
                    <Storyboard>
                        <DoubleAnimation Storyboard.TargetName="rotate"
                                         Storyboard.TargetProperty="Angle"
                                         From="0" To="360" Duration="0:0:15"
                                         RepeatBehavior="Forever" />
                    </Storyboard>
                </BeginStoryboard>
            </EventTrigger>
        </Page.Triggers>
    Triggers.执行

    3d的本身放入window标签中就可以运行,但是放入canvas中后,需要有执行的rotate代码;

    其中,viewport3d可以x:Name="引用"

  • 相关阅读:
    java环境--JDK和Tomcat在linux上的安装和配置
    转载:jQuery的deferred对象详解
    js 模板引擎 -Art Template
    sublime text的快捷键
    Spring MVC 配置Controller详解
    转:几款免费的图表js插件
    tomcat manager详解
    C#判断一个string是否为数字
    调用摄像头并将其显示在UGUI image上自适应屏幕大小
    unity监测按下键的键值并输出+unity键值
  • 原文地址:https://www.cnblogs.com/bkycjj/p/3397739.html
Copyright © 2020-2023  润新知