原文:WPF-3D动效-文字球形环绕

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/u013224722/article/details/81784443

费劲写了一个动效,却要被砍掉,心碎....


private List<Point3D> GetBuckyBallPoints()
{
List<Point3D> ltPoints = new List<Point3D>();
ltPoints.Add(new Point3D(.850651, 0, 2.327438));
ltPoints.Add(new Point3D(.262866, .809017, 2.327438));
ltPoints.Add(new Point3D(-.688191, .5, 2.327438));
ltPoints.Add(new Point3D(-.688191, -.5, 2.327438));
ltPoints.Add(new Point3D(.262866, -.809017, 2.327438)); ltPoints.Add(new Point3D(1.701301, 0, 1.801708));
ltPoints.Add(new Point3D(.52573, 1.618035, 1.801708));
ltPoints.Add(new Point3D(.52573, -1.618035, 1.801708));
ltPoints.Add(new Point3D(-1.376383, -.999999, 1.801708));
ltPoints.Add(new Point3D(-1.376383, .999999, 1.801708)); ltPoints.Add(new Point3D(1.964166, .809017, 1.275977));
ltPoints.Add(new Point3D(1.376381, 1.618035, 1.275977));
ltPoints.Add(new Point3D(-.162461, 2.118035, 1.275977));
ltPoints.Add(new Point3D(-1.113517, 1.809017, 1.275977));
ltPoints.Add(new Point3D(-2.064574, .5, 1.275977));
ltPoints.Add(new Point3D(-2.064574, -.5, 1.275977));
ltPoints.Add(new Point3D(-1.113517, -1.809017, 1.275977));
ltPoints.Add(new Point3D(-.162461, -2.118035, 1.275977));
ltPoints.Add(new Point3D(1.376381, -1.618035, 1.275977));
ltPoints.Add(new Point3D(1.964166, -.809017, 1.275977)); ltPoints.Add(new Point3D(2.389492, .5, .425326));
ltPoints.Add(new Point3D(1.213921, 2.118035, .425326));
ltPoints.Add(new Point3D(.262865, 2.427051, .425326));
ltPoints.Add(new Point3D(-1.639248, 1.809017, .425326));
ltPoints.Add(new Point3D(-2.227033, .999999, .425326));
ltPoints.Add(new Point3D(-2.227033, -.999999, .425326));
ltPoints.Add(new Point3D(-1.639248, -1.809017, .425326));
ltPoints.Add(new Point3D(.262865, -2.427051, .425326));
ltPoints.Add(new Point3D(1.213921, -2.118035, .425326));
ltPoints.Add(new Point3D(2.389492, -.5, .425326)); ltPoints.Add(new Point3D(2.227033, .999999, -.425326));
ltPoints.Add(new Point3D(1.639248, 1.809017, -.425326));
ltPoints.Add(new Point3D(-.262865, 2.427051, -.425326));
ltPoints.Add(new Point3D(-1.213921, 2.118035, -.425326));
ltPoints.Add(new Point3D(-2.389492, .5, -.425326));
ltPoints.Add(new Point3D(-2.389492, -.5, -.425326));
ltPoints.Add(new Point3D(-1.213921, -2.118035, -.425326));
ltPoints.Add(new Point3D(-.262865, -2.427051, -.425326));
ltPoints.Add(new Point3D(1.639248, -1.809017, -.425326));
ltPoints.Add(new Point3D(2.227033, -.999999, -.425326)); ltPoints.Add(new Point3D(2.064574, .5, -1.275977));
ltPoints.Add(new Point3D(1.113517, 1.809017, -1.275977));
ltPoints.Add(new Point3D(.162461, 2.118035, -1.275977));
ltPoints.Add(new Point3D(-1.376381, 1.618035, -1.275977));
ltPoints.Add(new Point3D(-1.964166, .809017, -1.275977));
ltPoints.Add(new Point3D(-1.964166, -.809017, -1.275977));
ltPoints.Add(new Point3D(-1.376381, -1.618035, -1.275977));
ltPoints.Add(new Point3D(.162461, -2.118035, -1.275977));
ltPoints.Add(new Point3D(1.113517, -1.809017, -1.275977));
ltPoints.Add(new Point3D(2.064574, -.5, -1.275977)); ltPoints.Add(new Point3D(1.376383, .999999, -1.801708));
ltPoints.Add(new Point3D(-.52573, 1.618035, -1.801708));
ltPoints.Add(new Point3D(-1.701301, 0, -1.801708));
ltPoints.Add(new Point3D(-.52573, -1.618035, -1.801708));
ltPoints.Add(new Point3D(1.376383, -.999999, -1.801708)); ltPoints.Add(new Point3D(.688191, .5, -2.327438));
ltPoints.Add(new Point3D(-.262866, .809017, -2.327438));
ltPoints.Add(new Point3D(-.850651, 0, -2.327438));
ltPoints.Add(new Point3D(-.262866, -.809017, -2.327438));
ltPoints.Add(new Point3D(.688191, -.5, -2.327438)); return ltPoints;
} private void CreateNationItems()
{
List<Point3D> ltPoints = this.GetBuckyBallPoints(); Vector3D oVectorCenter = new Vector3D(0, 0, 2); for (int i = 0; i < ltPoints.Count; i++)
{
Point3D oPoint = ltPoints[i]; // 滚动碎片
InteractiveCustom3DPlane o3DPlane = new InteractiveCustom3DPlane(0.96, 0.3, 0, 0);
o3DPlane.OffsetX = 0;
o3DPlane.OffsetY = 0;
o3DPlane.OffsetZ = 2;
o3DPlane.RotateXCenterZ = -2;
o3DPlane.RotateYCenterZ = -2; double dAngleX = Vector3D.AngleBetween(oVectorCenter, new Vector3D(0, oPoint.Y, oPoint.Z));
double dAngleY = Vector3D.AngleBetween(oVectorCenter, new Vector3D(oPoint.X, 0, oPoint.Z)); if (oPoint.Y < 0)
dAngleX = -dAngleX;
if (oPoint.X < 0)
dAngleY = -dAngleY; if (Math.Abs(dAngleX) > 90)
{
o3DPlane.OffsetZ = -2;
o3DPlane.RotateXCenterZ = 2;
o3DPlane.RotateYCenterZ = 2;
o3DPlane.ScaleX = -1;
dAngleX = 180 - dAngleX;
dAngleY = 180 + dAngleY;
} o3DPlane.AngleX = dAngleX;
o3DPlane.AngleY = dAngleY; int nIndex = i;
if (nIndex >= DataService.DataModels.Nations.Count)
nIndex = Utilitys.GetRandomSeed().Next(0, 55);
// 民族名称
string sNationName = DataService.DataModels.Nations[nIndex].Name; Border oBoder = new Border() { Width = 48, Height = 15 };
oBoder.Background = new SolidColorBrush(Colors.Transparent);
TextBlock oTbk = new TextBlock();
oTbk.Text = sNationName;
oTbk.Foreground = Brushes.White;
oTbk.VerticalAlignment = VerticalAlignment.Center;
oTbk.HorizontalAlignment = HorizontalAlignment.Center;
oBoder.Child = oTbk;
o3DPlane.Visual = oBoder; this.ViewportZm.Children.Add(o3DPlane);
}
}
    DoubleAnimation oAnim = new DoubleAnimation(0, -360, TimeSpan.FromSeconds(6));
oAnim.RepeatBehavior = RepeatBehavior.Forever;
this.CameraAngleZm.BeginAnimation(AxisAngleRotation3D.AngleProperty, oAnim); DoubleAnimation oAnimLogo = new DoubleAnimation(0, -360, TimeSpan.FromSeconds(6));
oAnimLogo.RepeatBehavior = RepeatBehavior.Forever;
this.LogoAngleZm.BeginAnimation(AxisAngleRotation3D.AngleProperty, oAnimLogo);
 <Viewport3D x:Name="ViewportZm" IsHitTestVisible="True" RenderOptions.EdgeMode="Aliased" Margin="0,100,-0,50">
<Viewport3D.Camera>
<PerspectiveCamera x:Name="CameraZm" Position="0,0,10" LookDirection="0,0,-1">
<PerspectiveCamera.Transform>
<Transform3DGroup>
<TranslateTransform3D OffsetX="0" OffsetY="0" OffsetZ="0" x:Name="CameraTranslateZm"/>
<RotateTransform3D x:Name="myRotateTransform3D">
<RotateTransform3D.Rotation>
<AxisAngleRotation3D Angle="0" Axis="0 1 0" x:Name="CameraAngleZm"/>
</RotateTransform3D.Rotation>
</RotateTransform3D>
</Transform3DGroup>
</PerspectiveCamera.Transform>
</PerspectiveCamera>
</Viewport3D.Camera> <ModelVisual3D>
<ModelVisual3D.Content>
<Model3DGroup>
<AmbientLight Color="White"/>
</Model3DGroup>
</ModelVisual3D.Content>
</ModelVisual3D>
<ModelVisual3D x:Name="earthmodel">
<ModelVisual3D.Content>
<GeometryModel3D Geometry ="{Binding Source={StaticResource sphere},
Path=Geometry}">
<GeometryModel3D.Material>
<DiffuseMaterial Brush="{StaticResource KeyImgBrushModuleMenuBg}">
</DiffuseMaterial>
</GeometryModel3D.Material>
<GeometryModel3D.Transform>
<RotateTransform3D >
<RotateTransform3D.Rotation>
<AxisAngleRotation3D x:Name="YRotate" Angle="0"/>
</RotateTransform3D.Rotation>
</RotateTransform3D>
</GeometryModel3D.Transform>
</GeometryModel3D>
</ModelVisual3D.Content>
</ModelVisual3D> <ModelVisual3D x:Name="Mv3dLogoZm">
<ModelVisual3D.Transform>
<Transform3DGroup>
<TranslateTransform3D OffsetZ="0" OffsetX="0" OffsetY="0"/>
<ScaleTransform3D ScaleZ="0" ScaleY="0.7" ScaleX="0.7"/>
<RotateTransform3D>
<RotateTransform3D.Rotation>
<AxisAngleRotation3D Axis="0,1,0" Angle="360" x:Name="LogoAngleZm"/>
</RotateTransform3D.Rotation>
</RotateTransform3D>
</Transform3DGroup>
</ModelVisual3D.Transform>
<ModelVisual3D.Content>
<GeometryModel3D>
<GeometryModel3D.Geometry>
<MeshGeometry3D Positions="-2.4,-2.7,0 2.4,-2.7,0 2.4,2.7,0 -2.4,2.7,0"
TriangleIndices="0,1,2 0,2,3" TextureCoordinates="0 1 1 1 1 0 0 0">
</MeshGeometry3D>
</GeometryModel3D.Geometry>
<GeometryModel3D.Material>
<DiffuseMaterial Brush="{StaticResource KeyImgBrushLogo}">
</DiffuseMaterial>
</GeometryModel3D.Material>
</GeometryModel3D>
</ModelVisual3D.Content>
</ModelVisual3D> <ModelVisual3D x:Name="Mv3dContentZm"> </ModelVisual3D>
</Viewport3D>

 

