201707-20 hex()十六进制转换 Namehex()十六进制转换 Examplescolor c = #ffcc00; println(c); // Prints "-13312" println(hex(c)); // Prints "FFFFCC00" println(hex(c, 6)); // .... Read More >
201707-20 float()浮点转换 Namefloat()浮点转换 Examplesint i = 65; float f = float(i); println(i + " : " + f); // Prints "65 : 65.0"DescriptionConverts an int or String to its floating point representation. An int is easily conve.... Read More >
201707-20 char()字符转换 Namechar()字符转换 Examplesint i = 65; char c = char(i); println(i + " : " + c); // Prints "65 : A" byte b = 65; c = char(b); println(b + " : " + c); // Prints "65 : A"DescriptionConverts any value o.... Read More >
201707-20 byte()字节转换 Namebyte()字节转换 Exampleschar c = 'E'; byte b = byte(c); println(c + " : " + b); // Prints "E : 69" int i = 130; b = byte(i); println(i + " : " + b); // Prints "130 : -126"DescriptionConverts any v.... Read More >
201707-20 boolean()布尔转换 Nameboolean()布尔转换 ExamplesString s = "true"; boolean b = boolean(s); if (b) { println("The boolean is true"); } else { println("The boolean is false"); }DescriptionConverts an int or String to it.... Read More >
201707-20 binary()二进制转换 Namebinary()二进制转换 Examplescolor c = color(255, 204, 0); println(c); // Prints "-13312" println(binary(c)); // Prints "11111111111111111100110000000000" println(binary(c, 16)); // Prin.... Read More >
201707-20 XML XML对象 NameXML XML对象Examples// The following short XML file called "mammals.xml" is parsed // in the code below. It must be in the project's "data" folder. // // <?xml version="1.0"?> // <mammals&.... Read More >
201707-20 TableRow表格行对象 NameTableRow表格行对象ExamplesTable table; void setup() { table = new Table(); table.addColumn("number", Table.INT); table.addColumn("mass", Table.FLOAT); table.addColumn("name", Table.STRI.... Read More >
201707-20 % (modulo) 模数 名称:% (modulo) 例子: int a = 5 % 4; // Sets 'a' to 1 int b = 125 % 100; // Sets 'b' to 25 float c = 285.5 % 140.0; // Sets 'c' to 5.5 float d = 30.0 % 33.0; // S.... Read More >
201707-20 Table表格对象 NameTable表格对象ExamplesTable table; void setup() { table = new Table(); table.addColumn("id"); table.addColumn("species"); table.addColumn("name"); TableRow newRow = table.addRow().... Read More >
201707-20 StringList字符串列表类 NameStringList字符串列表类ExamplesStringList inventory; void setup() { size(200, 200); inventory = new StringList(); inventory.append("coffee"); inventory.append("flour"); inventory.append("tea".... Read More >
201707-19 PVector 向量 名称:PVector 例子: PVector v1, v2; void setup() { noLoop(); v1 = new PVector(40, 20); v2 = new PVector(25, 50); } void draw() { ellipse(v1.x, v1.y, 12, 12); ellipse(v2.x, v2.y,.... Read More >
201707-19 StringDict字符串字典类 NameStringDict字符串字典类ExamplesStringDict inventory; void setup() { size(200, 200); inventory = new StringDict(); inventory.set("coffee","black"); inventory.set("flour","white"); inventory.se.... Read More >
201707-19 String 字符串 NameString 字符串ExamplesString str1 = "CCCP"; char data[] = {'C', 'C', 'C', 'P'}; String str2 = new String(data); println(str1); // Prints "CCCP" to .... Read More >
201707-19 Object 对象 NameObject 对象 Examples// Declare and construct two objects (h1, h2) from the class HLine HLine h1 = new HLine(20, 2.0); HLine h2 = new HLine(50, 2.5); void setup() { size(200, 200); fram.... Read More >
201707-19 JSONObject JSON对象 NameJSONObject JSON对象ExamplesJSONObject json; void setup() { json = new JSONObject(); json.setInt("id", 0); json.setString("species", "Panthera leo"); json.setString("name", "Lion"); .... Read More >
201707-19 map() 映射 名称:map() 例子: size(200, 200); float value = 25; float m = map(value, 0, 100, 0, width); ellipse(m, 200, 10, 10); float value = 110; float m = map(value, 0, 100, -20, -1.... Read More >
201707-19 sqrt() 平方根 名称:sqrt() 例子: noStroke(); float a = sqrt(6561); // Sets 'a' to 81 float b = sqrt(625); // Sets 'b' to 25 float c = sqrt(1); .... Read More >