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

phaser-updatable-label

v1.0.3

Published

An UpdatableLabel type for phaser which will give you animated updates

Downloads

2

Readme

phaser-updatable-label

An UpdatableLabel type for phaser which will give you animated updates

Install

npm

    npm install phaser-updatable-label

bower

    bower install phaser-updatable-label

Usage

  // If you used browerify. Else just add it in script tag and use class UpdatableLabel.
  var UpdatableLabel = require('phaser-updatable-label');

  // Create the label.
  var label = new UpdatableLabel(this.game, startX, startY);

  // Add a value to the label. We define the start position for the value we add
  // This will start the animation and add the value
  label.addValue(10, {x: 100, y: 100});

  // Get the new value. This is the updated value even though the label is not
  var newValue = label.getValue();
  
  // Set a value. This will not trigger an animation
  label.setValue(100);

  // We can also add multiplications. If the value was 1 and we add multiplier by 2
  // the new value will be 2
  label.addMultiplier(value, {x: 100, y: 100});

  // And remove it. The module take care of correct number, so you should use
  // the value of 2 if you used 2 in addMultiplier
  label.removeMultiplier(value);

Options

You have some options which will define the look and feel of the label, if you do not like the standard options. You an add the options when you create the label

  var options = {}
  var label = new UpdatableLabel(this.game, startX, startY, options);

Font options

These options are for which fonts will be used

  var options = {
     // Define the font for the label
     font: {
              font: '50px Arial',
              fill: '#00',
              align: 'center'
           },
           
     // Define the font for the update
     updateFont: {
              font: '90px Arial',
              fill: "#39d179",
              stroke: "#ffffff",
              strokeThickness: 15
           }
  }

Label options

These options are for the animation of the label

  var options = {
    // If the label should be animated when updated
    labelAnimate: true,
    
    // The size the label should be animated to
    labelAnimateSize: 1.5,
    
    // The speed the label should be animated with
    labelAnimateSpeed: 200,
    
    // The easing used for the animation
    labelAnimateEasing: Phaser.Easing.Linear.In
  }

Update options

These options are for the animation of the update

  var options = {
     // The speed the update should be animated with
     updateAnimateSpeed: 800,
     
     // The easing used for the animation
     updateAnimateEasing: Phaser.Easing.Exponential.In
  }