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

成品网站模板下载免费建站的网站99

成品网站模板下载,免费建站的网站99,淘宝客网站建设教程视频,企业为什么做网站素材flutter开发实战-CustomClipper裁剪长图帧动画效果 在开发过程中#xff0c;经常遇到帧动画的每一帧图显示在超长图上#xff0c;需要处理这种帧动画效果。我这里使用的是CustomClipper 一、CustomClipper CustomClipper继承于Listenable abstract class CustomClipper e…flutter开发实战-CustomClipper裁剪长图帧动画效果 在开发过程中经常遇到帧动画的每一帧图显示在超长图上需要处理这种帧动画效果。我这里使用的是CustomClipper 一、CustomClipper CustomClipper继承于Listenable abstract class CustomClipper extends Listenable 我们实现CustomClipper子类来实现裁剪功能 class PicCustomClipper extends CustomClipperRect {PicCustomClipper(this.rect);Rect rect;// Rect getClip(Size size) Rect.fromLTWH(0.0, 15.0, 40.0, 30.0);overrideRect getClip(Size size) rect;overridebool shouldReclip(CustomClipperRect oldClipper) true; }getClip()是用于获取剪裁区域的接口由于图片大小是60×60我们返回剪裁区域为Rect.fromLTWH(10.0, 15.0, 40.0, 30.0)即图片中部40×30像素的范围。 shouldReclip() 接口决定是否重新剪裁。 如果在应用中剪裁区域始终不会发生变化时应该返回false这样就不会触发重新剪裁避免不必要的性能开销。 如果剪裁区域会发生变化比如在对剪裁区域执行一个动画那么变化后应该返回true来重新执行剪裁。 二、实现播放帧动画 CustomClipper裁剪长图后每隔一段时间展示长图的不同区域实现帧动画的连贯效果。 class PicFrameAnim extends StatefulWidget {const PicFrameAnim({required this.size, required this.imageSize, Key? key}): super(key: key);final Size size;final Size imageSize;override_PicFrameAnimState createState() _PicFrameAnimState(); }class _PicFrameAnimState extends StatePicFrameAnimwith TickerProviderStateMixin {late Duration _duration;late int _imageIndex;late int _currentIndex;// 定义一个裁剪late PicCustomClipper _clipper PicCustomClipper(Rect.fromLTWH(0.0, 0.0, widget.size.width, widget.size.height));overridevoid initState() {// TODO: implement initStatesuper.initState();_duration Duration(milliseconds: 200);_imageIndex 1;_currentIndex 0;if (widget.size.height 0) {_imageIndex (widget.imageSize.height / widget.size.height).floor();}if (_imageIndex 2) {updateImage();}}void updateImage() {if (_currentIndex _imageIndex) {_currentIndex 0;}_clipper PicCustomClipper(Rect.fromLTWH(0.0,_currentIndex * (widget.size.height),widget.size.width,widget.size.height));_currentIndex;if (mounted) {setState(() {});}Future.delayed(_duration, () {if (mounted) {updateImage();}});}overridevoid dispose() {// TODO: implement disposesuper.dispose();}Matrix4 buildMatrix4() {double dx 0;double dy 0;///Y轴方向平移dy -_currentIndex * (widget.size.height) (widget.size.height);///在XOY平面的平移return Matrix4.translationValues(dx, dy, 0);}overrideWidget build(BuildContext context) {return Container(width: widget.imageSize.width,height: widget.imageSize.height,child: Transform(///构建Matrix4transform: buildMatrix4(),///中心对齐alignment: Alignment.center,child: ClipRect(clipper: _clipper,child: buildBGArrow(context),),),);}Widget buildBGPicImage(BuildContext context) {return Image.network(https://avatars2.githubusercontent.com/u/20411648?s460v4,width: 100.0,height: 300.0, );} }三、小结 flutter开发实战-CustomClipper裁剪长图帧动画效果。 https://blog.csdn.net/gloryFlow/article/details/132253251 学习记录每天不停进步。
http://www.eeditor.cn/news/124879/

相关文章:

  • 十大个人博客网站网络品牌推广ppt
  • 杭州市西湖区建设局网站wordpress 随机文章
  • 服务器有了怎么做网站游戏链接点开即玩
  • 手机建网站公司杭州网站程序开发公司
  • 微信的微网站模板网站模板 html
  • 福清建设局网站简介wordpress右侧悬浮搜索菜单
  • 网站备案背景幕布企业网站建设心得
  • 青州做网站的公司二次开发的软件
  • 为什么要进行网站建设如何建立自己的个人网站
  • 呼和浩特城乡建设网站自己买服务器做网站
  • 专业做网站优化需要多久科技文化网站建设方案
  • 网站建设放入什么会计科目给公司做网站风险
  • 不属于网站后期维护网站服务器空间选择
  • 济源网站开发重庆施工员证查询网站
  • 建设企业网站需要了解什么wordpress插件翻译
  • 用wordpress付费网站专业的网站设计制作公司
  • 网站开发与实践题库中国联通网站备案
  • 贵港市网站建设科技有限公司一般是做什么的
  • 网站建设 源码登录腾讯邮箱企业邮箱入口
  • 如何制作自己的公司内部网站网站开发软件是什么专业
  • 网站开发及维护合同范本wordpress 4.0 文章标题翻译插件
  • 陕西网站制作html制作电影网站
  • 网站二维码制作网站推广运营
  • 郑州建站网站的公司html交易网站设计实例
  • 网站建设东莞wordpress文章作者
  • 全返网站建设免费seo网站自动推广软件
  • 著名的网站有哪些有没有专门做教程的网站
  • 易展 网站建设大兴网站建设推广
  • 建设网站海报文案建设专题网站
  • 高端摄影网站模板下载福田网站推广