201707-12 createShape()创建形状函数 createShape() Name 名称 createShape() 创建形状函数 Examples 例子 PShape square; // The PShape object void setup() { .... Read More >
201707-12 tan() 正切 名称:tan() 例子: float a = 0.0; float inc = TWO_PI/50.0; for (int i = 0; i < 100; i = i+2) { line(i, 50, i, 50+tan(a)*2.0); a.... Read More >
201707-12 sin() 正弦 名称:sin() 例子: float a = 0.0; float inc = TWO_PI/25.0; for (int i = 0; i < 100; i=i+4) { line(i, 50, i, 50+sin(a)*40.0); a .... Read More >
201707-12 radians() 名称:radians() 例子: float deg = 45.0; float rad = radians(deg); println(deg + " degrees is " + rad + " radians"); 描述: 将度量度值转换为其对应的弧度值。弧度和度数是测量同一事物的两种方式。 一个.... Read More >
201707-12 degrees() 名称:degrees() 例子: float rad = PI/4; float deg = degrees(rad); println(rad + " radians is " + deg + " degrees"); 描述: 将弧度测量值转换为相应的度数值。弧度和度数是测量同一事物的两种方式。 一个圆圈有360度,有2 * P.... Read More >
201707-12 cos() 余弦 名称:cos() 例子: float a = 0.0; float inc = TWO_PI/25.0; for (int i = 0; i < 25; i++) { line(i*4, 50, i*4, 50+cos(a)*40.0); a =.... Read More >
201707-12 atan2() 名称:atan2() 例子: void draw() { background(204); translate(width/2, height/2); float a = atan2(mouseY-height/2, mouseX-width/2); rotate(a); rect(-30, -5, 60, 10); } 描述:.... Read More >
201707-11 atan() 反正切 名称:atan() 例子: float a = PI/3; float t = tan(a); float at = atan(t); // Prints "1.0471976 : 1.7320509 : 1.0471976" println(a + " : " + t + " : " + at); float.... Read More >
201707-11 asin() 反正弦 名称:asin() 例子: float a = PI/3; float s = sin(a); float as = asin(s); // Prints "1.0471976 : 0.86602545 : 1.0471976" println(a + " : " + s + " : " + as); float a = PI +.... Read More >
201707-11 acos() 反余弦 名称:acos() 描述: 反cos(),返回一个值的反余弦值。 此函数期望值范围为-1到1,值返回到范围0到PI(3.1415927)。 语法: acos(value) 参数: value float: the value whose arc cosine is to be returned .... Read More >
201707-10 randomSeed() 名称:randomSeed() 例子: randomSeed(0); for (int i=0; i < 100; i++) { float r = random(0, 255); stroke(r); line(i, 0, i, 100); } 描述: 设置random()的种子值。 默认情况下,每次运行程序时ran.... Read More >
201707-10 randomGaussian() 名称:randomGaussian() 例子: for (int y = 0; y < 100; y++) { float x = randomGaussian() * 15; line(50, y, 50 + x, y); } fl.... Read More >
201707-10 random() 随机 名称:random() 例子: for (int i = 0; i < 100; i++) { float r = random(50); stroke(r*5); line(50, i, 50+r, i); } for (int i = 0; i < 100; i++) { flo.... Read More >
201707-10 noiseSeed() 名称:noiseSeed() 例子: float xoff = 0.0; void setup() { noiseSeed(0); stroke(0, 10); } void draw() { xoff = xoff + .01; float n = noise(xoff) * width; line(n, 0, n, height); }.... Read More >
201707-09 noiseDetail() 名称:noiseDetail() 例子: float noiseVal; float noiseScale=0.02; void draw() { for (int y = 0; y < height; y++) { for (int x = 0; x < width/2; x++) { noiseDetail(3,0.5); noise.... Read More >
201707-09 noise() 噪音 名称:noise() 例子: float xoff = 0.0; void draw() { background(204); xoff = xoff + .01; float n = noise(xoff) * width; line(n, 0, n, height); } float noiseScale.... Read More >
201707-09 pixelDensity() 像素密度() 名称:pixelDensity() 例子: size(100, 100); pixelDensity(2); noStroke(); background(0); ellipse(30, 48, 36, 36); ellipse(70, 48, 36, 36); void setup() { size(100, 100); .... Read More >
201707-09 PShader 着色器 名称:PShader 例子: PShader blur; void setup() { size(640, 360, P2D); // Shaders files must be in the "data" folder to load correctly blur = loadShader("blur.glsl"); stroke(0, 102, 1.... Read More >