spite / THREE.MeshLine

Mesh replacement for THREE.Line
MIT License
2.16k stars 380 forks source link

Example to display Dashed Lines #66

Closed satyan closed 4 years ago

satyan commented 6 years ago

Do we have an example to display Dashed lines.. I see the three parameters in the MeshLineMaterial namely (dashArray, dashRatio and dashOffset), but am not able to provide right values to draw a dashed line.

Thanks for the amazing library.

Jeremboo commented 5 years ago

The dashed lines properties are already implemented in the demo part:

https://github.com/spite/THREE.MeshLine/blob/d15d05c93d45477245bb004ec0bedd9cbd17c181/demo/js/main.js#L26-L28

https://github.com/spite/THREE.MeshLine/blob/d15d05c93d45477245bb004ec0bedd9cbd17c181/demo/js/main.js#L166-L168

https://github.com/spite/THREE.MeshLine/blob/d15d05c93d45477245bb004ec0bedd9cbd17c181/demo/js/main.js#L60-L61

You can also see it usage in thoses codepen :

jimtang commented 5 years ago

I found these two parameters are important to draw dash style:

transparent: true,
opacity: 1,

and these are attributes from base class Material, don NOT forget to set them!!!

Jeremboo commented 5 years ago

@satyan you can find a complete tutorial on Codrops: Animated Mesh Lines

Updated thanks to @jimtang & @Mamboleoo who are hightlight the importance to set transparent: true into the material.