let bg = this.createBitmapByName("123_png");
    this.addChild(bg)
    bg.x = this.stage.width / 2
    bg.y = this.stage.height / 2
    bg.anchorOffsetX = bg.width / 2
    bg.anchorOffsetY = bg.height / 2
    let infoList = [5, 2, 7, 9, 4, 1]
    let list = this.getPolyPoint(infoList, bg)

    var shp: egret.Shape = new egret.Shape();
    shp.graphics.lineStyle(2, 0x00ff00);
    shp.graphics.beginFill(0xff0000, 1)

    for (let i in list) {
        if (Number(i) == 0)
            shp.graphics.moveTo(list[i].x, list[i].y);
        else
            shp.graphics.lineTo(list[i].x, list[i].y);
    }

    shp.graphics.endFill();
    this.addChild(shp)

    for (let i in list) {
        var circle:egret.Shape = new egret.Shape();
        circle.graphics.beginFill( 0x00ff00, 1);
        circle.graphics.drawCircle( list[i].x, list[i].y, 5);
        circle.graphics.endFill();
        this.addChild(circle);
    }

public getPolyPoint(infoList, item){
        let list = []

        let x = this.stage.width / 2
        let y = this.stage.height / 2

        for (let i = 1; i <= 7; i++) {
            let info = infoList[i - 1]
            if (info == undefined)
                info = infoList[0]

            let point = new egret.Point
            let w = item.width / 2 * (info * 0.1)
            let h = item.height / 2 * (info * 0.1)
            let w1 = w / 2

            switch (i) {
                case 2:
                    point.x = x + w1
                    point.y = y - h
                    break
                case 3:
                    point.x = x + w
                    point.y = y
                    break
                case 4:
                    point.x = x + w1
                    point.y = y + h
                    break
                case 5:
                    point.x = x - w1
                    point.y = y + h
                    break
                case 6:
                    point.x = x - w
                    point.y = y
                    break
                default:
                    point.x = x - w1
                    point.y = y - h
                    break
            }

            list.push(point)
        }

        return list
    }

最新文章

  1. linux下安装memcache(php版本5.3)
  2. 世界上最小的发行版之一Tiny Core
  3. HDU 5927 Auxiliary Set (dfs)
  4. VC6.0设置选项解读(转)
  5. iOS实现白板、画板功能,有趣的涂鸦工具,已封装,简单快捷使用
  6. poj-2287---Tian Ji -- The Horse Racing
  7. CentOS下使用命令行Web浏览器Links
  8. vue 通知 走马灯效果
  9. 在ASP.NET MVC里对Web Page网页进行权限控制
  10. docker 8 docker的镜像命令
  11. mysql5.5.48的my.cnf配置
  12. pytest的fixture和conftest
  13. 九个问题从入门到熟悉HTTPS
  14. flynn 开源paas 平台安装试用
  15. 【知识总结】Activiti工作流学习入门
  16. 深入理解javascript作用域系列第一篇
  17. Django 框架之 Models
  18. asp.net 输入框在chrome中无法关闭自动提示
  19. CentOS7搭建 Hadoop + HBase + Zookeeper集群
  20. 笨办法学Python(三十七)

热门文章

  1. os.path模块【python】
  2. Linux printf 命令
  3. windows下配置nutch注意的问题
  4. jsonObject的一些方法
  5. C#实现两个时间相减的方法
  6. JS-检测浏览器类型及版本
  7. python的类继承与派生
  8. MySQL 5.6 my.cnf 参数说明(转)
  9. 树形DP求树的直径
  10. matplotlib 散点图scatter