npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

reveal.js-svg-timeline-fragment

v0.1.2

Published

reveal.js plugin to add svg.js timelines as fragments

Downloads

42

Readme

reveal.js-svg-timeline-fragment

A Reveal.js plugin to add svg.js timelines as fragments.

Installation

npm i reveal.js-svg-timeline-fragment

Usage

Add the plugin:

<script type="module">
  import RevealSvgTimelineFragment from "reveal.js-svg-timeline-fragment";

  import Reveal from "reveal.js";

  let deck = new Reveal({
    plugins: [RevealSvgTimelineFragment],
  });
  deck.initialize();
</script>

And then use it in your reveal.js slides, like in this example of a heart svg that first turns white and then moves:

<svg
  id="svg"
  xmlns="http://www.w3.org/2000/svg"
  height="457.01"
  width="490.82"
  version="1.0"
>
  <g id="heart">
    <path
      d="m138.636 12.921c-66.24 0-120 53.76-120 120 0 134.756 135.933 170.088 228.562 303.308 87.574-132.403 228.563-172.854 228.563-303.308 0-66.24-53.76-120-120-120-48.048 0-89.402 28.37-108.563 69.188-19.16-40.817-60.514-69.188-108.562-69.188z"
      fill="#e60000"
      stroke="#000"
      stroke-width="18.7"
    />
    <path
      d="m140.22 31.37c-57.96 0-105 47.04-105 105 0 117.91 118.919 148.838 199.969 265.406 6.56-9.918-139.969-145.527-139.969-245.407 0-57.96 47.04-105 105-105 .505 0 .997.056 1.5.063-17.276-12.584-38.494-20.063-61.5-20.063z"
      fill="#e6e6e6"
      fill-opacity=".646"
    />
  </g>
</svg>
<svg-timeline-fragment>
  <script type="text/template">
    // This will get executed when the fragment sequence arrives at this fragment
    SVG("#svg").find("#heart *").animate({ when: 'start' }).fill('#000');
  </script>
</svg-timeline-fragment>
<svg-timeline-fragment>
  <script type="text/template">
    // This will get executed in the following fragment
    SVG("#svg").find("#heart *").animate({ when: 'start' }).move(100, 100);
  </script>
</svg-timeline-fragment>

You can read the svg.js documentation to find out all the available APIs.

Include SVG Vite Plugin

If you need to embed SVG files by referencing them from your html, you can use the "Include SVG" vite plugin.

Include it in your vite.config.js like this:

import { defineConfig } from "vite";
import includeSvgs from "reveal.js-svg-timeline-fragment/include-svgs.vite-plugin.js";

export default defineConfig({
  plugins: [
    includeSvgs(),
  ],
});