201707-19 sq() 平方 名称:sq() 例子: noStroke(); float a = sq(1); // Sets 'a' to 1 float b = sq(-5); // Sets 'b' to 25 float c = sq(9); // Sets 'c'.... Read More >
201707-18 round() 四舍五入 名称:round() 例子: float x = 9.2; int rx = round(x); // Sets 'rx' to 9 float y = 9.5; int ry = round(y); // Sets 'ry' to 10 float z = 9.9; int rz = round(z); // Sets .... Read More >
201707-18 pow() 指数 名称:pow() 例子: float a = pow( 1, 3); // Sets 'a' to 1*1*1 = 1 float b = pow( 3, 5); // Sets 'b' to 3*3*3*3*3 = 243 float c = pow( 3,-5); // Sets 'c' to 1 / 3*3*3*3*3 = 1 /.... Read More >
201707-18 norm() 标准化 名称:norm() 例子: float value = 20; float n = norm(value, 0, 50); println(n); // Prints "0.4" float value = -10; float n = norm(value, 0, 100); println(n); // Prints "-0.... Read More >
201707-18 min() 最小值 名称:min() 例子: int d = min(5, 9); // Sets 'd' to 5 int e = min(-4, -12); // Sets 'e' to -12 float f = min(12.3, 230.24); // Sets 'f' to 12.3 int[] valu.... Read More >
201707-18 max() 最大值 名称:max() 例子: int a = max(5, 9); // Sets 'a' to 9 int b = max(-4, -12); // Sets 'b' to -4 float c = max(12.3, 230.24); // Sets 'c' to 230.24 int[] val.... Read More >
201707-18 mag() 向量大小 名称:mag() 例子: float x1 = 20; float x2 = 80; float y1 = 30; float y2 = 70; line(0, 0, x1, y1); println(mag(x1, y1)); // Prin.... Read More >
201707-18 log() 自然对数 名称:log() 例子: void setup() { int i = 12; println(log(i)); println(log10(i)); } // Calculates the base-10 logarithm of a number float log10 (int x) { return (log(x) / log(10)); .... Read More >
201707-18 lerp() 名称:lerp() 例子: float a = 20; float b = 80; float c = lerp(a, b, .2); float d = lerp(a, b, .5); float e = lerp(a, b, .8); begin.... Read More >
201707-17 JSONArray JSON数组 NameJSONArray JSON数组ExamplesString[] species = { "Capra hircus", "Panthera pardus", "Equus zebra" }; String[] names = { "Goat", "Leopard", "Zebra" }; JSONArray values; void setup() { values.... Read More >
201707-17 IntList整数型列表类 Name IntList整数型列表类 Examples IntList inventory; void setup() { size(200, 200); inventory = new IntList(); inventory.append(84); inventory.append(15); .... Read More >
201707-17 IntDict整数型字典类 NameIntDict整数型字典类ExamplesIntDict inventory; void setup() { size(200, 200); inventory = new IntDict(); inventory.set("cd", 84); inventory.set("tapes", 15); inventory.set("records", 102); .... Read More >
201707-17 HashMap散列映射 NameHashMap散列映射Examplesimport java.util.Map; // Note the HashMap's "key" is a String and "value" is an Integer HashMap<String,Integer> hm = new HashMap<String,Integer>(); // Putting ke.... Read More >
201707-17 FloatList浮点型列表类 NameFloatList浮点型列表类ExamplesFloatList inventory; void setup() { size(200, 200); inventory = new FloatList(); inventory.append(108.6); inventory.append(5.8); inventory.append(8.2); println.... Read More >
201707-17 FloatDict浮点型字典类 Name FloatDict浮点型字典类 Examples FloatDict inventory; void setup() { size(200, 200); inventory = new FloatDict(); inventory.set("coffee",108.6); inventory.se.... Read More >
201707-15 double双精度浮点型 Namedouble双精度浮点型 Examplesdouble a; // Declare variable 'a' of type float a = 1.5387; // Assign 'a' the value 1.5387 double b = -2.984; // Declare variable 'b' and assign it the .... Read More >
201707-15 color颜色 Namecolor颜色 Examples color c1 = color(204, 153, 0); color c2 = #FFCC00; noStroke(); fill(c1); rect(0, 0, 25, 100); fill(c2); rect(25, 0, 25, 1.... Read More >
201707-15 char字符 Name Char字符 Examples char m; // Declare variable 'm' of type char m = 'A'; // Assign 'm' the value "A" int n = '&'; // Declare variable 'n' and assign it the val.... Read More >