Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion content/api_en/print.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ The <b>print()</b> function writes to the console area, the black rectangle at t
<br />
Using <b>print()</b> on an object will output <b>null</b>, a memory location that may look like "@10be08," or the result of the <b>toString()</b> method from the object that's being printed. Advanced users who want more useful output when calling <b>print()</b> on their own classes can add a <b>toString()</b> method to the class that returns a String.<br />
<br />
Note that the console is relatively slow. It works well for occasional messages, but does not support high-speed, real-time output (such as at 60 frames per second).
Note that the console is relatively slow. It works well for occasional messages, but does not support high-speed, real-time output (such as at 60 frames per second). It should also be noted, that a print() within a for loop can sometimes lock up the program, and cause the sketch to freeze.
]]></description>

</root>
2 changes: 1 addition & 1 deletion content/api_en/println.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ The <b>println()</b> function writes to the console area, the black rectangle at
<br/>
Before Processing 2.1, <b>println()</b> was used to write array data to the console. Now, use <b>printArray()</b> to write array data to the console.<br />
<br />
Note that the console is relatively slow. It works well for occasional messages, but does not support high-speed, real-time output (such as at 60 frames per second).
Note that the console is relatively slow. It works well for occasional messages, but does not support high-speed, real-time output (such as at 60 frames per second). It should also be noted, that a println() within a for loop can sometimes lock up the program, and cause the sketch to freeze.
]]></description>

</root>
27 changes: 27 additions & 0 deletions content/examples/Basics/Math/Map/Map.pde
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/**
* Map()
*
* Using the map() function allows you to take any number,
* and scale it to a number that is more useful to the project
* that you are working on. Say you want to map mouse movement
* to the size or color (as seen above) of an object.
* In this example, we are taking the mouse’s x position (which can
* be between 0 and the width, 640) and we are scaling that to another
* range (40 to 300 for size, and 0 to 175 for color).
*
*/
void setup() {
size(640, 360);
noStroke();
}

void draw() {
background(0);
// mouseX has a min of 0 and a max of 640 (the width of the window)
// here we are scaling that variable from 0 to 640 to a number between 0 and 255
float c = map(mouseX, 0, width, 0, 175);
// here we are scaling that same variable to a range between 40 and 440
float d = map(mouseX, 0, width, 40, 300);
fill(255, c, 0);
ellipse(width/2, height/2, d, d);
}