Skip to main content
100%

polyline

✓ Published0🌍 Public
SSaminu
Last edited Apr 3, 2017
Created on Apr 3, 2017

This example renders 1000 randomly generated 3D points as a single SVG `<polyline>` element, using a `<marker>` to draw small line segments at each point. The code demonstrates high-performance SVG rendering by updating the polyline’s point coordinates directly via the `SVGPointList` API instead of re-serializing string attributes. It also shows CSS styling of markers and a static pseudo-3D projection (rotation is commented out). The visualization highlights that SVG `transform` updates are not GPU-accelerated, unlike HTML elements, as noted in the README.

AI-generated description

Uploaded from codepen.io/monfera/pen/oLoRgX with blockbuilder.org

This bl.ock shows

  • rendering of 500 points with just one <polyline> and a <marker> (to switch off line and haze, set <polyline> fill-opacity and stroke-width to zero)
  • styling of the marker with CSS
  • SVG attribute update without going through string serialization / parsing (due to a probable bug in Safari, it's much slower there than the string-based equivalent)
  • pseudo 3D transformation
  • proof that SVG rendering, unlike HTML element rendering, isn't GPU accelerated for transform: open Dev Tools, Rendering -> Paint Flashing shows green rectangles

forked from <a href='http://bl.ocks.org/monfera/'>monfera</a>'s block: <a href='http://bl.ocks.org/monfera/fb2ba8d3b6c3fbeb5f1f54b7dc4d58ea'>500 points with one polyline</a>

mit Licensed

Similar vizzes