papa3642240 / cesium-materialLine

基于cesium自定义材质线插件

Home Page:http://zhangticcc.gitee.io/cesium-materialline/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

cesium-materialLine

基于cesium自定义材质线插件


基于cesium的自定义材质线插件

cesium-materialLine

说明

/cesium-materialLine/src/doc

使用

在项目中引入Cesium.js
然后引入 cesium-materialLine.js 即可

 

      // 自定义纹理材质
      let MaterialLineImage = [
        './src/line.png',
        './src/line2.png',
        './src/line3.png',
      ]

      // color
      let colors = [
        new Cesium.Color(77 / 255, 201 / 255, 255 / 255, 1),
        new Cesium.Color(255 / 255, 201 / 255, 38 / 255, 1),
        new Cesium.Color(221 / 255, 221 / 255, 221 / 255, 1)
      ];

      // 创建材质线
      let getCustomMaterialLine = (image, color) => {
        return new Cesium.CustomMaterialLine({
          image: image,
          color: color,
          duration: 2000
        })
      }
      // 添加实体线
      let startPoint = Cesium.Cartesian3.fromDegrees(104.081701757991, 30.627042558105988)
      let glowingLine = null
      for (let i = 0, len = 8; i < len; i++) {

        let endPoint = Cesium.Cartesian3.fromDegrees((Math.random() / 100) +
          104.081701757991, (Math.random() / 100) + 30.627042558105988);
        glowingLine = viewer.entities.add({
          polyline: {
            positions: [startPoint, endPoint],
            width: 5,
            material: getCustomMaterialLine(MaterialLineImage[i % 3], colors[i % 3]),
          }
        });
      }

About

基于cesium自定义材质线插件

http://zhangticcc.gitee.io/cesium-materialline/


Languages

Language:JavaScript 59.3%Language:HTML 38.0%Language:CSS 2.7%