Skip to main content
Home

Built and signed on GitHub Actions

Spinning svgs on a canvas.

This package works with Browsers
This package works with Browsers
JSR Score
100%
Published
8 months ago (0.1.11)

Spinning SVGs

Playful experiment attempting to use SVGs within HTML canvas. Using the SVGs directly was too computationally expensive, so I copied them across to a offscreen/ sprite-canvas. I then copy across the needed sprite on each render cycle.

I attempted to keep my files more functional in style, which allowed me to learn some things along the way. The code and it's resulting effects aren't perfect, but good enough for what I was aiming for. Besides, my kids loved playing with the imperfections, so I left them in.

@example

import { SpinningSVGs } from "@ultrachrisp/spinning-svgs";

const settings = {
  tag: "#wrapperElement",
  svg: "<svg></svg>",
  svgQuery: "%COLOUR%", // a tag to find and replace in the SVG, so that you can have different colours in the sprite sheet.
  svgWidth: 50,
  colours: ["#000000", "#FFFFFF"],
};

SpinningSVGs({ settings });
Built and signed on
GitHub Actions

New Ticket: Report package

Please provide a reason for reporting this package. We will review your report and take appropriate action.

Please review the JSR usage policy before submitting a report.