WPF动画公共类

PIV实验流场流速云图(MALAB contour函数用法) clear;clc; for k=1:5 str1=['filename1']; str2=['filename2']; str3=['filename3']; str=eval(['str',num2str(k)]); load(str); [m n]=size(y); y=flipud(y); v=-v; x=x-x(1,... 阅读详情

很不错,省得自己写了。

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows;
using System.Windows.Controls;

namespace CLeopardTestWPFAnimation
{
   public static class Animation_Helper
    {
        /// <summary>
        /// 透明度播放—循环 (提升效率)Timeline.DesiredFrameRateProperty.OverrideMetadata(typeof(Timeline), new FrameworkPropertyMetadata { DefaultValue = 20 });
        /// </summary>
        /// <param name="myFrameworkElement">透明动画对象</param>
        /// <param name="aTime">动画时间</param>
        /// <param name="wind">动画移动所在窗口(推荐this)</param>
        /// <returns>返回动画对象</returns>
       public static Storyboard Opacity_Animation(FrameworkElement myFrameworkElement, TimeSpan aTime, Window wind)
        {
            Storyboard myStoryboard = new Storyboard();
            DoubleAnimation OpacityDoubleAnimation = new DoubleAnimation();
            OpacityDoubleAnimation.From = 0;
            OpacityDoubleAnimation.To = 1;
            OpacityDoubleAnimation.Duration = aTime;
            Storyboard.SetTargetName(OpacityDoubleAnimation, myFrameworkElement.Name);
            Storyboard.SetTargetProperty(OpacityDoubleAnimation, new PropertyPath(DataGrid.OpacityProperty));
            myStoryboard.Children.Add(OpacityDoubleAnimation);
            myStoryboard.RepeatBehavior = RepeatBehavior.Forever;
            myStoryboard.Begin(wind);
            return myStoryboard;

        }
        /// <summary>
        /// 透明度播放-可传值(起始透明度,结束透明度)(提升效率)Timeline.DesiredFrameRateProperty.OverrideMetadata(typeof(Timeline), new FrameworkPropertyMetadata { DefaultValue = 20 });
        /// </summary>
        /// <param name="myFrameworkElement">透明动画对象</param>
        /// <param name="aTime">动画时间</param>
        /// <param name="dFrom">起始透明度</param>
        /// <param name="dTo">结束透明度</param>
        /// <param name="wind">动画移动所在窗口(推荐this)</param>
        /// <returns>返回动画对象</returns>
       public static Storyboard Opacity_Animation(FrameworkElement myFrameworkElement, TimeSpan aTime, double dFrom, double dTo, Window wind)
        {
            Storyboard myStoryboard = new Storyboard();
            DoubleAnimation OpacityDoubleAnimation = new DoubleAnimation();
            OpacityDoubleAnimation.From = dFrom;
            OpacityDoubleAnimation.To = dTo;
            OpacityDoubleAnimation.Duration = aTime;
            Storyboard.SetTargetName(OpacityDoubleAnimation, myFrameworkElement.Name);
            Storyboard.SetTargetProperty(OpacityDoubleAnimation, new PropertyPath(DataGrid.OpacityProperty));
            myStoryboard.Children.Add(OpacityDoubleAnimation);
            //myStoryboard.RepeatBehavior = RepeatBehavior.Forever;
            myStoryboard.Begin(wind);
            return myStoryboard;

        }
        /// <summary>
        /// 透明度播放-可传值(起始透明度,结束透明度,次数或是否循环)(提升效率)Timeline.DesiredFrameRateProperty.OverrideMetadata(typeof(Timeline), new FrameworkPropertyMetadata { DefaultValue = 20 });
        /// </summary>
        /// <param name="myFrameworkElement">透明动画对象</param>
        /// <param name="aTime">动画时间</param>
        /// <param name="dFrom">起始透明度</param>
        /// <param name="dTo">结束透明度</param>
        /// <param name="RBehavior">动画是否循环</param>
        /// <param name="wind">动画移动所在窗口(推荐this)</param>
        /// <returns>返回动画对象</returns>
       public static Storyboard Opacity_Animation(FrameworkElement myFrameworkElement, TimeSpan aTime, double dFrom, double dTo, RepeatBehavior RBehavior, Window wind)
        {
            Storyboard myStoryboard = new Storyboard();
            DoubleAnimation OpacityDoubleAnimation = new DoubleAnimation();
            OpacityDoubleAnimation.From = dFrom;
            OpacityDoubleAnimation.To = dTo;
            OpacityDoubleAnimation.Duration = aTime;
            Storyboard.SetTargetName(OpacityDoubleAnimation, myFrameworkElement.Name);
            Storyboard.SetTargetProperty(OpacityDoubleAnimation, new PropertyPath(DataGrid.OpacityProperty));
            myStoryboard.Children.Add(OpacityDoubleAnimation);
            myStoryboard.RepeatBehavior = RBehavior;
            myStoryboard.Begin(wind);
            return myStoryboard;

        }
        /// <summary>
        /// X方向移动动画(需要移动的对象、移动时间、相对控件原始位置的起始位置、相对控件原始位置的结束位置)(提升效率)Timeline.DesiredFrameRateProperty.OverrideMetadata(typeof(Timeline), new FrameworkPropertyMetadata { DefaultValue = 20 });
        /// </summary>
        /// <param name="myFrameworkElement">需要移动的对象</param>
        /// <param name="aTime">移动时间</param>
        /// <param name="dFrom">相对控件原始位置的-起始位置</param>
        /// <param name="dTo">相对控件原始位置的-结束位置</param>
       /// <param name="wind">动画移动所在窗口(推荐this)</param>
       /// <returns>返回动画对象</returns>
       public static Storyboard InDouble_X_Animation(FrameworkElement myFrameworkElement, TimeSpan aTime, double dFrom, double dTo, RepeatBehavior RForever, Window wind)
        {
            myFrameworkElement.RenderTransform = new TranslateTransform();
            DependencyProperty[] propertyChain = new DependencyProperty[]
            {
                DataGrid.RenderTransformProperty,
                TranslateTransform.XProperty
            };
            Storyboard myStoryboard = new Storyboard();
            DoubleAnimation InDoubleAnimation = new DoubleAnimation();
            InDoubleAnimation.From = dFrom;
            InDoubleAnimation.To = dTo;
            InDoubleAnimation.Duration = aTime;
            Storyboard.SetTargetName(InDoubleAnimation, myFrameworkElement.Name);
            Storyboard.SetTargetProperty(InDoubleAnimation, new PropertyPath("(0).(1)", propertyChain));
            myStoryboard.Children.Add(InDoubleAnimation);
            myStoryboard.RepeatBehavior = RForever;
            myStoryboard.Begin(wind);
            return myStoryboard;
        }
        /// <summary>
        /// Y方向移动动画(需要移动的对象、移动时间、相对控件原始位置的起始位置、相对控件原始位置的结束位置)(提升效率)Timeline.DesiredFrameRateProperty.OverrideMetadata(typeof(Timeline), new FrameworkPropertyMetadata { DefaultValue = 20 });
        /// </summary>
        /// <param name="myFrameworkElement">需要移动的对象</param>
        /// <param name="aTime">移动时间</param>
        /// <param name="dFrom">相对控件原始位置的-起始位置</param>
        /// <param name="dTo">相对控件原始位置的-结束位置</param>
       /// <param name="RBehavior">动画是否循环</param>
       /// <param name="wind">动画移动所在窗口(推荐this)</param>
       /// <returns>返回动画对象</returns>
       public static Storyboard InDouble_Y_Animation(FrameworkElement myFrameworkElement, TimeSpan aTime, double dFrom, double dTo, RepeatBehavior RForever, Window wind)
        {
            myFrameworkElement.RenderTransform = new TranslateTransform();
            DependencyProperty[] propertyChain = new DependencyProperty[]
            {
                DataGrid.RenderTransformProperty,
                TranslateTransform.YProperty
            };
            Storyboard myStoryboard = new Storyboard();
            DoubleAnimation InDoubleAnimation = new DoubleAnimation();
            InDoubleAnimation.From = dFrom;
            InDoubleAnimation.To = dTo;
            InDoubleAnimation.Duration = aTime;
            Storyboard.SetTargetName(InDoubleAnimation, myFrameworkElement.Name);
            Storyboard.SetTargetProperty(InDoubleAnimation, new PropertyPath("(0).(1)", propertyChain));
            myStoryboard.Children.Add(InDoubleAnimation);
            myStoryboard.RepeatBehavior = RForever;
            myStoryboard.Begin(wind);
            return myStoryboard;
        }
        /// <summary>
        /// 缓动缩放动画 (提升效率)Timeline.DesiredFrameRateProperty.OverrideMetadata(typeof(Timeline), new FrameworkPropertyMetadata { DefaultValue = 20 });
        /// </summary>
        /// <param name="element">缩放控件</param>
        /// <param name="aTime">缩放时间</param>
        /// <param name="dFrom">缩放起始值(推荐1)</param>
        /// <param name="dTo">缩放结束值(推荐1.5)</param>
        /// <param name="aOscillations">滑过动画目标的次数(推荐5)</param>
        /// <param name="aSpringiness">弹簧刚度(推荐10)</param>
       /// <returns>返回动画对象</returns>
       public static AnimationClock ScaleEasingAnimation(FrameworkElement element, TimeSpan aTime, double dFrom, double dTo, int aOscillations, int aSpringiness)
        {
            ScaleTransform scale = new ScaleTransform();
            element.RenderTransform = scale;
            element.RenderTransformOrigin = new Point(0.5, 0.5);//定义圆心位置
            EasingFunctionBase easing = new ElasticEase()
            {
                EasingMode = EasingMode.EaseOut,            //公式
                Oscillations = aOscillations,                           //滑过动画目标的次数
                Springiness = aSpringiness                             //弹簧刚度
            };
            DoubleAnimation scaleAnimation = new DoubleAnimation()
            {
                From = dFrom,                                 //起始值
                To = dTo,                                     //结束值
                EasingFunction = easing,                    //缓动函数
                Duration = aTime    //动画播放时间
            };
            AnimationClock clock = scaleAnimation.CreateClock();
            scale.ApplyAnimationClock(ScaleTransform.ScaleXProperty, clock);
            scale.ApplyAnimationClock(ScaleTransform.ScaleYProperty, clock);
            return clock;
        }
        /// <summary>
        /// 缩放匀速动画 (提升效率)Timeline.DesiredFrameRateProperty.OverrideMetadata(typeof(Timeline), new FrameworkPropertyMetadata { DefaultValue = 20 });
        /// </summary>
        /// <param name="sender">缩放控件</param>
        /// <param name="scaleXF">缩放X开始值</param>
        /// <param name="scaleXT">缩放X结束值</param>
        /// <param name="scaleYF">缩放Y开始值</param>
        /// <param name="scaleYT">缩放Y结束值</param>
        /// <param name="aTime">动画持续时间</param>
       /// <param name="RBehavior">动画是否循环</param>
       /// <param name="wind">动画移动所在窗口(推荐this)</param>
       /// <returns>返回动画对象</returns>
       public static Storyboard ScaleTransformAnimation(UIElement sender, double scaleXF, double scaleXT, double scaleYF, double scaleYT, TimeSpan aTime, RepeatBehavior RForever, Window wind)
        {
            DoubleAnimationUsingKeyFrames dba_SacleX = new DoubleAnimationUsingKeyFrames();
            dba_SacleX.KeyFrames.Add(new EasingDoubleKeyFrame(scaleXF, TimeSpan.FromSeconds(0)));
            dba_SacleX.KeyFrames.Add(new EasingDoubleKeyFrame(scaleXT, aTime));

            DoubleAnimationUsingKeyFrames dba_SacleY = new DoubleAnimationUsingKeyFrames();
            dba_SacleY.KeyFrames.Add(new EasingDoubleKeyFrame(scaleYF, TimeSpan.FromSeconds(0)));
            dba_SacleY.KeyFrames.Add(new EasingDoubleKeyFrame(scaleYT, aTime));

            Storyboard mystoryboard = new Storyboard();
            Storyboard.SetTarget(dba_SacleX, sender);
            sender.RenderTransform = new ScaleTransform();
            Storyboard.SetTargetProperty(dba_SacleX, new PropertyPath("(UIElement.RenderTransform).(ScaleTransform.ScaleX)"));
            mystoryboard.Children.Add(dba_SacleX);
            Storyboard.SetTarget(dba_SacleY, sender);
            Storyboard.SetTargetProperty(dba_SacleY, new PropertyPath("(UIElement.RenderTransform).(ScaleTransform.ScaleY)"));
            mystoryboard.Children.Add(dba_SacleY);
            mystoryboard.RepeatBehavior = RForever;
            mystoryboard.Begin(wind);
            return mystoryboard;
        }
        /// <summary>
        /// 旋转动画(初始点X和Y是按元素的左上角)(提升效率)Timeline.DesiredFrameRateProperty.OverrideMetadata(typeof(Timeline), new FrameworkPropertyMetadata { DefaultValue = 20 });
        /// </summary>
        /// <param name="sender">动画对象</param>
        /// <param name="centerX">旋转X原点</param>
        /// <param name="centerY">旋转Y原点</param>
        /// <param name="angle">旋转角度(推荐0-360)</param>
        /// <param name="aTime">动画时间</param>
       /// <param name="RBehavior">动画是否循环</param>
       /// <param name="wind">动画移动所在窗口(推荐this)</param>
       /// <returns>返回动画对象</returns>
       public static Storyboard RotateTransformAnimation(UIElement sender, TimeSpan aTime, double centerX, double centerY, double angle, RepeatBehavior RForever, Window wind)
        {

            RotateTransform rt = new RotateTransform();
            rt.CenterX = centerX;
            rt.CenterY = centerY;
            sender.RenderTransform = rt;
            DoubleAnimationUsingKeyFrames dba = new DoubleAnimationUsingKeyFrames();
            dba.KeyFrames.Add(new LinearDoubleKeyFrame(angle, aTime));
            Storyboard mysb = new Storyboard();
            Storyboard.SetTarget(dba, sender);
            Storyboard.SetTargetProperty(dba, new PropertyPath("(UIElement.RenderTransform).(RotateTransform.Angle)"));
            mysb.Children.Add(dba);
            mysb.RepeatBehavior = RForever;
            mysb.Begin(wind);
           return mysb;
        }
        /// <summary>
        /// 旋转动画(初始点按元素的中心)(提升效率)Timeline.DesiredFrameRateProperty.OverrideMetadata(typeof(Timeline), new FrameworkPropertyMetadata { DefaultValue = 20 });
        /// </summary>
        /// <param name="element">动画对象</param>
        /// <param name="angle">旋转角度(推荐0-360)</param>
        /// <param name="aTime">动画时间</param>
       /// <param name="RBehavior">动画是否循环</param>
       /// <param name="wind">动画移动所在窗口(推荐this)</param>
        /// <returns>返回动画对象</returns>
       public static Storyboard RotateTransformAnimation(UIElement element, TimeSpan aTime, double angle, RepeatBehavior RForever, Window wind)
        {
            RotateTransform scale = new RotateTransform();
            element.RenderTransform = scale;
            element.RenderTransformOrigin = new Point(0.5, 0.5);//定义圆心位置

            //RotateTransform rt = new RotateTransform();
            //rt.CenterX = 0;
            //rt.CenterY = 0;
            //element.RenderTransform = rt;
            DoubleAnimationUsingKeyFrames dba = new DoubleAnimationUsingKeyFrames();
            dba.KeyFrames.Add(new LinearDoubleKeyFrame(angle, aTime));
            Storyboard mysb = new Storyboard();
            Storyboard.SetTarget(dba, element);
            Storyboard.SetTargetProperty(dba, new PropertyPath("(UIElement.RenderTransform).(RotateTransform.Angle)"));
            mysb.Children.Add(dba);
            mysb.RepeatBehavior = RForever;
            mysb.Begin(wind);
            return mysb;
        }
    }
}


python全栈入门到实战【基础篇 02】环境搭建:Python解释器与PyCharm、VSCode编辑器安装配置详解 本文详解Python环境搭建步骤。首先安装解释器(运行代码核心),需从官网下载,选3.8及以上版本(勿选2.x)。Windows安装必勾“Add Python.exe to PATH”,验证用`python --version`;Mac选universal2安装包,验证用`python3 --version`。 编辑器二选一:PyCharm社区版(免费,新手推荐),安装后需配置解释器路径;VSCode轻量,需装Python插件并选择解释器。 阅读详情

相关推荐

【Ensp】FTP服务器设置和FTP解析

大部分的多媒体多媒体应用协议,如SIP,FTP,NetMeeting协议等,使用约定的固定端口来初始化一个控制连接,再动态地选择端口用于数据传输,并且这些端口选择是不可预测的。在防火墙设置时,可以通过ASPF(应用层报文过滤)中的Server Map表来满足多通道协议的正常工作,它正常检测应用层报文信息,并动态地根据报文内容创建和删除临时的Server Map表项,以允许其它非约定端口通过防火墙。(5)我们可以在路由器或能访问ftp服务器的设备上,通过cli命令行的方式来访问ftp服务器。

进击的小小白 1862

动画帧速率

通常,为用户界面应用动画,只不过是创建并配置正确的动画和故事版对象。但在其他情况下,特别是同时发生多个动画时,可能更加需要关注性能。WPF试图保持以60帧/秒的速度进行动画,可以确保从开始到结束得到平滑流畅的动画。帧速率越低,会发生抖动现象。帧速率越高,占用的CPU也就越高。通过TimeLine.DesiredFrameRate属性可以进行调整,下面是例子: 首先先把页面做出来:...

蓝Buff的博客 2138

【MATLAB】绘制泽尼克多项式

上次只给了公式没有给代码,很多小伙伴表示不是很认可。今天直接把代码发上来了。

HPC_ZY 5577

wpf Storyboard之帧率

动画的平滑顺畅是由帧率所决定的,而帧率消耗的则是电脑的CPU,帧率越高则消耗的CPU越高,相反,帧率越低占用的CPU则越低。限制低速移动的背景类型动画的处理资源量,这些动画不需要高度保真度。可以通过在时间线上设置较小的帧速率值来实现此目的。默认的帧率为60,但是这个动画的帧率不一定都需要60,可以尝试改变下帧率,找到适合你动画的一个合适值,使用此属性可定义应运行动画的特定帧速率。可以通过在时间线上设置高帧速率值来实现此目的。一个界面多个动画,都不调整帧率,就有可能造成个别动画刷新数据不及时,有延迟的感觉。

weixin_51786302的博客 653

树莓派4B+WebRTC实现远程监控:5步搞定公网视频流传输(含Node.js配置)

本文详细介绍了如何利用树莓派4B和WebRTC技术,通过5个关键步骤搭建低延迟、高隐私的远程监控系统。重点阐述了WebRTC点对点传输相较于传统方案的优势,并提供了包含Node.js信令服务器配置、树莓派视频流捕获与推送、以及移动端自适应观看页面的完整实现方案,帮助用户实现公网视频流传输。

websocket5live的博客 292

LABVIEW学习之MODBUS-TCP通讯

LABVIEW学习之MODBUS-TCP通讯 1,MODBUS-TCP通讯介绍: MODBUS通讯是工业上面经常用到的一种通讯协议。该协议的原理及介绍不在此累述,下面直接介绍LABVIEW对此协议的应用。 2,MODBUS通讯所需的函数: 安装了DSC模块之后可以在数据通信内找到相关函数 3 ,主VI 主要思路就是使用状态机来进行连接 读取 写入 断开。使用枚举类型来选择状态: 1,连接 2,写入多个M继电器: 3,写入单个M继电器 4,写入双字节D...

风动9527的博客 2万+

WPF:Animation动画--CustomAnimation自定义动画(2)

一、自定义动画概述:用来扩展 WPF 动画系统:创建自定义关键帧、动画类或者使用逐帧回调来绕过该系统。 1. 以上为扩展动画系统总览 2. 创建一个自定义关键帧 最简单的方法。 当您需要对关键帧动画使用一种不同的内插方法时,可使用此方法。每个关键帧对象都执行三个功能: 使用它的 Value 属性指定一个目标值。 使用它的 Key...

weixin_34302798的博客 477

《YOLO26/YOLO11/YOLOv8改进与系统实战》,改进与系统实战专栏目录和介绍

YOLOv8 是目前比较火和比较成熟的深度学习框架,是2023年1月发布的,由 Ultralytics 团队开发。Ultralytics自YOLOv5 开始一直积极维护和更新 YOLO 框架,因此 YOLOv8 也享有持续的维护与升级支持。因此我写下《手把手教你YOLOv8实战》专栏,专门为那些对计算机视觉、深度学习、以及目标检测技术感兴趣的读者设计。通过本专栏,你将深入理解 YOLOv8 的核心原理与实际应用,从0 开始学习并掌握如何使用 YOLOv8 完成各类目标检测任务,帮助你快速上手并掌握 YOLO

在职AI算法工程师,擅长计算机视觉,YOLO目标检测、分割等,擅长web、pyqt界面可视化,好内容持续更新中,来这里跟大家一起学习,共同进步 1万+

WPF:Animation动画--CustomAnimation自定义动画(1)

CustomAnimation自定义动画 实现效果:1、X轴上各种缓动动画效果2、自定义动画代码实现文件组织: 一、界面代码 界面容器为Grid方格下使用Canvas,Canvas承载TextBlock和Button 动画开始的操作有两种方式,一种为点击Go按钮执行所有动画,一种为单独单击按钮会执行相应按钮动画+第一个Linear按...

weixin_33976072的博客 700

2024顶级提示工程工具:提升效率的12个神器

LlamaIndex虽然本身不是直接的提示词编辑工具,但其整个设计都围绕着如何有效地将外部知识融入LLM的提示词。它提供了结构化的方式来管理“上下文窗口”——即哪些私有数据应该被包含在提示词中。通过优化索引结构和检索策略,可以确保提示词中包含最相关、最高质量的上下文信息,从而大幅提升LLM基于私有数据回答问题的准确性和相关性。同时,LlamaIndex允许开发者针对不同的查询类型和数据特点定制提示词模板,这使得提示词的复用和优化更加系统化。

AIGC应用创新大全的博客 1098

基于FMU的Star CCM+与Amesim复杂控制联合分析

基于FMU的Star CCM+与Amesim复杂控制联合分析

2201_75375391的博客 2017

WPF的动画(3)

    一.控制动画 两种方式(需要注意的是命名作用域必须相同) 1.xaml 以TriggerAction的方式调用内部StoryBoard方法 来自msdn PauseStoryboard:暂停 Storyboard。 ResumeStoryboard:继续暂停的 Storyboard。 SetStoryboardSpeedRatio:更...

weixin_34111819的博客 153

数学工具箱:Clarke与Park变换

本文详细解析了FOC(磁场定向控制)中的核心数学工具——Clarke变换与Park变换。首先阐述了坐标变换的必要性:将复杂的三相交流系统简化为直流系统,便于精确控制。Clarke变换将三相静止坐标系转换为两相静止坐标系,减少变量数量;Park变换进一步将两相静止坐标系转换为两相旋转坐标系,实现交流量到直流量的转换。文章提供了两种变换的数学公式、物理意义图解及C语言实现代码,并简要介绍了逆变换过程。这些变换为电机控制提供了关键的数学基础,后续将结合GD32F303的FPU特性进行优化实现。

汽车电子软件领域知识分享 178

《wpf专题--基于wpf制作登录页面》

开发工具与关键技术:wpf 作者:龙文浩 撰写时间:2019年5月11日 Wpf制作登录页面,是借用的qq的动态图来显示,其他按钮可以根据自己的需求来增加,图片也是根据自己的需求来修改即可: 登录页面设置不允许用户缩放:然后就可以在页面自由的拖拉控件,不用像html那样去考虑那些浮动栅格等等的布局,我们只需要把控件拖到合适的位置即可: 在最外层可以自由的选择布局框架,我们这里使用的是网格布局...

龙文浩的博客 2242

迈瑞BS系列全自动生化分析仪LIS协议接口手册(内含HL7和ASTM)

迈瑞BS系列全自动生化分析仪LIS协议接口手册,内含HL7和ASTM)