WPF-3D动效-文字球形环绕的更多相关文章

  1. Principle如何制作动效设计?简单易学的Principle动效设计教程

    Principle for Mac是一款新开发的交互设计软件.相比 Pixate 更容易上手,界面类似 Sketch 等做图软件,思路有点像用 Keynote 做动画,更「可视化」一些. 如果您还没有 ...

  2. 巧用 background-clip 实现超强的文字动效

    最近,有同学询问,如何使用 CSS 实现如下效果: 看起来是个很有意思的动效. 仔细思考一下,要想实现这类效果,其实用到的核心属性只有一个 -- background-clip: text. 有意思的 ...

  3. 拒绝枯燥,有意思的 Loading 页面动效设计

    互联网时代,网络“提速”日益频繁,人们打开Web或软件的速度越来越快,一般页面缓冲和加载地过程也是几不可查.然而,在某些情况下,例如软件急需加载大量页面,首页急需加载大量内容,用户下载文件过大,甚至是 ...

  4. 巧用 -webkit-box-reflect 倒影实现各类动效

    在很久之前的一篇文章,有讲到 -webkit-box-reflect 这个属性 -- 从倒影说起,谈谈 CSS 继承 inherit -webkit-box-reflect 是一个非常有意思的属性,它 ...

  5. Web动效研究与实践

    随着CSS3和HTML5的发展,越来越多狂拽炫酷叼炸天的动效在网页设计上遍地开花,根据最新的浏览器市场份额报告,IE6的份额已经降到了5.21%,这简直是一个喜大普奔的消息,做动效可以完全不care低 ...

  6. android动效开篇

    大神博客:http://blog.csdn.net/tianjian4592/article/details/44155147 在现在的Android App开发中,动效越来越受到产品和设计师同学的重 ...

  7. WPF 3D:简单的Point3D和Vector3D动画创造一个旋转的正方体

    原文:WPF 3D:简单的Point3D和Vector3D动画创造一个旋转的正方体 运行结果: 事实上很简单,定义好一个正方体,处理好纹理.关于MeshGeometry3D的正确定义和纹理这里就不多讲 ...

  8. 基于clip-path的任意元素的碎片拼接动效(源自鑫空间)

    一.实现原理. 效果本质上是CSS3动画,就是旋转transform:rotate和位移:transform:translate,只是旋转和位移的部件是三角碎片而已.三角是使用CSS3 clip-pa ...

  9. iOS开发之 Lottie -- 炫酷的动效

    动效在软件开发中非常常见,炫酷的动画能提升应用的B格,然而由设计师的设计转化成程序猿GG的代码是个非常"痛苦"的过程.对于复杂动画,可能要花费很多时间去研究和实现.Lottie 的 ...

