Java Code Examples for processing.core.PApplet#floor()

The following examples show how to use processing.core.PApplet#floor() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MultipleAudioFileRender.java    From haxademic with MIT License 6 votes vote down vote up
public void update( float vol ) 
{
	vol *= 4;
	
	// calc how many to draw
	int numToDraw = PApplet.floor( vol / _eqSegment ); 
	// float remainder = vol - numToDraw * _eqSegment;
	
	// draw whole steps
	tint( 1, 1 );
	for( int i = 0; i < numToDraw; i ++ )
	{
		pushMatrix();
		image( _image, _index * 100, 500 - i*100, 100, 100 );
		popMatrix();
	}
	
	// draw last
	tint( 1, vol );
	pushMatrix();
	image( _image, _index * 100, 500 - numToDraw*100, 100, 100 );
	popMatrix();
	
}
 
Example 2
Source File: RingtoneVideo.java    From haxademic with MIT License 6 votes vote down vote up
public void update( float vol ) 
{
	vol *= 4;
	
	// calc how many to draw
	int numToDraw = PApplet.floor( vol / _eqSegment ); 
	float remainder = vol - numToDraw * _eqSegment;
	
	// draw whole steps
	tint( 1, 1 );
	for( int i = 0; i < numToDraw; i ++ )
	{
		pushMatrix();
		image( _image, _index * 100, 500 - i*100, 100, 100 );
		popMatrix();
	}
	
	// draw last
	tint( 1, vol );
	pushMatrix();
	image( _image, _index * 100, 500 - numToDraw*100, 100, 100 );
	popMatrix();
	
}
 
Example 3
Source File: MapOverlay.java    From constellation with Apache License 2.0 5 votes vote down vote up
protected final void drawStepBar(final int stepLevel, final float x, final float y, final int maxStepLevel) {
    final int stepWidth = PApplet.floor((stepBarWidth / maxStepLevel));
    renderer.noStroke();
    for (int i = 0; i < maxStepLevel; i++) {
        renderer.fill(i < stepLevel ? stepOnColor : stepOffColor);
        renderer.rect(x + i * stepWidth, y, stepWidth - 1, 6);
    }
}