霍尼韦尔SoftMaster使用说明

霍尼韦尔SoftMaster使用说明

WPF编程笔记 0:WPF概况(上部分)

.NET技术的发展总是能给我们带来新的学习动力,在学习完了WF和WCF之后,我开始WPF的学习旅程,WPF没有太多的中文资料,我于是参考Chris Sells, Ian Griffiths编写的《Programming WPF 2nd Edition》写一些笔记和总结,希望能给看此文的你带来一些参考。 言归正传,WPF是继MFC技术,WinForm技术的最新Windows层现技术...

aegckeir70762的博客 204

TMS_WebGMaps_1.9.8.0_Full_Source

TMS_WebGMaps_1.9.8.0_Full_Source 全源码 delphi cbuilder

Unity3D应用嵌入WPF应用并实现通信之进阶篇

在之前的一篇博文中描述了Unity3D应用嵌入WPF应用的具体实现方式,但仅仅是解决了最基本的技术问题,想要将其具体的应用到项目中还需要具体的细化。经过近期在项目中的实践进行了细化,现将本人最近的一些过程整理成文,供大家讨论。上篇博文地址如下: Unity3D应用嵌入WPF应用并实现通信 问题&需求为什么要将Unity3D应用嵌入WPF应用?Unity3D是近些年比较流行的游戏引擎之一,在三维空

