Skip to content

Instantly share code, notes, and snippets.

@AndrewRayCode
Last active December 12, 2016 00:43
Show Gist options
  • Save AndrewRayCode/988ce72f67a56b277dbab8923d928fbc to your computer and use it in GitHub Desktop.
Save AndrewRayCode/988ce72f67a56b277dbab8923d928fbc to your computer and use it in GitHub Desktop.
// Build the spiral geometry
for( let i = 0; i < lineSteps; i += 1 ) {
const position = new Vector3(
( -( i / lineSteps ) * lineLength ) + ( lineLength / 2 ),
radius * Math.sin( ( i / lineSteps ) * ( Math.PI * 2 * coils ) ),
radius * Math.cos( ( i / lineSteps ) * ( Math.PI * 2 * coils ) ),
);
vertexGeometry.vertices.push( position );
}
// add the bulbs
for( let i = 0; i < bulbsPerStrand; i += 1 ) {
const position = new Vector3(
( -( i / bulbsPerStrand ) * lineLength ) + ( lineLength / 2 ),
radius * Math.sin( ( i / bulbsPerStrand ) * ( Math.PI * 2 * coils ) ),
radius * Math.cos( ( i / bulbsPerStrand ) * ( Math.PI * 2 * coils ) ),
);
bulbMesh.position.copy( position );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment