Velocimeter
Last updated
Was this helpful?
Was this helpful?
// Adds a timer
tt = addTimer(50);
// Creates a simple Velocimeter
vel = new Velocimeter();
vel.value = -20;
vel.max = 40;
vel.pointerColor = Color.GREEN;
add(vel, CENTER, CENTER, PARENTSIZE + 50, PARENTSIZE + 50);
// Generates an event from the timer
@Override
public void onEvent(Event e)
{
if (e.type == TimerEvent.TRIGGERED && tt.triggered)
{
vel.value++;
if (vel.value > vel.max + 20)
{
vel.value = vel.min - 20;
}
repaint();
}
}