lordwish的专栏 1万+

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

WPF自定义产品框架

本次主要讲解一下WPF业务类产品开发架构。 产品架构分为WPF客户端程序和WCF服务端程序,分离的目的也是为了,在扩展其他业务终端的时候都可以通过同一个服务端去访问,一定程度上减少开发工作量。 在讲解之前先看一下效果,有助于理解: 这是客户端的效果图。整个产品分为两部分:1.WPF开发的展示效果的客户端 2.WCF开发的提供数据服务接口的服务端 本章主要讲解一...

weixin_34303897的博客 256

WPF简介:VS创建桌面应用程序

1、简介 1/ 什么是WPF WPF,Windows Presentation Foundation也,译过来就是“Windows呈现基础”,你看它的目的非常明确,就是用来把数据“显示”给用户看的(说白了就是用来做UI的)。如果只是给用户显示几串文本、两三张图片或者几个表格那WPF就太糗了,幸乎,WPF可不是这等素食动物——大家都见过Flash动画吧,WPF的显示能力丝毫不亚于Flash以及F

鳄鱼泪的博客 5912

学懂C#编程:常用框架学习(三)———学会并深入理解WPF核心之MVVM模式

学懂C#编程:常用框架学习,学会并深入理解WPF核心之MVVM模式,WPF数据绑定

