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

网站设计网站建站做网站商标分类

网站设计网站建站,做网站商标分类,网页游戏开服表怎么删,做网站有送企业邮箱吗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.dnsts.com.cn/news/12429.html

相关文章:

  • 自己做网站需要什么材料wordpress api下载文件
  • 网站建设怎么让网站收录wordpress固定连接只能访问首页
  • 性价比最高网站建设电话网站建设与管理题
  • 太原seo网站优化怎样在网站图片上做店铺广告
  • wordpress建立好的网站便宜做外贸网站
  • 莆田哪里有网站开发网站如何做响应
  • 建设e购物网站wordpress图片模板下载
  • 什么网站做软文长沙有什么好玩的游乐场
  • wordpress 会员重庆seo整站优化系统
  • 旅游景点网站设计怎样做国外能看到的网站
  • 新站加快网站收录网站的制作步骤
  • 做网站前端ps很重要吗应用公园制作app下载
  • 网站怎样做优化调整内蒙古两学一做网站
  • 网站开发团队人员建设通和天眼查网站
  • 网站片区最有前景的代理产品
  • 江门好的建站网站手机上page转换wordpress
  • 网站专题模板wordpress获取不同分类文章
  • 卖网站赚钱吗后期网站
  • 网站的一般制作流程公司建网站制作平台
  • 益阳市建设局网站湖州百度网站建设
  • 有什么免费做代理的网站北京网站制作飞沐
  • 企业网站建设方案怎么写网站建设咨询中心
  • 哈尔滨网站设计小程序开发定制外包15
  • a站app制作装饰公司网站
  • 怎样登录韵网网站浅谈一下网络营销的几个误区
  • 培训方案网站建设wordpress实现预览
  • 怎样做网站分流赚钱庄河市城乡规划建设局网站
  • 深圳画册设计网站wordpress yeti2.0
  • 网站负责人可以备案织梦网站程序安装
  • 大型网站的制作国内网站开发平台哪家强