zoukankan      html  css  js  c++  java
  • egret:环形进度条遮罩

      一、界面结构:

      二、代码:

      

        private arc_angle:number;
        private resProMask(): void {
            egret.stopTick(this.shapeTicker,this);
            if(this.data.retime == 0)return;
            //创建环形进度遮罩
                    if(this.res_shape&&this.res_shape.parent)this.res_shape.parent.removeChild(this.res_shape);
            this.res_shape = new egret.Shape();
            this.res_shape.x = this.gro_res_pro.x;
            this.res_shape.y = this.gro_res_pro.y;
            this.gro_res_pro.addChild(this.res_shape);
            this.img_res_pro.mask = this.res_shape;//遮罩
    
            this.arc_angle = -90;
            egret.startTick(this.shapeTicker, this);
    
        }
        private shapeTicker(timeStamp:number):boolean{
            let c = this.gro_res_pro.width/2;
            this.res_shape.graphics.clear();
            this.res_shape.graphics.beginFill(0x00ffff, 1);
            this.res_shape.graphics.moveTo(c, c);
            this.res_shape.graphics.lineTo(c, -c);
            this.res_shape.graphics.drawArc(c, c, c, -90 * Math.PI / 180, this.arc_angle * Math.PI / 180,false);
            this.res_shape.graphics.lineTo(c, c);
            this.res_shape.graphics.endFill();
    
            this.arc_angle += 1.5;
         //进度转完一圈后的操作
            if (this.arc_angle == 270) {
                this.playStarAni();
                this.res_tween.play(0);
                this.arc_angle = -90;        
            }
            return false;
        }    

      三、效果:

  • 相关阅读:
    方法重写
    百度地图(5)-添加标注
    百度地图(3)-添加地图控件
    百度地图(2)-初始化地图
    GIS系统开发流程
    百度地图(1)- JavaScript API V3.0 对比 JavaScript GL API 1.0
    通过QGIS下载OSM数据
    深入理解 Spring 之源码剖析IOC
    FastDFS安装教程
    FastDFS简介
  • 原文地址:https://www.cnblogs.com/WentingC/p/11971686.html
Copyright © 2011-2022 走看看