当前位置: 首页 > news >正文

云网站建设017年青深圳网站建设制作营销

云网站建设017年青,深圳网站建设制作营销,seo技术是什么,请网络推广外包公司有用吗前言今天介绍一篇使用json格式在wpf中播放动画效果#xff1b;正文话说在上古#xff08;1987#xff09;时代#xff0c;Gif因其体积小成像相对清晰和非常强的兼容性#xff0c;而大受欢迎;Gif也因为当时的技术限制导致很多缺陷 这包括对电脑的内存和性能占用非常大;同时… 前言今天介绍一篇使用json格式在wpf中播放动画效果正文话说在上古1987时代Gif因其体积小成像相对清晰和非常强的兼容性而大受欢迎;Gif也因为当时的技术限制导致很多缺陷 这包括对电脑的内存和性能占用非常大;同时Gif还是一个有损文件格式 对半透明和颜色都有一定程度的限制;随着技术的进步衍生出了 apng和webp格式相对技术色彩范围更广效果也更清晰也占用更低的内存;apng和webp这两种格式需要复杂的开发环境来支持还是不太友好这时就需要另外一种格式了 序列帧序列帧它是一个无损且低内存的格式不过只能在客户端使用因为帧数多想要在web环境中使用 就需要转换为雪碧图Lottie动画是由airbnb公司推出的Lottie的原理是把各种矢量素材以及效果 打包成一个体积很小的json文件然后交给开发人员就好了经常在APP所见到的动态图标都是由Lottie来实现的下面我们如何开源项目LottieSharp[1]进行展现json文件动画1Nuget 搜索 LottieSharp 点击安装2使用方式很简单如下ws:Window x:ClassLottieSharp.Sample.MainWindowxmlnshttp://schemas.microsoft.com/winfx/2006/xaml/presentationxmlns:xhttp://schemas.microsoft.com/winfx/2006/xamlxmlns:dhttp://schemas.microsoft.com/expression/blend/2008xmlns:mchttp://schemas.openxmlformats.org/markup-compatibility/2006xmlns:localclr-namespace:LottieSharp.Samplexmlns:lottieSharpclr-namespace:LottieSharp;assemblyLottieSharpxmlns:wshttps://github.com/WPFDevelopersOrg.WPFDevelopers.Minimalmc:IgnorabledTitle{Binding PathImageDrawable.Fps, StringFormat{}LottieSharp{0}, ElementNameLottieAnimationView} Height450 Width800GridGrid.ColumnDefinitionsColumnDefinition WidthAuto/ColumnDefinition //Grid.ColumnDefinitionsExpander  ExpandDirectionLeft Grid.Column0 Style{DynamicResource ExpanderStyle1} IsExpandedTrueBorder  BorderBrush{StaticResource PrimaryPressedSolidColorBrush}BorderThickness0,0,1,0ListBox x:NamemyListBoxSelectionChangedmyListBox_SelectionChanged//Border/ExpanderGrid Grid.Column1Grid.RowDefinitionsRowDefinition Height* /RowDefinition Heightauto /RowDefinition Heightauto /RowDefinition Heightauto /RowDefinition Heightauto //Grid.RowDefinitionslottieSharp:LottieAnimationView x:NameLottieAnimationView DefaultCacheStrategyNone FileNameAssets/moody-dog.json AutoPlayTrue VerticalAlignmentCenter HorizontalAlignmentCenter/Slider Grid.Row1 Maximum10 Value1 Minimum0.1 SmallChange0.1 LargeChange0.1 ValueChangedSlider_ValueChanged_1 /Slider Grid.Row2 Minimum0 Maximum1000 SmallChange1 ValueChangedSlider_ValueChanged /DockPanel Grid.Row3 Margin5Button DockPanel.DockLeft ContentPause Animation ClickPauseAnimation_Click HorizontalAlignmentLeft /Button DockPanel.DockLeft Margin10,0,0,0 ContentStart Animation ClickStartAnimation_Click HorizontalAlignmentLeft/!--Button DockPanel.DockLeft ContentLoad Animation Margin10,0,0,0 ClickLoadAnimation_Click HorizontalAlignmentLeft/--StackPanel DockPanel.DockRight OrientationHorizontal  HorizontalAlignmentRight Margin10,0 Width158TextBlock TextFps:  FontSize16 VerticalAlignmentCenter/TextBlockTextBox Text{Binding FrameRate, ElementNameLottieAnimationView, ModeTwoWay} Width60//StackPanel/DockPanelGrid Grid.Row4 Margin5Grid.ColumnDefinitionsColumnDefinition WidthAuto /ColumnDefinition Width* /ColumnDefinition WidthAuto /ColumnDefinition WidthAuto //Grid.ColumnDefinitionsTextBlock Grid.Column0 TextImageAssetsFolder (optional): VerticalAlignmentCenter/TextBox Grid.Column1 NameImageAssetsFolderTextBox Margin10,0,0,0 TextChangedImageAssetsFolderTextBox_TextChanged/Button Grid.Column2 Margin10,0,0,0 Content... ClickLoadImageAssetsFolder_Click /Button Grid.Column3 Margin10,0,0,0 ContentX ToolTipDelete path ClickDeleteImageAssetsFolder_Click //Grid/Grid/Grid /ws:Window3后台逻辑代码using Microsoft.Win32; using System; using System.Collections.Generic; using System.IO; using System.Windows; using System.Windows.Controls;namespace LottieSharp.Sample {/// summary/// Interaction logic for MainWindow.xaml/// /summarypublic partial class MainWindow{public MainWindow(){InitializeComponent();Loaded  MainWindow_Loaded;LottieAnimationView.UseHardwareAcceleration(true);}private void MainWindow_Loaded(object sender, RoutedEventArgs e){var path  System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, Assets);var root  new DirectoryInfo(path);var array  new Liststring(); foreach (var item in root.GetFiles()){array.Add(item.Name);}myListBox.ItemsSource  array;}protected override void OnClosed(EventArgs e){base.OnClosed(e);LottieAnimationView.Dispose();DataContext  null;}private void Slider_ValueChanged(object sender, RoutedPropertyChangedEventArgsdouble e){LottieAnimationView.PauseAnimation();LottieAnimationView.Progress  (float)(e.NewValue / 1000);}private void LoadAnimation_Click(object sender, RoutedEventArgs e){OpenFileDialog openFileDialog  new OpenFileDialog();openFileDialog.DefaultExt  .json;openFileDialog.Filter  Json files|*.json|All files|*.*;if (openFileDialog.ShowDialog()  true){LottieAnimationView.PauseAnimation();LottieAnimationView.FileName  openFileDialog.FileName;LottieAnimationView.PlayAnimation();}}private void StartAnimation_Click(object sender, RoutedEventArgs e){LottieAnimationView.PlayAnimation();}private void PauseAnimation_Click(object sender, RoutedEventArgs e){LottieAnimationView.PauseAnimation();}private void LoadImageAssetsFolder_Click(object sender, RoutedEventArgs e){using (var dialog  new System.Windows.Forms.FolderBrowserDialog()){if (dialog.ShowDialog()  System.Windows.Forms.DialogResult.OK)ImageAssetsFolderTextBox.Text  dialog.SelectedPath;}}private void DeleteImageAssetsFolder_Click(object sender, RoutedEventArgs e){ImageAssetsFolderTextBox.Text  ;}private void ImageAssetsFolderTextBox_TextChanged(object sender, TextChangedEventArgs e){LottieAnimationView.PauseAnimation();LottieAnimationView.ImageAssetsFolder  ImageAssetsFolderTextBox.Text;}private void Slider_ValueChanged_1(object sender, RoutedPropertyChangedEventArgsdouble e){if (!double.IsNaN(e.NewValue))LottieAnimationView.Scale  (float)e.NewValue;}private void myListBox_SelectionChanged(object sender, SelectionChangedEventArgs e){var path  System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, Assets, myListBox.SelectedItem.ToString());LottieAnimationView.PauseAnimation();LottieAnimationView.FileName  path;LottieAnimationView.PlayAnimation();}} }案例中只是少数的json文件可以去官网[2]下载更多json文件;源码[3]参考资料[1]LottieSharp: https://github.com/ascora/LottieSharp[2]官网: https://lottiefiles.com/featured[3]源码: https://gitee.com/yanjinhua/LottieSharp
http://www.yutouwan.com/news/296739/

