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

piglow-animations

v2.0.0

Published

piglow-animations is an extension for piglow that adds animation capabilities

Downloads

5

Readme

piglow-animations Build Status

NPM

NPM

node-piglow-animations is a library on top of node-piglow that allows for piglow animations.

An animation consists of a bunch of interface configurations that will be subsequently invoked. Between the different configurations transitions can be defined as well als transformation and invocation times. A chaining interface makes the configuration of animations super simple.

Check the examples folder for animation examples.

Usage

var piglow = require('piglow-animations');

var animation = piglow.animation;
var pi = piglow.piGlowInterface;

animation({interval:10, debug: true})
    .set().to(pi(['ring_0'])).after('0.1s')
    .set().to(pi(['ring_1'])).after('0.1s')
    .set().to(pi(['ring_2'])).after('0.1s')
    .fade().to(pi['leg_0']).after('1s').in('1s')
    .fade().to(pi['leg_1']).after('1s').in('1s')
    .fade().to(pi['leg_2']).after('1s').in('1s')
    .repeat(3)
    .start(function() {
        console.log('i looped 3 times, now Im done.');
    });

Api

Constructor([options, [backend]])

Creates a new animation object.

Optional options object:

  • interval: defines in which interval LED updates should be made, default: 100
  • debug: activates debugging

The optional backend object can be used to inject a mocking backend (unit tests, non raspi environment etc). See the Adressing section of node-piglow for details.

fade()

Opens up a new fade transition context.

set()

Opens up a new set transition context.

to(piGlowInterface)

This directive relates to a certain context, openend by set or fade. It defines to which LED configuration a transition should morph.

repeat(timeRange)

Defines how often or how long a animation should be run. Possible parameters:

    animation().repeat(1);          //runs exactly once
    animation().repeat('1time');    //runs exactly once
    animation().repeat('2times');   //runs exactly two times
    animation().repeat('10s');      //runs for 10seconds (animation loops will always be completed)
    animation().repeat('0.1s');     //runs for 100ms (animation loops will always be completed)
    animation().repeat('100ms');    //runs for 100ms (animation loops will always be completed)

If no repeat directive has been set the animation will run forever.

after(timeRange)

This directive relates to a certain context, opened by set or fade. Defines how much time should pass until the transition gets started. Check Repeat for possible values.

in(timeRange)

This directive relates to a certain context, opened fade. Defines how much time the fade transition should run. Check Repeat for possible values.

start([callback])

Starts the animation. Accepts an optional callback that will be called when the animation has been finished.

stop([noCallback])

Stops the animation, if present the callback from the start command will be fired. If the parameter noCallback has been set, the callback will not be invoked.

Variations of interface configurations

For your convenience there are some additional ways of predefining LED values:

var pi = require('piglow').piGlowInterface;

//create and set
var a = pi();
a.ring_0 = 100;

//initialize with predefined values
var b = pi({'ring_0': 100, 'l_1_1': 10});

//initialize with maximum brightness
var c = pi(['ring_5']);