Coder Social home page Coder Social logo

tanysky / cesium-materialline Goto Github PK

View Code? Open in Web Editor NEW

This project forked from zhangti0708/cesium-materialline

0.0 0.0 0.0 5.37 MB

基于cesium自定义材质线插件

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

JavaScript 59.35% CSS 2.70% HTML 37.95%

cesium-materialline's Introduction

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]),
          }
        });
      }

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.