Generate SVG Spirals In JavaScript – Spirals.js

Category: Chart & Graph , Javascript | January 7, 2021
Author:alonsocucei
Views Total:569 views
Official Page:Go to website
Last Update:January 7, 2021
License:MIT

Preview:

Generate SVG Spirals In JavaScript – Spirals.js

Description:

Spirals is a JavaScript library to draw an Archimedean spiral with Bezier Curve and SVG.

Intended for creating an SVG-based circle graph that consists of spirals, circles, radial lines, and an XY coordinate system.

How to use it:

1. Load the JavaScript spirals.js in the document.

<script src="spirals.js"></script>

2. Define paths for the graph.

const paths = {
      circles: {
        stroke: "lightgray",
        opacity: 0.3
      },
      spiral360: {
        stroke: "blue"
      },
      axes:
      {
        stroke: "red",
        "stroke-width": 5
      },
      angles: {
        stroke: "blue",
      },
      spiralLines: {
        stroke: "orange"
      },
      style: {
        opacity: 0.3
      }
};

3. Render the graph. Possible parameters:

  • x
  • y
  • radius
  • loops
  • startingAngle
  • pathsToDisplay
// createArchimedeanSpiralWithBezierCurve(x, y, radius, loops, startingAngle, pathsToDisplay);
createArchimedeanSpiralWithBezierCurve(250, 250, 250, 3, 180, paths);

You Might Be Interested In:


Leave a Reply