Skip to content

Instantly share code, notes, and snippets.

@Szeliga
Last active December 11, 2015 15:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Szeliga/4619286 to your computer and use it in GitHub Desktop.
Save Szeliga/4619286 to your computer and use it in GitHub Desktop.
# SVG path string
path_string = "M,208,405C,208,405,206,744,206,744C,206,744,552,715,552,715C,552,715,590,451,590,451C,590,451,208,405,208,405"
# points will contain an array of arrays for each point of the path
points = Raphael.parsePathString(pe.attrs.path_string)
spline = new THREE.Shape()
spline.autoClose = true
_.each points, (p, i) ->
switch p[0]
when "M" then spline.moveTo(p[1], p[2])
when "C" then spline.bezierCurveTo(p[1], p[2], p[3], p[4], p[5], p[6])
geo = new t.ShapeGeometry(spline)
mesh = new t.Mesh(geo, mat)`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment