91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 0.24M
    文件類(lèi)型: .rar
    金幣: 1
    下載: 0 次
    發(fā)布日期: 2020-12-14
  • 語(yǔ)言: C#
  • 標(biāo)簽: wpf??動(dòng)畫(huà)??wp??

資源簡(jiǎn)介

按照cos、sin運(yùn)動(dòng)軌跡描繪做出幾何圖像。參照此類(lèi)方式可制作多種動(dòng)態(tài)數(shù)學(xué)幾何圖形。
代碼均為后臺(tái)代碼,可加強(qiáng)對(duì)path、曲線、扇形、storyboard等知識(shí)的學(xué)習(xí)理解。
最開(kāi)始運(yùn)行0.5秒,描述有些不整齊,自行修正。
編譯已設(shè)置“優(yōu)化代碼”。
代碼可以優(yōu)化,如有錯(cuò)誤自行修正。

圖像錄制效果不好,在代碼中運(yùn)行查看效果。



 /// <summary>
        /// 描述cos、sin圖像
        /// </summary>
        /// <param name="obj">父容器</param>
        private void Draw_init(Canvas obj)
        {
            // 繪制坐標(biāo)
            Draw_Line(obj, new Point(100, 300), new Point(870, 300), Colors.LightSlateGray, 0.5);
            Draw_Line(obj, new Point(600, 20), new Point(600, 570), Colors.LightSlateGray, 0.5);

            // 繪制背景網(wǎng)格橫線
            for (int i = 0; i < 6; i  )
            {
                double r = i < 3 ? 600 : 870;
                Draw_Line(obj, new Point(100, 50   i * 100), new Point(r, 50   i * 100), Colors.LightSlateGray, 0.1);
            }
            // 繪制背景網(wǎng)格豎線、弧線
            for (int i=0;i<3;i  )
            {
                Draw_Line(obj, new Point(450-i*150, 50), new Point(450-i*150, 250), Colors.LightSlateGray, 0.1);
                Draw_Line(obj, new Point(450 - i * 150, 350), new Point(450 - i * 150, 550), Colors.LightSlateGray, 0.1);
                Draw_Line(obj, new Point(650   i * 100, 300), new Point(650   i * 100, 570), Colors.LightSlateGray, 0.2);
                Path bsin = new Path()
                {
                    Stroke = Brushes.LightSlateGray,
                    StrokeThickness = 0.2,
                    Data = Geometry.Parse("M 0, -"   (50   i * 100)   "  A"   (50   i * 100)   ", "   (50   i * 100)   " 0 0 1 "   (50   i * 100)   ", 0")
                };
                Canvas.SetLeft(bsin, 600);
                Canvas.SetTop(bsin, 300);
                obj.Children.Add(bsin);
            }
            // 文字
            string[] ctext = new string[] { "Sin","Cos"};
            for (int i = 0; i < 2; i  )
            {
                Color color = i == 0 ? Colors.Blue : Colors.Red;
                TextBlock text = new TextBlock()
                {
                    Foreground = new SolidColorBrush(color),
                    FontSize = 15,
                    FontWeight = FontWeights.Bold,
                    FontStyle = FontStyles.Oblique,
                    Text = ctext[i],
                    Opacity = 0.6
                };
                Canvas.SetLeft(text, 100);
                Canvas.SetTop(text, 25 i*300);
                obj.Children.Add(text);

                TextBlock flag = new TextBlock()
                {
                    Foreground = Brushes.DarkOrange,
                    FontSize = 15,
                    FontWeight = FontWeights.Bold,
                    FontStyle = FontStyles.Oblique,
                    Text = "θ",
                    Opacity = 0.6
                };
                Canvas.SetLeft(flag, 130);
                Canvas.SetTop(flag, 25   i * 300);
                obj.Children.Add(flag);
            }

            TextBlock angel_flag = new TextBlock()
            {
                Foreground = Brushes.DarkOrange,
                FontSize = 15,
                FontWeight = FontWeights.Bold,
                FontStyle = FontStyles.Oblique,
                Text = "θ = ",
                Opacity = 0.6
            };
            Canvas.SetLeft(angel_flag, 780);
            Canvas.SetTop(angel_flag, 40 );
            obj.Children.Add(angel_flag);

            // 圓外框////////////////////////////////////////////////////////////////////////////////////////////////////////////////
            Path path_border = new Path()
            {
                Stroke = Brushes.Green,
                StrokeThickness = 1,
                Data = Geometry.Parse(rotation)

            };
            Canvas.SetLeft(path_border, 850);
            Canvas.SetTop(path_border, 450);
            obj.Children.Add(path_border);

            // 圓內(nèi)、外線段////////////////////////////////////////////////////////////////////////////////////////////////////////////////
            line_circular = new LineGeometry()
            {
                StartPoint = new Point(-100, 0),
                EndPoint = new Point(0, 0)
            };
            Path path_lineCircular = new Path()
            {
                Stroke = Brushes.LightGreen,
                StrokeThickness = 1,
                Data = line_circular
            };
            obj.RegisterName("LineCircular", line_circular);
            Canvas.SetLeft(path_lineCircular, 850);
            Canvas.SetTop(path_lineCircular, 450);
            obj.Children.Add(path_lineCircular);

            story_lineCircular = new Storyboard();
            PathGeometry pathLineCircularGeometry = new PathGeometry()
            {
                Figures = PathFigureCollection.Parse(rotation)
            };
            Set_Locus(obj, pathLineCircularGeometry, delay, "LineCircular", "EndPoint", story_lineCircular);
            story_lineCircular.Begin(obj, true);
            story_lineCircular.Pause(obj);

            // 圓心點(diǎn)、運(yùn)動(dòng)軌跡////////////////////////////////////////////////////////////////////////////////////////////////////////////////
            circular_elips = new EllipseGeometry()
            {
                Center = new Point(0, 0),
                RadiusX = 3,
                RadiusY = 3,
            };
            Path path_circular = new Path()
            {
                Fill = Brushes.Green,
                Data = circular_elips,
            };
            Panel.SetZIndex(path_circular,999);
            obj.RegisterName("Circular", circular_elips);
            Canvas.SetLeft(path_circular, 850);
            Canvas.SetTop(path_circular, 450);
            obj.Children.Add(path_circular);

            story_circular = new Storyboard();
            PathGeometry pathGeometry = new PathGeometry()
            {
                Figures = PathFigureCollection.Parse("M 0,0 A 100,100 45 1 0 0,1 Z")
            };
            Set_Locus(obj, pathGeometry, delay, "Circular", "Center", story_circular);
            story_circular.Begin(obj, true);
            story_circular.Pause(obj);

            // 圓內(nèi)扇形////////////////////////////////////////////////////////////////////////////////////////////////////////////////
            Draw_Sector(obj);

            // 圓內(nèi)圓心點(diǎn)////////////////////////////////////////////////////////////////////////////////////////////////////////////////
            EllipseGeometry center_elips = new EllipseGeometry()
            {
                Center = new Point(0, 0),
                RadiusX = 3,
                RadiusY = 3,
            };
            Path path_center = new Path()
            {
                Fill = Brushes.DarkOrange,
                Data = center_elips
            };
            Canvas.SetLeft(path_center, 750);
            Canvas.SetTop(path_center, 450);
            obj.Children.Add(path_center);

            // 圓外指示線段////////////////////////////////////////////////////////////////////////////////////////////////////////////////
            line_cos = new LineGeometry()
            {
                StartPoint = new Point(0, 0),
                EndPoint = new Point(0, 150)
            };
            Path path_lineCos = new Path()
            {
                Stroke = Brushes.LightBlue,
                StrokeThickness = 1,
                Data = line_cos
            };
            Canvas.SetLeft(path_lineCos, 850);
            Canvas.SetTop(path_lineCos, 300);
            obj.Children.Add(path_lineCos);

            line_sin = new LineGeometry()
            {
                StartPoint = new Point(0, 0),
                EndPoint = new Point(150, 0)
            };
            Path path_lineSin = new Path()
            {
                Stroke = Brushes.LightCoral,
                StrokeThickness = 1,
                Data = line_sin
            };
            Canvas.SetLeft(path_lineSin, 600);
            Canvas.SetTop(path_lineSin, 450);
            obj.Children.Add(path_lineSin);

            // 圓內(nèi)扇、扇形運(yùn)動(dòng)軌跡////////////////////////////////////////////////////////////////////////////////////////////////////////////////
            path_CosSector = new Path()
            {
                Stroke = Brushes.LightBlue,
                Data = Geometry.Parse("M0, 0 L0, -250 A250, 250 0 0 1 250, 0")
            };
            Canvas.SetLeft(path_CosSector, 600);
            Canvas.SetTop(path_CosSector, 300);
            obj.Children.Add(path_CosSector);

            cosx_elips = new EllipseGeometry()
            {
                Center = new Point(0, 0),
                RadiusX = 3,
                RadiusY = 3,
            };
            Path path_cosx = new Path()
            {
                Fill = Brushes.Blue,
                Data = cosx_elips
            };
            cosx_elips.Changed  = Cosx_elips_Changed;
            Canvas.SetLeft(path_cosx, 850);
            Canvas.SetTop(path_cosx, 300);
            Panel.SetZIndex(path_cosx, 999);
            obj.Children.Add(path_cosx);

            cosy_elips = new EllipseGeometry()
            {
                Center = new Point(0, -50),
                RadiusX = 3,
                RadiusY = 3,
            };
            Path path_cosy = new Path()
            {
                Fill = Brushes.Blue,
                Data = cosy_elips
            };
            Canvas.SetLeft(path_cosy, 600);
            Canvas.SetTop(path_cosy, 100);
            Panel.SetZIndex(path_cosy, 999);
            obj.Children.Add(path_cosy);

            sin_elips = new EllipseGeometry()
            {
                Center = new Point(0, 0),
                RadiusX = 3,
                RadiusY = 3,
            };
            Path path_sin = new Path()
            {
                Fill = Brushes.Red,
                Data = sin_elips
            };
            sin_elips.Changed  = Sin_elips_Changed;
            Canvas.SetLeft(path_sin, 600);
            Canvas.SetTop(path_sin, 450);
            Panel.SetZIndex(path_sin,999);
            obj.Children.Add(path_sin);

            // 開(kāi)始動(dòng)畫(huà)////////////////////////////////////////////////////////////////////////////////////////////////////////////////
            story_circular.Begin(obj, true);
            story_lineCircular.Begin(obj, true);
            story_arc.Begin(obj, true);
            Task.Factory.StartNew(() => { Modify_Sector(); });
        }

        /// <summary>
        /// sin坐標(biāo)值發(fā)生變化
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Sin_elips_Changed(object sender, EventArgs e)
        {
            double radius = Math.Abs(250   circular_elips.Center.X);
            path_CosSector.Data = Geometry.Parse("M0, 0 L0, "   (-radius)   " A"   radius   ", "   radius   " 0 0 1 "   radius   ", 0");

            for (int i = 0; i < pcurve_sin.Points.Count; i  )
            {
                pcurve_sin.Points[i] = new Point(pcurve_sin.Points[i].X - 1, pcurve_sin.Points[i].Y);
            }
            pcurve_sin.Points.Add(new Point(598, sin_elips.Center.Y   450));
            if (pcurve_sin.Points.Count > 500)
            {
                pcurve_sin.Points.RemoveAt(0);
            }
        }

        /// <summary>
        /// cos坐標(biāo)值發(fā)生變化
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Cosx_elips_Changed(object sender, EventArgs e)
        {
            double radius = Math.Abs(250   circular_elips.Center.X);
            path_CosSector.Data = Geometry.Parse("M0, 0 L0, "   (-radius)   " A"   radius   ", "   radius   " 0 0 1 "   radius   ", 0");

            for (int i = 0; i < pcurve_cos.Points.Count; i  )
            {
                pcurve_cos.Points[i] = new Point(pcurve_cos.Points[i].X - 1, pcurve_cos.Points[i].Y);
            }
            pcurve_cos.Points.Add(new Point(598, cosy_elips.Center.Y   100));
            if (pcurve_cos.Points.Count > 500)
            {
                pcurve_cos.Points.RemoveAt(0);
            }
        }


        private Line line_axle, line_minaxle;
        private Path arc_move;
        private EllipseGeometry arc_elips;
        private Path pd, pn, min_pd, min_pn;

        /// <summary>
        /// 2個(gè)扇形、圓外線段位置變化 跨線程設(shè)置變動(dòng)
        /// </summary>
        private void Modify_Sector()
        {
            while (true)
            {
                this.Dispatcher.InvokeAsync(() =>
                {
                    if (arc_elips.Center.Y <= 0)
                    {
                        pn.Data = Geometry.Parse("M0,0 L0,0 A0,0 0 0 1 0,0");
                        line_axle.Stroke = Brushes.Transparent;
                        string d = "M0,0 L"   (35   arc_elips.Center.X)   ","   (arc_elips.Center.Y)   " A35,35 0 0 1 35,0 Z";
                        pd.Data = Geometry.Parse(d);

                        min_pn.Data = Geometry.Parse("M0,0 L0,0 A0,0 0 0 1 0,0");
                        line_minaxle.Stroke = Brushes.Transparent;
                        string md = "M0,0 L"   (35   arc_elips.Center.X)   ","   (arc_elips.Center.Y)   " A35,35 0 0 1 35,0 Z";
                        min_pd.Data = Geometry.Parse(md);
                    }
                    else
                    {
                        pd.Data = Geometry.Parse("M -35, 0  A35, 35 0 0 1 35, 0");
                        line_axle.Stroke = Brushes.DarkOrange;
                        string n = "M0,0 L"   (35   arc_elips.Center.X)   ","   (arc_elips.Center.Y)   " A35,35 0 0 1 -35,00";
                        pn.Data = Geometry.Parse(n);

                        min_pd.Data = Geometry.Parse("M -35, 0  A35, 35 0 0 1 35, 0");
                        line_minaxle.Stroke = Brushes.Gold;
                        string mn = "M0,0 L"   (35   arc_elips.Center.X)   ","   (arc_elips.Center.Y)   " A35,35 0 0 1 -35,00";
                        min_pn.Data = Geometry.Parse(mn);
                    }

                    line_cos.StartPoint = new Point(circular_elips.Center.X, circular_elips.Center.Y   150);
                    line_cos.EndPoint = new Point(circular_elips.Center.X, 0);
                    line_sin.StartPoint = new Point(0, circular_elips.Center.Y);
                    line_sin.EndPoint = new Point(circular_elips.Center.X   250, circular_elips.Center.Y);

                    cosx_elips.Center = new Point(circular_elips.Center.X, 0);
                    cosy_elips.Center = new Point(0, -(circular_elips.Center.X   50));
                    sin_elips.Center = new Point(0, circular_elips.Center.Y);
                });
                Thread.Sleep(5);
            }
        }

        /// <summary>
        /// 畫(huà)2個(gè)扇形指示
        /// </summary>
        /// <param name="obj"></param>
        private void Draw_Sector(Canvas obj)
        {
            pd = new Path()
            {
                Fill = Brushes.Gold,
                Stroke = Brushes.DarkOrange,
                StrokeThickness = 0.5,
                Opacity = 0.5
            };
            Canvas.SetLeft(pd, 750);
            Canvas.SetTop(pd, 450);
            obj.Children.Add(pd);

            pn = new Path()
            {
                Fill = Brushes.Gold,
                Stroke = Brushes.DarkOrange,
                StrokeThickness = 0.5,
                Opacity = 0.5
            };
            Canvas.SetLeft(pn, 750);
            Canvas.SetTop(pn, 450);
            obj.Children.Add(pn);

            min_pd = new Path()
            {
                Fill = Brushes.LightGoldenrodYellow,
                Stroke = Brushes.Gold,
                StrokeThickness = 0.5,
            };
            Canvas.SetLeft(min_pd, 850);
            Canvas.SetTop(min_pd, 50);
            obj.Children.Add(min_pd);

            line_axle = new Line()
            {
                Stroke = Brushes.Transparent,
                StrokeThickness = 0.5,
                X1 = 750,
                Y1 = 450,
                X2 = 785,
                Y2 = 450,
                Opacity = 0.9
            };
            obj.Children.Add(line_axle);

            min_pn = new Path()
            {
                Fill = Brushes.LightGoldenrodYellow,
                Stroke = Brushes.Gold,
                StrokeThickness = 0.5,
            };
            Canvas.SetLeft(min_pn, 850);
            Canvas.SetTop(min_pn, 50);
            obj.Children.Add(min_pn);

            line_minaxle = new Line()
            {
                Stroke = Brushes.Transparent,
                StrokeThickness = 0.5,
                X1 = 850,
                Y1 = 50,
                X2 = 885,
                Y2 = 50,
            };
            obj.Children.Add(line_minaxle);

            Path min_elips = new Path()
            {
                Stroke = Brushes.Gold,
                StrokeThickness = 0.5,
                Data = Geometry.Parse("M 0, 0 A 35, 35 45 1 0 0, 1 Z")
            };
            Canvas.SetLeft(min_elips,885);
            Canvas.SetTop(min_elips,50);
            obj.Children.Add(min_elips);

           Path min_center = new Path()
            {
               Fill = Brushes.Gold,
               Data = Geometry.Parse("M 0, 0 A 3, 3 45 1 0 0, 1 Z")
           };
            Canvas.SetLeft(min_center, 852.5);
            Canvas.SetTop(min_center, 50);
            obj.Children.Add(min_center);

            arc_move = new Path();
            arc_elips = new EllipseGeometry() { Center = new Point(0, 0) };
            arc_move.Data = arc_elips;
            Canvas.SetLeft(arc_move, 783);
            Canvas.SetTop(arc_move, 450);
            obj.RegisterName("Arc_Move", arc_elips);
            obj.Children.Add(arc_move);

            story_arc = new Storyboard();
            PathGeometry fanGeometry = new PathGeometry()
            {
                Figures = PathFigureCollection.Parse("M 0,0 A 35,35 45 1 0 0,1 Z")
            };
            Set_Locus(obj, fanGeometry, delay, "Arc_Move", "Center", story_arc);
        }

資源截圖

代碼片段和文件信息

using?System;
using?System.Collections.Generic;
using?System.Configuration;
using?System.Data;
using?System.Linq;
using?System.Threading.Tasks;
using?System.Windows;

namespace?Math_1
{
????///?
????///?App.xaml?的交互邏輯
????///?

????public?partial?class?App?:?Application
????{
????}
}

?屬性????????????大小?????日期????時(shí)間???名稱(chēng)
-----------?---------??----------?-----??----

????..A..H.?????55808??2020-04-24?11:46??Math_1\.vs\Math_1\v15\.suo

?????文件??????????0??2020-04-20?08:01??Math_1\.vs\Math_1\v15\Server\sqlite3\db.lock

?????文件?????692224??2020-04-24?11:28??Math_1\.vs\Math_1\v15\Server\sqlite3\storage.ide

?????文件??????32768??2020-04-24?08:09??Math_1\.vs\Math_1\v15\Server\sqlite3\storage.ide-shm

?????文件????4124152??2020-04-24?11:45??Math_1\.vs\Math_1\v15\Server\sqlite3\storage.ide-wal

????..A..H.?????60416??2020-04-23?23:43??Math_1\.vs\Math_1\v16\.suo

?????文件????????189??2020-04-19?21:04??Math_1\Math_1\App.config

