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

phaser3-plugin-easyprogressbar

v1.0.6

Published

This is a phaser 3 plugin for creating easy to use progressbars

Downloads

27

Readme

phaser3-plugin-easyprogressbar

This is a phaser 3 plugin for creating easy to use and beautiful progressbars. Easy progressbars support:

  • Horizontal and vertical layout
  • Forward and backward progress
  • Flat and shiny design
  • Rounded progressbars
  • Customizable progress text
  • Adding and styling indicators
  • Animating progress

Usage

import 'phaser';
import EasyProgressbarPlugin from 'phaser3-plugin-easyprogressbar';

const game = new Phaser.Game({
  width: 1024,
  height: 768,
  backgroundColor: 0xffffff,
  scale: {
    mode: Phaser.Scale.FIT,
    autoCenter: Phaser.Scale.CENTER_BOTH
  },
  scene: {
    create: create,
  },
  plugins: {
    global: [{
      key: 'EasyProgressbarPlugin',
      plugin: EasyProgressbarPlugin,
      start: true
    }]
  }
});

function create() {
  this.add.easyProgressbar(100, 100, 200, 48, {
    color: 0xf7cf57,
    padding: 3,
    radius: 3,
    progress: 1,
    text: {
      enabled: true,
      format: progress => `XP: ${(progress * 100).toFixed(0)}%`,
      origin: {
        x: 0.5,
        y: 0.5
      },
      align: {
        x: 'center',
        y: 'start'
      },
      style: {
        fontSize: '24px',
        stroke: '#000000',
        strokeThickness: 4,
        shadow: {
          offsetX: 2,
          offsetY: 2,
          color: '#000000',
          blur: 4,
          stroke: true,
          fill: true
        }
      }
    }
  });
}

API

// initialize plugin ...
// this.add.easyProgressbar(x, y, width, height, options)
const progressBar = this.add.easyProgressbar(0, 0, 100, 50, {});

Options can be as follows:

| Name | Explanation | Example | Default | |:-|:-|:-|:-| | progress | The initial progress of the progress bar. Must be float between 0 and 1 | 0.5 | 1 | | orientation | Orientation of the progressbar. Can either be horizontal or vertical | horizontal | horizontal| | reverse | Boolean that indicates whether the progressbar operates forward or backwards. Also depends on the orientation. Forward direction for horizonal is from left to right. Forward direction for vertical is from top to bottom. If set to true it reverts the direction (right to left and bottom to top). | true | false | | radius| The radius of the progress bar corners. Maximum value is half of the width and height respectively based on orientation| 5 | 0 | | backgroundColor | The background color of the progress bar | 0xffffff | 0x000000 | | backgroundAlpha | The background alpha of the progress bar | 0.5 | 0.5 | | color | The foreground color of the progressbar | 0xff0000 | 0xffffff | | flat | Boolean that indicates, whether the progressbar has some color highlights (false) or not (true) | false | false | | indicators.enabled | Boolean that indicates whether indicators are drawn or not. | true| false| | indicators.color| The color of the indicators. | 0xffffff| 0x000000| | indicators.alpha| The alpha of the indicators| 0.5| 0.1| | indicators.size| The width or height of the indicators depending on orientation | 5| 2 | | indicators.distance| The distance between indicators in percent of width or height of progressbar depending on orientation| 0.1| 0.1| | text.enabled| Boolean that indicates whether progress text should be drawn| true| false| | text.style| Phaser 3 compatible text style | {} | false| | text.format| Function that takes progress as first parameter and should return a string | progress => (progress * 100).toFixed(0)| progress => progress| | text.origin.x| The x origin of the text| 0.5| 0.5| | text.origin.y| The y origin of the text| 0.5| 0.5| | text.align.x| The horizontal alignment of the text within the progressbar. Must be either start, center or end| end| center| | text.align.y| The vertical alignment of the text within the progressbar. Must be either start, center or end| end| center| | text.padding| The padding of the foreground progressbar to its background| 2| 5|

const progressBar = this.add.easyProgressbar(0, 0, 100, 50, options);

// without animation
progressBar.setProgress(0.2);

// with animation
progressBar.setProgress(0.8, true);

Installation

npm i phaser3-plugin-easyprogressbar

Alternatively you can grab the latest distributed version directly from github via: https://raw.githubusercontent.com/dasheck0/phaser3-plugin-easyprogressbar/master/dist/EasyProgressbarPlugin.js

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/dasheck0/phaser3-plugin-easyprogressbar/pulls. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

License

MIT License

Copyright (c) 2019 Stefan Neidig

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.