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

pixi-spine-runner

v0.0.4

Published

PIXI Spine Runner

Downloads

8

Readme

PIXI Spine Runner

Run your 2D spine animations using pixi.js rendering library.

This tool is useful when you want to cross-check a spine animation on your end without having prior knowledge of a rendering library like pixi.js.

Point to note

In case you don't know, we are not running spine animation file i.e. .spine file, as it is not possible using code. We're running the spine using the below three files:

  • .json
  • .atlas
  • .png You must have these files in order to run the spine and these must be located at the same folder. Also make sure one thing, your .atlas should be pointing to the correct .png files' name. You can open the file and easily see which pngs it is pointing.

Install the package

npm i pixi-spine-runner

Write a config to for spine

This config includes all the settings for the spine animation that will be rendered using pixi.js, such as the path to your spine's JSON file in the project and the div element where you want to display your spine. You can also adjust the animation speed from the config.

Example

const config = {
    divElement: document.getElementById('game'),
    pixiDevTool: true,
    backgroundColor: '#C69241',
    paddingX: 20,
    paddingY: 20,
    jsonPath: "./assets/your_spine.json",
    animations: [],
    animationsSwitchTime: 3000,
    singleAnimationLoop: true,
    animationsLoop: true,
    animationScale: {
        x: 1,
        y: 1
    },
    animationSpeed: 1
}

Explaination

  • divElement: It's the div element you want your spine to be in.
  • pixiDevTool: If it's true you'll be able to see containers of pixi using Pixi Dev tool chrome's extension.
  • backgroundColor: background color of the app
  • paddingX: X padding from the box which surrounds the spine.
  • paddingY: Y padding from the box which surrounds the spine.
  • jsonPath: It's the path of the json file in the project.
  • animations: If you want to play any specific set of animations then mention those in this array otherwise leave empty, it will play all the animations one by one. (You can find those available animations for the spine in the json)
  • animationsSwitchTime: Time in milliseconds, for each animation to play and switch to next animation in loop.
  • singleAnimationLoop: If true, then it will play the animation in loop until the next animation time comes.
  • animationsLoop: To play all the animations in loop. If true, it will start playing the all animations again one after one once all done.
  • animationScale: Set the x and y scaling of the spine. Value should be in 0 to 1. Sometimes Animation is so large to fit in the browser's window, you can set the scaling to lower for letting it to fit in the browser's window.
  • animationSpeed: Set the animation's speed.

Run spine animation

Create an instance:

const spineRunner = new PixiSpineRunner(config)

Start animation

spineRunner.init()