Scratch for Java

Diese Seite ist noch nicht übersetzt. Sie wird in ihrer Originalsprache angezeigt.

Operators::map()

Re-maps a number from one range to another.

In the first example above, the number 25 is converted from a value in the range of 0 to 100 into a value that ranges from the left edge of the window (0) to the right edge (width).

As shown in the second example, numbers outside the range are not clamped to the minimum and maximum parameters values, because out-of-range values are often intentional and useful.

Examples

View on GitHub

Syntax

Java

.map(value, start1, stop1, start2, stop2)

Parameters

Name Data Type Description
value double the incoming value to be converted
start1 double lower bound of the value's current range
stop1 double upper bound of the value's current range
start2 double lower bound of the value's target range
stop2 double upper bound of the value's target range

Return

double

map()

Teilbare URL erstellen

Abschnitte auswählen