materialLineScale
Provides access to the `scale` property on a `LineDashedMaterial`, a global scaling factor used to uniformly enlarge or shrink the entire dash pattern while maintaining its proportions.
Core Advantages
Its core advantage is separating the pattern's 'proportion' (defined by dash/gap size) from its 'size' (defined by scale), allowing macro-control of the entire pattern by modifying just one property, which greatly simplifies dynamic adjustments and animations.
Common Uses
As a global multiplier to adjust the overall size of a dash pattern without changing its ratio.
Linked to camera zoom levels to achieve visually constant-sized dashes (LOD).
Animating its value from a large number to 1 to create a line 'drawing' or 'appearing' effect.
As a UI state indicator, making a dashed outline 'denser' on selection by changing its scale.
How to adjust
Adjust by modifying the `scale` property (a number) of the `LineDashedMaterial` in JavaScript. A value greater than 1 enlarges the pattern (longer dashes and gaps), while a value less than 1 shrinks it (shorter dashes and gaps).
Code Examples
1// Internally, scale is used to scale the distance along the line, affecting dash/gap calculations
2const effectiveDistance = vLineDistance.div( materialLineScale );
3
4if ( mod( effectiveDistance, dashSize.add( gapSize ) ).greaterThan( dashSize ) ) {
5
6 discard;
7
8}