如何使用WPF實現(xiàn)一個平面三角形3D運動效果?針對這個問題,這篇文章詳細(xì)介紹了相對應(yīng)的分析和解答,希望可以幫助更多想解決這個問題的小伙伴找到更簡單易行的方法。

實現(xiàn)效果如下:

思路:封裝三角形三個頂點和路徑的三角形類,圖形渲染時同步更新公共頂點三角形的頂點位置。
步驟:
1、三角形類Triangle.cs
public Point A, B, C;//初始三個頂點
public Point VA, VB, VC;//運動的三個頂點
public Path trianglePath;//三角形路徑
public Color triangleColor;//填充
public double ColorIndex;//顏色深度
public Triangle(Point a, Point b, Point c, Color co, double z)
{
A = VA = a;
B = VB = b;
C = VC = c;
triangleColor = co;
ColorIndex = z;
trianglePath = new Path();
Draw();
}
/// <summary>
/// 繪制三角形
/// </summary>
public void Draw()
{
var g = new StreamGeometry();
using (StreamGeometryContext context = g.Open())
{
context.BeginFigure(VA, true, true);
context.LineTo(VB, true, false);
context.LineTo(VC, true, false);
}
trianglePath.Data = g;
trianglePath.Fill = new SolidColorBrush(triangleColor);
}
文章標(biāo)題:如何使用WPF實現(xiàn)一個平面三角形3D運動效果-創(chuàng)新互聯(lián)
當(dāng)前鏈接:http://chinadenli.net/article44/ddpeee.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供App設(shè)計、網(wǎng)站策劃、電子商務(wù)、自適應(yīng)網(wǎng)站、外貿(mào)建站、移動網(wǎng)站建設(shè)
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內(nèi)容