WPF-3D动效-文字球形环绕
费劲写了一个动效,却要被砍掉,心碎....
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动效-文字球形环绕的更多相关文章
- Principle如何制作动效设计?简单易学的Principle动效设计教程
Principle for Mac是一款新开发的交互设计软件.相比 Pixate 更容易上手,界面类似 Sketch 等做图软件,思路有点像用 Keynote 做动画,更「可视化」一些. 如果您还没有 ...
- 巧用 background-clip 实现超强的文字动效
最近,有同学询问,如何使用 CSS 实现如下效果: 看起来是个很有意思的动效. 仔细思考一下,要想实现这类效果,其实用到的核心属性只有一个 -- background-clip: text. 有意思的 ...
- 拒绝枯燥,有意思的 Loading 页面动效设计
互联网时代,网络“提速”日益频繁,人们打开Web或软件的速度越来越快,一般页面缓冲和加载地过程也是几不可查.然而,在某些情况下,例如软件急需加载大量页面,首页急需加载大量内容,用户下载文件过大,甚至是 ...
- 巧用 -webkit-box-reflect 倒影实现各类动效
在很久之前的一篇文章,有讲到 -webkit-box-reflect 这个属性 -- 从倒影说起,谈谈 CSS 继承 inherit -webkit-box-reflect 是一个非常有意思的属性,它 ...
- Web动效研究与实践
随着CSS3和HTML5的发展,越来越多狂拽炫酷叼炸天的动效在网页设计上遍地开花,根据最新的浏览器市场份额报告,IE6的份额已经降到了5.21%,这简直是一个喜大普奔的消息,做动效可以完全不care低 ...
- android动效开篇
大神博客:http://blog.csdn.net/tianjian4592/article/details/44155147 在现在的Android App开发中,动效越来越受到产品和设计师同学的重 ...
- WPF 3D:简单的Point3D和Vector3D动画创造一个旋转的正方体
原文:WPF 3D:简单的Point3D和Vector3D动画创造一个旋转的正方体 运行结果: 事实上很简单,定义好一个正方体,处理好纹理.关于MeshGeometry3D的正确定义和纹理这里就不多讲 ...
- 基于clip-path的任意元素的碎片拼接动效(源自鑫空间)
一.实现原理. 效果本质上是CSS3动画,就是旋转transform:rotate和位移:transform:translate,只是旋转和位移的部件是三角碎片而已.三角是使用CSS3 clip-pa ...
- iOS开发之 Lottie -- 炫酷的动效
动效在软件开发中非常常见,炫酷的动画能提升应用的B格,然而由设计师的设计转化成程序猿GG的代码是个非常"痛苦"的过程.对于复杂动画,可能要花费很多时间去研究和实现.Lottie 的 ...
随机推荐
- HTML标签的权重
原文 简书原文:https://www.jianshu.com/p/c86d540aec40 大纲 1.HTML权重标签 2.常见的权重标签 3.常见的权重标签的使用 1.HTML权重标签 SEOer ...
- 立足“快时尚”,联想笋尖S90怎样诠释“比美更美”?
现现在."快时尚"已经成为广受年轻人追捧的消费观,从服装界的H&M.ZARA到餐饮界的绿茶.外婆家等等,我们都不难看出,快时尚已成为激发年轻人消费欲望的核心元素,并 ...
- mysqldump备份脚本
#!/bin/bash # 10 23 * * * /bin/bash /data/script/backup_mysqldump.sh BDATE=`date +%Y%m%d%H%M%S`BPATH ...
- php 根据给定的年份和月份获取该年份该月份的起始和结束时间
function getShiJianChuo($nian=0,$yue=0){ if(empty($nian) || empty($yue)){ $now = time(); $nian = dat ...
- event.relatedTarget、event.fromElement、event.toElement
在标准DOM中,mouseover和mouseout所发生的元素可以通过event.target来访问,相关元素通过event.relatedTarget属性来访问.event.relatedTarg ...
- [RxJS] Split an RxJS observable conditionally with windowToggle
There are variants of the window operator that allow you to split RxJS observables in different ways ...
- href="javascript:;" href="javascript:void(0);" href="#"区别
一.href="javascript:;" 这种用法不正确,这么用的话会出现浏览器访问"javascript:;"这个地址的现象: 二.href="j ...
- Linux 网络编程系列教程
一.基础理论篇 01.网络协议入门 02.LAN.WAN.WLAN.VLAN 和 VPN 的区别 03.IP 地址介绍 04.广播地址介绍 05.无连接和面向连接协议的区别 06.因特网的IP协议是不 ...
- php实现 合并表记录(需求是最好的老师)
php实现 合并表记录(需求是最好的老师) 一.总结 一句话总结:php数组,桶. 1.fgets的作用? 读取一行 0 1 2.如何读取一行中的两个数? fgets()读取一行后explode以空格 ...
- JSON 表达式
JSON语法规则: 数据在名称/值对中: 数据由逗号分隔: 大括号保存对象: 中括号保存数组 1.访问对象值: var myObj,x; myObj = {" ...