同学们把自己最近写的Processing代码贴到下面来吧!!

[已注销]

2010-07-28 23:20:59 来自: [已注销]

无论长短无论满意与否, 一起玩才带劲儿

8人 喜欢
  • 2010-07-28 23:39:33 [已注销]

    //jj o.1 by whaleforest

    size(400,300);
    line(50,100,100,100);
    line(75,100,75,200);
    line(75,200,60,200);

    line(250,100,300,100);
    line(275,100,275,200);
    line(275,200,260,200);

  • 闪光组组长

    2010-07-29 04:59:05 闪光组组长 (明日的闪光城市)

    float angle;
    float distance= 25;
    float focusX,focusY;
    float thirdBallRatio=2;
    PVector endPoints[] = new PVector[200];

    void setup() {
    size(96,64);
    smooth();
    for (int i=0; i<endPoints.length;i++){
    float d=0;
    int x=0,y=0;
    while (d<5*distance/6 || d>distance) {
    x = int(random(96));
    y =int(random(64));
    d =dist(width/2,height/2,x,y);
    }
    endPoints[i] = new PVector(x,y);

    }

    for (int i=0; i<endPoints.length;i++){
    print(int(endPoints[i].x)+",");
    }
    println();
    println();
    println();
    for (int i=0; i<endPoints.length;i++){
    print(int(endPoints[i].y)+",");
    }
    }

    void draw() {
    background(0);
    if(random(10)>9.6) {
    focusX= random(96);
    focusY = random(64);
    if(random(10)>9.5)thirdBallRatio = random(2.5,3);
    }
    noStroke();

    angle +=0.02;
    fill(250,210,30);


    ellipse(map(focusX,0, 96,40,56),map(focusY,0,64,26,34),distance*2,distance*2);
    stroke(180,140,10);
    strokeWeight(0.05);
    pushMatrix();
    translate(map(focusX,0, 96,40,56),map(focusY,0,64,26,34));
    for(int i=0; i<endPoints.length;i++) {
    line(0,0,endPoints[i].x-48,endPoints[i].y-32);
    }
    noStroke();
    popMatrix();

    fill(180,140,10);
    ellipse(map(focusX,0, 96,38,58),map(focusY,0,64,24,36),distance*1,distance*1);

    fill(40);
    ellipse(map(focusX,0, 96,36,64),map(focusY,0,64,22,38),distance/thirdBallRatio,distance/thirdBallRatio);
    }

  • MOG

    2010-07-29 15:38:37 MOG (let the hills rejoice)

    PFont Krungthep;
    PImage b;


    void setup() {
    size(screen.width, screen.height);
    smooth ();
    Krungthep = loadFont("Krungthep-30.vlw");
    textFont (Krungthep);
    textAlign (CENTER);
    textSize (280);
    b = loadImage("1269326221483.jpg");

    }

    void draw(){

    background(0);

    //filter(BLUR, second());
    fill (255);
    image(b, 0, 0);

    String s = str(hour());
    if (s.length()==1) s= "0" + s;
    String m = str(minute());
    if (m.length()==1) m= "0" + m;
    String se = str(second());
    if (se.length()==1) se= "0" + se;
    s= s + ":" + m + ":" + se;

    text(s,second()*20,height/2);


    }

  • 2010-07-29 23:22:24 [已注销]

    Krungthep-30.vlw找不到

  • MOG

    2010-07-29 23:28:00 MOG (let the hills rejoice)

    随便拉个字体呗

  • [已注销]

    2010-07-29 23:33:49 [已注销]

    还有个jpg咋办?

  • MOG

    2010-07-29 23:41:01 MOG (let the hills rejoice)

    随便拉个jpg呗,就是个时钟...

  • 夏小曹

    2010-07-30 00:06:14 夏小曹 (you never know)

    不如贴openprocessing帐号

  • [已注销]

    2010-07-30 00:14:17 [已注销]

    就是因为不喜欢那个才开这个贴的

  • 夏小曹

    2010-07-30 00:17:56 夏小曹 (you never know)

    那就当我没讲呗

  • [已注销]

    2010-07-30 00:22:03 [已注销]

    哦,是的,你没讲过

  • xucheng

    2010-07-30 16:40:11 xucheng (断尾獭)

    改了下


    float x=250, y=200,t=240,n=300,u=240,i=300;
    void setup()
    {
    size(500,500);
    }
    void draw()
    {
    smooth();
    background(x);
    float ax=random(-8,8);
    float ay=random(-9,9);
    float tx=random(-5,5);
    float ny=random(-5,5);
    float ux=random(-2,2);
    float iy=random(-1,1);
    x=x+ax;
    y=y+ay;
    t=t+tx;
    n=n+ny;
    u=u+ux;
    i=i+iy;
    if(x<0) {
    x=x+5;
    };
    if(y<0) {
    y=y+5;
    };
    if(t<0) {
    t=t+5;
    };
    if(n<0) {
    n=n+5;
    };
    if(u<0) {
    u=u+5;
    };
    if(i<0) {
    i=i+5;
    };
    if(x>500) {
    x=x-5;
    };
    if(y>500) {
    y=y-5;
    };
    if(t>500) {
    t=t-5;
    };
    if(n>500) {
    n=n-5;
    };
    if(u>500) {
    u=u-5;
    };
    if(i>500) {
    i=i-5;
    };
    line(x,y,t,n);
    line(u,i,t,n);
    ellipse(x,y,ny,ny);
    ellipse(t,n,ax,ax);
    ellipse(u,i,ay,ay);
    }

  • rk

    2010-09-15 11:39:40 rk

    import processing.serial.*;
    Serial myPort;
    float val = 0;
    int x = 0;
    PFont font;



    void setup(){
    size (800,600);
    String portName = Serial.list()[0];
    myPort = new Serial(this, portName, 9600);
    background(255);
    font = loadFont("CourierNew36.vlw");
    }


    void draw(){
    if (myPort.available() > 0){
    x = x + 1;
    val = myPort.read();
    print(val);
    stroke(153);
    line(x, 300, x, 300 - val);
    stroke(255);
    fill(255);
    rect(10, 360 , 100, 20);
    fill(0);
    textFont(font);
    textSize(14);
    text( val , 20 , 380 );
    }
    }

  • 2010-09-15 12:34:17 [已注销]

    有serial的!

  • rk

    2010-09-15 23:36:45 rk

    是给arduino陀螺仪的测试程序..

  • 2010-09-16 00:04:55 [已注销]

    尽量放自包含,可以直接运行的程序吧:)
    Stand Alone Complexity

  • 茜茜大魔王

    2011-02-28 17:07:03 茜茜大魔王 (再不分手,我们就都老了~)

    int counter;

    void setup() { //setup function called initially, only once
    size(250, 250);
    background(255); //set background white
    colorMode(HSB); //set colors to Hue, Saturation, Brightness mode
    counter = 0;
    }

    void draw() { //draw function loops
    counter++;
    noStroke();
    fill(random(255),100,255,50);

    if(mousePressed == true) { //add some interaction
    ellipse(mouseX, mouseY, 20, 20);
    }
    else {
    ellipse(width/2, height/2, 80*sin(counter), 80*sin(counter));
    }
    }

  • Golden Blue

    2011-03-01 01:15:37 Golden Blue

    //psychedelic cycling ball v0.3 by golden blue

    float theta=0,radius=0,diam_ball;
    float x,y;
    int color_ball;

    void setup(){
    colorMode(HSB);
    size(1000,1000);
    smooth();
    background(0);
    noStroke();
    }

    void draw(){
    diam_ball = 40*mouseX/width+40;
    //mouseX controls the diameter of the ball
    x = width/2+radius*sin(theta);
    y = height/2+radius*cos(theta);
    theta=theta + atan(diam_ball/radius);
    if (radius>diam_ball) {
    radius = radius + diam_ball*diam_ball/ (3*PI*radius);
    } else {
    radius = radius + 0.1*diam_ball;
    }
    if (radius>0.6*width) {
    radius=0;
    }
    color_ball = color_ball + 1 + mouseY*20/height;
    //mouseY controls the rate of color change
    fill(color_ball%360,255,255,70);
    ellipse(x,y,diam_ball,diam_ball);
    }
    -----------------------------
    偷了楼上的配色 : )

  • 来莱

    2011-03-08 22:09:06 来莱

    我也来贴一个 哈哈

    float x;
    float y;
    float yspeed = 0;
    float xspeed = 0;
    float balldiameter = 10; //Definition le ball de diameter
    float ballradius = balldiameter/2; //Definition le ball de diameter

    void setup(){
    size(300,300);
    background(255);
    fill(0);
    noStroke();
    }

    void draw(){
    mousemouvement();
    boundary();
    Ball();

    }
    void mousemouvement(){
    if(mousePressed==true){
    x=mouseX;
    y=mouseY;
    yspeed = mouseY-pmouseY;
    xspeed = mouseX-pmouseX;
    //ellipse(pmouseX,pmouseY,mouseX,mouseY);
    }
    }



    void boundary() {
    if (y >= height - ballradius) {
    y = height - ballradius;
    yspeed = -yspeed/1.5;
    }
    if (y <= ballradius) {
    y = ballradius;
    yspeed = -yspeed/1.35;
    }
    if (x >= width -ballradius) {
    x = width -ballradius;
    xspeed = -xspeed/1.10;
    }
    if (x <= ballradius) {
    x = ballradius;
    xspeed = -xspeed/1.10;
    }
    }

    void Ball() {
    if (balldiameter < 2) {
    balldiameter = 2;
    }
    if (balldiameter > 400) {
    balldiameter = 400;
    }
    ballradius = balldiameter/2;
    background(255);
    ellipse (x,y,10,10);
    yspeed = yspeed += 0.2;
    xspeed = xspeed/1.1;
    y = y + yspeed;
    x = x + xspeed;
    }

  • 餅乾怪丁

    2011-04-17 06:11:28 餅乾怪丁 (鸡蹄与荷花根。)

    初学者过来围观 哈哈 你们做的都好有趣啊 太迷幻了 噢耶!

  • coco•Pops

    2011-05-14 18:12:07 coco•Pops

    /*colourful ellipse with random position and tails, easy to attract attention
    in a open space. practise with the basic motion and noise function.*/
    int d=0;
    float angle = 0.0;
    float speed = 0.15;
    int counter =0;
    int i=0;
    int j=0;



    void setup() {
    size(600,200);
    smooth();
    noStroke();
    colorMode(1,200);
    }

    void draw() {
    //start the animation, using loop to set ellipse in pattern within space
    if(d<=100) {
    background(0,108,165);

    float c=random(5,100);
    //apply random colour to the fill and stroke, also apply shifting to ellipse
    for (int y = 0; y <= height; y += 100) {

    for (int x = 0; x <= width; x += 100) {

    stroke(random(200,255),random(255),0, 150);

    fill(random(x,y),random(d*2),0, 130);

    ellipse (x+(sin(angle + PI)*7),y,c,c);
    }
    }
    //a second for loop, so the group of ellipse will be draw on top of the previous one
    for (int y = 50; y <= height; y += 100) {

    for (int x = 50; x <= width; x += 100) {
    stroke(random(200,255),random(255),0, 150);

    fill(random(y,x),random(120,200),0, 130);

    ellipse (x+(sin(angle + HALF_PI)*7),y,c,c);
    }
    }

    d++;
    }
    else {
    //second part of the animation,random ellipse swim arround the screen with noise
    filter(BLUR,6);
    smooth();
    if(counter<250) {
    for(j=0;j<60;j++) {

    fill(n(10),random(20,100),0, 130);

    stroke(random(200,255),random(255),0, 150);

    ellipse(n(5)*2,n(15),n(40)/6,n(40)/6);
    }

    i++;
    counter++;
    }
    //restart the animation
    else {
    d=10;
    counter=0;
    }
    }
    }
    //assign n(int) function with return noise
    float n(int k) {

    return noise(j,k,i*0.008)*350-20;
    }

  • Jie

    2011-05-16 16:36:07 Jie (现在是不停地摇和不断的滚)

    //用最基本语法作画,画的我的招牌猪


    size(400,400); // 作出400*400画布

    colorMode(RGB,256);//指定RGB颜色模式
    background(#FCDB81);//指定背景色

    smooth();//圆滑曲线

    strokeWeight(2); //指定线的粗细


    beginShape(); // 开始指定图形
    vertex(120,50); //作出轮廓顶点
    vertex(90,110);
    vertex(90,320);
    vertex(310,320);
    vertex(310,110);
    vertex(280,50);
    vertex(250,110);
    vertex(150,110);
    endShape(CLOSE); // 结束指定图形,连接起始结束点

    beginShape(); // 开始指定图形
    vertex(120,60); //作出左耳左线段始末点
    vertex(96,110);
    endShape(); //结束指定图形

    line(120,60, // 直线命令作出左耳右线与右耳
    144,110);
    line(304,110,
    280,60);
    line(280,60,
    256,110);

    fill(#FF4A4A,180);//眼睛着色
    bezier(130,150, //作出左眼
    140,130,
    150,150,
    150,150);
    bezier(150,150,
    160,130,
    170,150,
    170,150);
    bezier(130,150,
    155,200,
    170,150,
    170,150);

    bezier(230,150, // 作出右眼
    240,130,
    250,150,
    250,150);
    bezier(250,150,
    260,130,
    270,150,
    270,150);
    bezier(230,150,
    255,200,
    270,150,
    270,150);

    noFill(); //终止着色
    fill(#F06E99,60);//鼻子着色
    bezier(90,222, //作出鼻子
    210,160,
    310,220,
    310,222);
    bezier(90,222,
    210,290,
    310,220,
    310,222);
    noFill();//终止着色
    fill(#FC81B2,160);//鼻孔着色

    ellipseMode(CENTER); // 作出鼻孔
    ellipse(150,220,26,26);
    ellipse(250,220,26,26);
    noFill();//终止着色

    beginShape(); //开始指定图形

    vertex(120,280); // 指定腿1轮廓顶点
    vertex(120,310);
    vertex(130,300);
    vertex(140,310);
    vertex(140,280);
    endShape(); // 指定结束
    line(120,300,140,300); // 作出横线1

    beginShape();
    vertex(150,280); // 指定腿2轮廓顶点
    vertex(150,310);
    vertex(160,300);
    vertex(170,310);
    vertex(170,280);
    endShape(); //指定结束
    line(150,300,170,300); // 作出横线2

    beginShape(); //开始指定图形
    vertex(270,260); //指定腿3轮廓顶点
    vertex(270,290);
    vertex(240,290);
    vertex(250,300);
    vertex(240,310);
    vertex(295,310);
    vertex(295,260);
    endShape(); //指定结束
    line(250,290,250,310); //作出竖线1

    fill(#FCDB81);//曲线涂色 同背景色
    bezier(310,310,//作出尾巴
    305,280,
    325,250,
    325,250);
    ellipseMode(CENTER);
    ellipse(333,252,15,15);
    bezier(328,244,
    330,190,
    400,160,
    400,160);

    bezier(150,105,165,80,180,105,180,105); //作出眉毛
    bezier(245,105,230,80,215,105,215,105);



  • Jie

    2011-05-16 22:16:10 Jie (现在是不停地摇和不断的滚)

    size(500,500);
    colorMode(RGB,100);
    background(99);
    noFill();
    smooth();

    int x=width/2;
    int y=height/2;
    println("x="+x+"/y="+y);

    for(int r=0;r<500;r++){
    strokeWeight(2);
    stroke(random(100),random(100),random(100));
    ellipse(x,y,r,r);
    strokeWeight(1);
    for(int l=0;l<50;l++){
    line(random(width),random(height),random(width),random(height));
    }
    }




  • 天天

    2011-06-17 21:12:58 天天 (梦想。努力)

    招牌猪很有爱啊。。

  • 秋涼如心

    2011-06-24 22:36:13 秋涼如心

    String st = "Polar: r = 200 * sin( 4 / 13 * θ)";
    int l = 500;
    PVector p0 = new PVector(l / 2, l / 2);
    float theta = 2*PI;
    color cl = #E61C64;
    int value;
    void setup(){
    smooth();
    size(l, l);
    background(255);
    fill(0, 102, 153);
    text(st, 25, l-25);
    line(0, l / 2, l, l / 2);
    line(l / 2, 0, l / 2, l);
    strokeWeight(2);
    }
    void draw(){
    float r = 200 * sin(theta / 13 * 4);
    PVector p = PVector.add(p0, new PVector(r * cos(theta), - r * sin(theta)));
    stroke(cl, 25);
    line(l / 2, l / 2, p.x, p.y);
    stroke(cl);
    point(p.x, p.y);
    theta *= (1 + 5 / (500 + abs(r * theta)));
    noStroke();
    fill(255);
    rect(l / 2 + 25, l-35, 100, 10);
    fill(0, 102, 153);
    text("θ = "+theta, l / 2 + 25, l-25);
    }
    void mousePressed(){
    if(value == 0){
    noLoop();
    value = 1;
    } else {
    loop();
    value = 0;
    }
    }

    很漂亮的一个函数。自学入门第三天~

  • ww

    2011-06-25 01:42:52 ww (算法拯救世界)

    ls三天就那么猛,牛!我也贴个,比较初级,不过自认为还满好看 *- -

    void setup() {
    size(700, 700);
    smooth();
    background(0);
    noLoop();
    }

    void draw() {
    translate(350, 350);
    for (int an=1; an<360;an++) {
    rotate(2*PI/an);
    fl();
    }
    }

    void fl() {
    noFill();
    beginShape();
    vertex(0, 0);
    int c1 = int(random(40, 250));
    int c2 = int(random(-10, 250));
    stroke(212, 212, 101, 100);
    bezierVertex(c2, c2, c1, c2, c1, c2);
    bezierVertex(c1, c2, c1, c2, c1, c2);
    endShape();
    fill(240, 240, 63, 200);
    noStroke();
    ellipse(c1, c2, 5, 5);
    }

  • 秋涼如心

    2011-06-25 10:20:25 秋涼如心

    float fro = -0.001;//空气阻力系数
    float grav = 0.1;//重力系数
    float c = - 0.95;//非弹性碰撞系数
    int sx = 300;//边界
    int sy = 300;
    float rad = 10;//球半径
    int deltacolo = 1;//球变色速度
    int colo = 0;//球初始颜色
    color bg = color(255);//背景颜色
    int n = 100; //轨迹数
    Ball b = new Ball(0, 500, 10, 10, 0, 0, colo);
    Ball[] trace = new Ball [n];
    void setup() {
    smooth();
    for (int i = 0; i < n; i += 1){
    trace[i] = b;
    }
    colorMode(HSB);
    size(sx, sy);
    noStroke();
    }
    class Ball {
    float x, y, vx, vy, ax, ay;
    int colo;
    Ball(float xx, float yy, float vvx, float vvy, float aax, float aay, int c) {//定义球
    x = xx;//位置
    y = yy;
    vx = vvx;//速度
    vy = vvy;
    ax = aax;//加速度
    ay = aay;
    colo = c;//颜色
    }
    void upd() {
    colo += deltacolo;//变色
    if (x < rad) {//撞墙
    vx *= c;
    x = rad;
    }
    if (x > sx - rad) {
    vx *= c;
    x = sx - rad;
    }
    if (y < rad) {
    vy *= c;
    y = rad;
    }
    if (y > sy - rad) {
    vy *= c;
    y = sy - rad;
    }
    ax = fro * vx;//空气阻力(加速度变化)
    ay = fro * vy;
    vx += ax;//速度变化
    vy += ay + grav;
    x += vx;//位置变化
    y += vy;
    }
    void drawb(float rad) {//画球
    fill(color(colo%360, 255, 255));
    ellipse(x, y, 2 * rad, 2 * rad);
    }
    }
    void draw() {
    background(bg);
    b.upd();//球移动
    b.drawb(rad);//画球
    for (int i = n - 1; i > 0; i -= 1){//画轨迹
    trace[i] = trace [i - 1];
    trace[i].drawb(rad * (n - i) / n);
    }
    trace[0] = b;
    if (mousePressed == true) {//鼠标拿起球
    b = new Ball ( mouseX, mouseY, 0, 0, 0, 0, b.colo);
    }
    }
    void mouseReleased() {//鼠标放下球
    b = new Ball ( mouseX, mouseY, mouseX - pmouseX, mouseY - pmouseY, 0, 0, b.colo);
    }


    再贴一个。不知道为什么只有鼠标抓住球的时候才画轨迹。

  • 秋涼如心

    2011-06-26 05:21:35 秋涼如心

    int mx = 500, my = 200;
    color bg = 255, cl2 = #F0F8FF;
    float coef_f = 0.01;//阻力係數
    float coef_ela = 0.1;//彈性係數
    int ii = 0;
    pt[] pts = new pt[mx];
    void setup(){
    colorMode(HSB);
    size(mx, my);
    background(bg);
    cons_pts();
    fill(0, 102, 153);
    }
    class pt{//定義單點
    float y, v, a;
    pt (float yy, float vv, float aa){
    y = yy;
    v = vv;
    a = aa;
    }
    void upd(){//單點變化
    a -= coef_f * v;
    v += a;
    y += v;
    }
    }

    void draw(){
    background(bg);
    text("wave simulation: right click to reset",25 ,35);
    upd_pts();
    draw_pts();
    ii += 1;
    if (mousePressed == true && (mouseButton == LEFT)){
    pts[constrain(mouseX, 1, mx - 2)].y = mouseY - my / 2;
    pts[constrain(mouseX, 1, mx - 2)].v = 0;
    pts[constrain(mouseX, 1, mx - 2)].a = 0;
    }
    if (mousePressed == true && (mouseButton == RIGHT)){cons_pts();}
    }

    void cons_pts(){//構造點集
    for (int i = 0; i < mx; i += 1){
    pts[i] = new pt( 0, 0, 0);
    }
    }
    void draw_pts(){//畫點集
    for (int i = 0; i < mx - 1; i += 1){
    //line(i, pts[i].y + l / 2, i + 1, pts[i + 1].y + l / 2);
    stroke(cl2);
    strokeWeight(1);
    line(i, pts[i].y + my / 2, i, mx);
    stroke((ii - i) % 360, 255, 255);
    strokeWeight(5);
    point(i, pts[i].y + my / 2);
    }
    }
    void upd_pts(){//點集變化
    for (int i = 1; i < mx - 1; i += 1){//左右點給中間的點拉力
    pts[i].a = coef_ela * (pts[i - 1].y + pts[i + 1].y - 2 * pts[i].y);
    }
    for (int i = 1; i < mx - 1; i += 1){
    pts[i].upd();
    }
    }

  • Vicki

    2011-07-15 22:51:37 Vicki

    哇···你们做的好棒哦~

  • 广美互动媒体

    2011-07-16 09:40:54 广美互动媒体 (Interactive Media Lab of GAFA)

    float a = 0.0; //设定变量a为角度

    void setup() {
    size(300,300);
    smooth();
    background(255);
    colorMode(HSB,360,100,100);
    }

    void draw() {
    fill(0,0,100,3);
    rect(0,0,300,300);
    a += 0.1; //递增角度值
    translate(mouseX,mouseY); // 将原点位移到鼠标坐标
    rotate(a);
    fill(random(360),100,100);
    line(-50,0,50,0);
    ellipse(-50,0,10,10);
    ellipse(50,0,10,10);
    }

  • 123456

    2011-08-12 23:11:14 123456

    都很有意思!

  • [已注销]

    2011-10-16 14:29:41 [已注销]

    有没有做视觉可视化的代码 分享一下吧

  • 亖丄丿冫

    2011-10-18 22:27:31 亖丄丿冫

    void setup()
    {
    //println("Song JingTao");
    //setting the windows size;
    size(800,600);
    smooth();
    background(240);
    }
    void draw()
    {
    stroke(230);
    fill(230);
    beginShape();
    vertex(335.855,234.486);
    vertex(307.696,234.486);
    vertex(196.516,345.667);
    vertex(196.516,367.901);
    vertex(231.886,419.687);
    vertex(296.578,423.49);
    vertex(318.813,423.491);
    vertex(381.822,418.403);
    vertex(432.099,373.563);
    vertex(426.15,335.881);
    endShape(CLOSE);

    fill(230);
    stroke(0);
    bezier(212.217,288.684,216.217,33.856,189.088,77.777,197.582,330.226);
    bezier(307.696,234.486,246.293,234.486,196.516,284.263,196.516,345.667);
    bezier(196.516,367.901,196.516,390.8,210.557,411.354,231.886,419.687);
    bezier(381.822,418.403,403.812,410.628,421.868,394.524,432.099,373.563);

    line(335.855,234.486,307.696,234.486);
    line(196.516,345.667,196.516,367.901);
    line(296.578,423.49,318.813,423.491);

    fill(190);
    ellipse(263.224,423.492,66.708,22.236);
    bezier(394.163,412.95,423.5,412.95,433.5,434.61,368.12,433.26);
    ellipse(352.168,423.492,66.708,22.236);
    strokeWeight(3);
    line(274.669,424.333,274.669,432.555);
    line(279.669,424.333,279.669,431.555);
    line(284.669,424.333,284.669,430.555);

    line(363.877,424.333,363.877,432.555);
    line(368.877,424.333,368.877,431.555);
    line(373.877,424.333,373.877,430.555);

    //qiu
    ellipse(632.323,397.9,104.224,104.224);

    fill(0);
    bezier(333.491,241.481,334.127,292.679,374.973,334.294,426.15,335.886);
    bezier(333.491,241.481,334.413,235.288,338.412,230.226,344.607,230.226);
    beginShape();
    vertex(426.15,335.886);
    vertex(442,331);
    vertex(344.607,230.226);
    vertex(333.491,241.481);
    endShape();

    fill(255,200,93);
    beginShape();
    vertex(471.297,143.734);
    vertex(502.75,125.25);
    vertex(507.821,165.916);
    endShape();
    fill(230);
    ellipse(441.112,234.486,191.325,191.327);

    fill(255,200,93);
    beginShape();
    vertex(381.143,115.472);
    vertex(403.227,168.545);
    vertex(418.256,147.288);
    endShape(CLOSE);

    fill(255);
    beginShape();
    vertex(374.821,165.295);
    vertex(381.143,115.472);
    vertex(403.227,168.545);
    endShape();
    ellipse(441.113,223.368,47.649,8.306);
    ellipse(507.819,223.368,47.649,8.306);

    fill(255,200,93);
    arc(464.5,246.089,65.281,65.281,radians(30),radians(105));
    arc(507.5,246.089,65.281,65.281,radians(80),radians(150));

    fill(0);
    /*beginShape();
    bezier(487.024,254.927,500.5,254.927,499.971,258.698,498.625,262.695);
    bezier(488,270,494,270,498,266,498.625,262.695);
    endShape(CLOSE);*/
    ellipse(487,262.695,20,15);
    //yanjing
    ellipse(445.757,223.368,11.909,8.306);
    ellipse(510.937,223.368,11.909,8.306);

    //meimao
    ellipse(441.113,206.166,12.722,5.02);
    ellipse(510.937,206.166,12.722,5.02);

    line(412,258.496,465.5,262.695);
    line(419,282.305,462,270);
    line(549,250,504,261);
    line(508.5,267.5,556,271);

    //lingdang
    fill(255,200,93);
    ellipse(441.113,352.833,45.214,45.214);
    fill(250,170,120);
    ellipse(441.113,352.833,51.226,5);

    fill(0);
    beginShape();
    vertex(444,375);
    vertex(444,360);
    vertex(450,360);
    vertex(450,373);
    endShape();
    }

  • 亖丄丿冫

    2011-10-18 22:36:34 亖丄丿冫

    float x;
    float y;
    float px;
    float py;
    float easing=0.05;


    void setup()
    {

    size(800,600);
    smooth();
    }


    void draw(){
    float targetX=mouseX;
    x+=(targetX-px)*easing;
    float targetY=mouseY;
    y+=(targetY-py)*easing;

    float weight=dist(x,y,px,py);
    strokeWeight(weight*2);
    stroke(random(255),random(255),random(255));
    line(x,y,px,py);

    py=y;
    px=x;
    }

  • 石药药

    2011-10-21 02:47:56 石药药

    都是牛人啊。。。。。。。

  • ww

    2011-10-21 10:53:25 ww (算法拯救世界)

    ls 画猫那位。。。你的代码中不需要 setup() 也不需要 draw()

  • moon

    2011-11-02 20:08:30 moon

    上学的时候就试着写这个,但是但是思维不对,这两天重新拾起来玩,昨天晚上刚写的,贼新鲜

    float ox1 = 110;
    float oy1 = height/2;
    float ox2 = 190;
    float oy2 = height/2;
    void setup(){
    size(300,300);
    smooth();
    noStroke();


    }
    void draw(){
    background(120);
    float r1 = dist(mouseX,mouseY,width/2-40,height/2);
    float si1 = (mouseX-(width/2-40))/r1;
    float co1 = (mouseY-height/2)/r1;
    float r2 = dist(mouseX,mouseY,width/2+40,height/2);
    float si2 = (mouseX-(width/2+40))/r2;
    float co2 = (mouseY-height/2)/r2;
    if(abs(r1)<20){
    ox1 = mouseX;
    oy1 = mouseY;
    }else{
    ox1 = width/2+20*si1-40;
    oy1 = height/2+20*co1;
    }
    if(abs(r2)<20){
    ox2 = mouseX;
    oy2 = mouseY;
    }else{
    ox2 = width/2+20*si2+40;
    oy2 = height/2+20*co2;
    }
    fill(255);
    ellipse(width/2-40,height/2,60,60);
    ellipse(width/2+40,height/2,60,60);
    fill(0);
    ellipse(ox1,oy1,20,20);
    ellipse(ox2,oy2,20,20);
    }

  • Virtue

    2011-11-05 22:12:46 Virtue (←→←→←→←→)

    拜过各位神。。。

  • lzwduo

    2011-11-07 13:09:54 lzwduo

    厉害~

  • 侯国涛

    2011-11-18 13:43:42 侯国涛

    //突然发现自己很菜啊,不过这才是第二天,见谅啊。我的还是蛮好玩的。
    float[]x=new float[10];
    float[]y=new float[10];
    float[]t=new float[10]; int s=-1;
    void setup(){size(600,600);smooth();background(0);
    for(int i=0;i<x.length;i+=1){
    x[i]=random(600); y[i]=random(600);t[i]=100;}
    }
    void draw(){
    fill(0,30); rect(0,0,600,600);
    for(int i=0;i<x.length;i+=1){
    circle(x[i],y[i],t[i]);
    t[i]+=s ;if(t[i]<0||t[i]>100){s=-s;}
    if( mousePressed){x[i]=mouseX+random(-50,50);y[i]=mouseY+random(-50,50);}
    }}
    void circle(float x,float y,float t){
    pushMatrix();
    translate(x,y);
    fill(random(255),random(255),random(255),t);noStroke();
    ellipse(random(10),random(10),100,100);
    popMatrix();}

  • 十七茶

    2012-02-12 11:37:47 十七茶

    有没有声音有关的可视化图形代码?

  • 2012-03-25 21:31:45 wanyue123

    有没有那个弹钢琴的代码啊

  • 2012-03-25 21:32:21 wanyue123

    就是用键盘可以弹钢琴的

  • 西北偏北

    2012-04-06 02:38:14 西北偏北 (下过雨的夏天傍晚喝酒吃烧烤!!)

    void setup () {
    size(500, 500);
    background (0);
    }

    void draw () {
    int x = 120;
    int y = 380;
    stroke(0);
    while (x<500) {
    fill(x, 0, 100);
    ellipse (x, y, 50, 50);
    x = x + 50;
    y = y - 50;
    }

    int w =250 ;
    int h=250 ;
    while (w>0) {
    int r=0 ;
    int g= 0;
    int b= 0;
    fill(w%255, w%255, 0);
    stroke(255, 0, 0);
    ellipse(0, height, w, h);
    w =w-20 ;
    h =h-20 ;
    }
    }

    I took a computer class this semester and we learn processing!
    I feel it is soooooooooooooooooooooooooo hard!!!!!!
    Now there comes the final project! We have to use what we have learned this semester and it should be excel, creative!
    I have to write 1000 words for my proposal due next Tuesday.
    I totally have no idea!!!!!!!!!!1
    HELP!!!!!!!
    THX!!!!!1


这个小组的成员也喜欢去  · · · · · ·

Arduino
Arduino (2257)
互动小分队 -  Workshop
互动小分队 - Workshop (850)
伦敦数码艺术组织
伦敦数码艺术组织 (620)
Visualizing Data
Visualizing Data (439)
北京互动小分队儿
北京互动小分队儿 (380)
男女青年交互学会
男女青年交互学会 (375)