随机推荐

  1. [Angular2 Form] Create custom form component using Control Value Accessor

    //switch-control component import { Component } from '@angular/core'; import { ControlValueAccessor, ...

  2. swift入门之TableView

    IOS8更新了,oc还将继续但新增了swift语言,能够代替oc编写ios应用,本文将使用swift作为编写语言,为大家提供step by step的教程. 工具 ios每次更新都须要更新xcode, ...

  3. 制作Kinect体感控制小车教程 &lt;一&gt;

    转载请注明出处:http://blog.csdn.net/lxk7280                                        Kinect体感控制小车        Kine ...

  4. 【苦读官方文档】2.Android应用程序基本原理概述

    官方文档原文地址 应用程序原理 Android应用程序是通过Java编程语言来写.Android软件开发工具把你的代码和其它数据.资源文件一起编译.打包成一个APK文件,这个文档以.apk为后缀,保存 ...

  5. js进阶正则表达式5几个小实例(原样匹配的字符在正则中原样输出)(取反^)

    js进阶正则表达式5几个小实例(原样匹配的字符在正则中原样输出)(取反^) 一.总结 原样匹配的字符在正则中原样输出:var reg4=/第[1-2][0-9]章/g //10-29 取反^:var ...

  6. IT忍者神龟之Hibernat持久化对象-数据表映射配置回想

    1.持久化对象POJO编写规则: 1) 有空參public构造器: 2) 提供标识属性.映射数据表主键: 3) 属性提供setter和getter方法. 4) 属性使用基本数据类型的包装类型.基本类型 ...

  7. mui监听多个下拉刷新当前处于哪个选项卡

    1.滑动触发 <div id="slider" class="mui-slider mui-fullscreen"> <div id=&quo ...

  8. 【u021】广义斐波那契数列

    Time Limit: 1 second Memory Limit: 128 MB [问题描述] 广义的斐波那契数列是指形如an=p*an-1+q*an-2的数列.今给定数列的两系数p和q,以及数列的 ...

  9. springMVC返回json数据乱码问题及@RequestMapping 详解

    原文地址:https://blog.csdn.net/u010127245/article/details/51774074 一.@RequestMapping RequestMapping是一个用来 ...

  10. Git 常用命令总结(精问)

    Git 常用命令总结(精问) 一.总结 一句话总结:下次尝试做任何git的操作之前,把这个精看精问一遍,绝对会有意向不到的收获. 二.Git 常用命令总结 1.git常用命令 安装及配置: Ubunt ...