相关文章:

  • 手机wap网站开发内蒙古住房与城乡建设部网站
  • 杭州的做网站公司沈阳网站建设设计报价
  • 广17网站一起做网店邢台网站制作有哪些
  • 榆林哪里做网站如何填写网站建设计划表
  • 做数据新闻的网站软件开发电脑推荐
  • 建设网站群的好处app可以申请专利吗
  • 外贸建站的公司易网网站
  • 凤冈县住房和城乡建设局网站wordpress 点点模版
  • wordpress加个文本框班级优化大师手机版下载(免费)
  • 网站建设与管理 管理课程宁波网站开发rswl
  • 长春净月潭建设投资集团网站精品网站设计欣赏
  • 广州建站优化做网页的软件h
  • 更换网站后台管理系统制作链接的小程序
  • nat123做网站苏州知名网站建设
  • 天津建设工程信息网站个人内网网站建设
  • 营销型网站定做番禺高端网站制作
  • 网站本地环境搭建网络营销推广主要做什么?有哪些方法和技巧
  • 免费网站建设合同范本百度首页网址是多少
  • 濮阳网站优化南京市公共资源建设中心网站
  • 品牌网站建设报价制作网站公司选 择乐云seo专家
  • 广州网站建设藤虎网络虚拟主机能做什么
  • 建设银行网站ie11打不开重庆今天的新消息
  • 怎么做网站的寄生百度推广总部电话
  • 苏州做网站设计的公司北京本地网络推广平台
  • 销售网站开发背景购买设备有什么网站做参考
  • 使馆网站建设公司门户网站首页
  • 团购网站模块wordpress页面右上
  • 门户网站域名wordpress多色主题
  • cetos做网站360网站建设基本情况
  • 思勤传媒网站建设公司合肥住房和建设厅网站首页