编程技术探索者,分享C/C++、C#、Java、数据库等开发经验,聚焦实战技巧与AI兴趣,助力编程爱好者成长。 3539

004009002_WPF Label 标签基类官方定义

本文基于.NET 9 WPF官方源码,深度解析Label类的继承体系、静态构造与核心依赖属性Target。指出Label本质是ContentControl的扩展,通过强制Focusable=false确保不接收焦点,仅通过Target关联输入控件实现访问键功能。对比TextBlock,Label在键盘导航场景中更具优势,适用于工业级表单开发,推荐在需支持键盘操作的标签场景中优先选用。

qq_39302144的博客 305

WPF .NET 7.0学习整理(一)

XAML有两种方法:在代码隐藏或其他生成主 Windows Presentation Foundation (WPF) 应用程序的代码内。

fanlrr的博客 915

VS生成桌面应用程序

1、简介1/ 什么是WPFWPF,Windows Presentation Foundation也,译过来就是“Windows呈现基础”,你看它的目的非常明确,就是用来把数据“显示”给用户看的(说白了就是用来做UI的)。如果只是给用户显示几串文本、两三张图片或者几个表格那WPF就太糗了,幸乎,WPF可不是这等素食动物——大家都见过Flash动画吧,WPF的显示能力丝毫不亚于Flash以及Flash...

