Gauge

author:
Daniel Sperl
description:
A simple gauge / progress bar
compatible:
v2.0
tag:
gauge, progressbar
homepage:
https://gist.github.com/2310972

Overview

A sample gauge in its various stages.

This extension class displays a texture that is trimmed towards the left side (depending on a ratio value). This can be used to create a progress bar or a rest-time display.

You control the gauge by changing its ratio property to a value between 0 and 1.

var gauge:Gauge = new Gauge(texture);
gauge.ratio = 0.5;
addChild(gauge);

In the sample on the right, the gauge is just the yellow texture. By displaying this object in front of a grey background and border, it looks as if this was a container that grows empty.

Changelog

  • 2012/04/05: First public version

Source Code

%gist(2310972)%

User Comments

@ekeeper: upgraded version - https://gist.github.com/ekeeper/5212291

  extensions/gauge.txt · Last modified: 2018/12/11 13:23 by daniel
 
Powered by DokuWiki