?????文件????????366??2020-04-19?21:04??Math_1\Math_1\App.xaml

?????文件????????333??2020-04-19?21:04??Math_1\Math_1\App.xaml.cs

?????文件??????19456??2020-04-24?11:45??Math_1\Math_1\bin\Debug\Math_1.exe

?????文件????????189??2020-04-19?21:04??Math_1\Math_1\bin\Debug\Math_1.exe.config

?????文件??????34304??2020-04-24?11:45??Math_1\Math_1\bin\Debug\Math_1.pdb

?????文件????????600??2020-04-24?11:20??Math_1\Math_1\MainWindow.xaml

?????文件??????22032??2020-04-24?11:44??Math_1\Math_1\MainWindow.xaml.cs

?????文件???????4174??2020-04-24?11:45??Math_1\Math_1\Math_1.csproj

?????文件???????2300??2020-04-19?21:04??Math_1\Math_1\Properties\AssemblyInfo.cs

?????文件???????2825??2020-04-19?21:04??Math_1\Math_1\Properties\Resources.Designer.cs

?????文件???????5612??2020-04-19?21:04??Math_1\Math_1\Properties\Resources.resx

?????文件???????1093??2020-04-19?21:04??Math_1\Math_1\Properties\Settings.Designer.cs

?????文件????????201??2020-04-19?21:04??Math_1\Math_1\Properties\Settings.settings

?????文件???????1123??2020-04-19?21:04??Math_1\Math_1.sln

?????目錄??????????0??2020-04-24?11:48??Math_1\.vs\Math_1\v15\Server\sqlite3

?????目錄??????????0??2020-04-24?11:48??Math_1\.vs\Math_1\v15\Server

?????目錄??????????0??2020-04-24?11:48??Math_1\.vs\Math_1\v15

?????目錄??????????0??2020-04-24?11:48??Math_1\.vs\Math_1\v16

?????目錄??????????0??2020-04-24?11:48??Math_1\Math_1\bin\Debug

?????目錄??????????0??2020-04-24?11:48??Math_1\Math_1\obj\Debug

?????目錄??????????0??2020-04-24?11:48??Math_1\.vs\Math_1

?????目錄??????????0??2020-04-24?11:48??Math_1\Math_1\bin

?????目錄??????????0??2020-04-24?11:48??Math_1\Math_1\obj

............此處省略7個(gè)文件信息

評(píng)論

共有 條評(píng)論