weixin_30550081的博客 3016

终极 3D 图形工具包:Ab3d.PowerToys 10.2.X Crack

Ab3d.PowerToys 10.2 改进了 Ab3d.Utilities.Triangulator 通过添加对带孔的多个多边形进行三角剖分的支持(之前只能对没有任何孔的单个多边形进行三角剖分)。这可用于从文本创建 3D 网格。 Ab3d.Utilities.PolygonAnalyzer 现在是一个公共类,可用于分析由 2D 位置列表定义的 2D 多边形。

控件与插件之大全 1017

【C#】由内到外螺旋旋转制作蜂巢

由内到外螺旋旋转制作蜂巢   这几天需要用蜂巢形状,网上找了几个生成正六边形的代码感觉都不是我想要的,基本上都由六边形的一个顶点开始计算下个顶点的位置,但是这样得到的正六边形不是很正,不是我想要的,于是就自己写了一个。 如上图,假设正六边形的边长为1,坐标原点O为正六边形ABCDEF内切圆的圆心,通过运算可以得到正六边形六个顶点的坐标,并且也能得到环绕在这个正六边形周围的正六边形内切圆圆心

kansousama的专栏 3365
上一篇: 关于Visual Studio 2013 编译 multi-byte character set MFC程序出现 MSB8031 错误的解决办法
下一篇: WPF界面刷新
CLeopard
博客等级 码龄15年 180粉丝 29原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值