Java Code Examples for processing.core.PApplet#map()
The following examples show how to use
processing.core.PApplet#map() .
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: InfoOverlay.java From constellation with Apache License 2.0 | 6 votes |
protected void drawLabeledEvent(final String label, final float listeningValue, final float broadcastingValue, final float x, final float y, final float valueBoxWidth) { final int alphaSend = (int) PApplet.map(broadcastingValue, 0, 1, 0, 255); drawEvent(x, y + 4, valueBoxWidth, renderer.color(eventBoxColorSendingOn, alphaSend)); final int alphaReceive = (int) PApplet.map(listeningValue, 0, 1, 0, 255); drawEvent(x + 6, y + 4, valueBoxWidth, renderer.color(eventBoxColorReceivingOn, alphaReceive)); final float labelX = x - padding - Math.min(renderer.textWidth(label.toUpperCase()), maxLabelLength); final float labelY = y + textSize - 3; renderer.textFont(font); renderer.textSize(8); renderer.noStroke(); renderer.fill(textColor); renderer.text(label.toUpperCase(), labelX, labelY); }
Example 2
Source File: Pmap.java From warp10-platform with Apache License 2.0 | 6 votes |
@Override public Object apply(WarpScriptStack stack) throws WarpScriptException { List<Object> params = ProcessingUtil.parseParams(stack, 5); PGraphics pg = (PGraphics) params.get(0); double v = (double) PApplet.map( ((Number) params.get(1)).floatValue(), ((Number) params.get(2)).floatValue(), ((Number) params.get(3)).floatValue(), ((Number) params.get(4)).floatValue(), ((Number) params.get(5)).floatValue() ); stack.push(pg); stack.push(v); return stack; }
Example 3
Source File: List.java From Project-16x16 with GNU General Public License v3.0 | 5 votes |
public void display() { displayListArea(); displayElements(); confirm.display(); cancel.display(); setCover(); applet.pushMatrix(); scrollBar.display(); scrollBar.update(); applet.popMatrix(); scrollPass = (int) PApplet.map(scrollBar.barLocation, 1, 0, elements.length*30, 0); }
Example 4
Source File: Notifications.java From Project-16x16 with GNU General Public License v3.0 | 5 votes |
public static void assignApplet(SideScroller s) { game = s; positionTarget = new PVector(game.gameResolution.x - notificationWidth, game.gameResolution.y - notificationHeight); background = game.createImage(notificationWidth, notificationHeight, PApplet.ARGB); for (int i = 0; i < background.pixels.length; i++) { float a = PApplet.map(i, 0, background.pixels.length, 255, 0); background.pixels[i] = Utility.colorToRGB(50, 100, 150, a); } }
Example 5
Source File: ParticleAnimationController.java From Project-16x16 with GNU General Public License v3.0 | 4 votes |
private PImage getImage(float maxLife, float currentLife) { int id = (int) PApplet.map(currentLife, maxLife, 0, 0, images.size()-1); return images.get(id); }