mouseX和mouseY参数在处理吗?

时间:2018-09-22 11:55:07

标签: java mouseevent processing

大家好,我现在正在尝试获取一条贝塞尔曲线,以便在处理时使用mouseX和mouseY在画布上的特定参数中移动。我正在使用贝塞尔曲线作为嘴巴,并且希望用户用鼠标对其进行控制,使其看起来好像我正在绘制的脸是微笑,悲伤等。但是现在使用mouseX和Y可以在整个页面上移动。

这是我的素描的链接 http://www.openprocessing.org/sketch/594186

// face myFace;
// circle myCircles;

void setup() {
    background( 126, 192, 238 );
    // setting up the size of the canvas 
    //800 is the width and 400 is the height
    size( 800, 400 );
    // Draws all geometry with smooth (anti-aliased) edges instead of rough edges
    smooth();

    //Creating a face and circle object
    // myFace = new face();
    // myCircles = new circle();
}
void draw() {


  println(mouseX + " : " + pmouseX);
    println(mouseY + " : " + pmouseY);
  //translate(mouseX - 800/2,mouseY);
        background( 126, 192, 238 );
        // The four parameters are RGBA to fill the ellipse with color
        fill( 234, 192, 134 );
        //Here I've added no stroke around the ellipse
        noStroke();
        //H                E             A             D 
        //I've now used the ellipse arugment because, i've ented my own values.
        //First value is x axis, second is the y axis, the 3rd (width) and 4th(height) values 
        //are the size of the ellipse
        ellipse( 400, 200, 215, 305 );
        // E           Y               E              S
        //L EYE
        fill( 0, 0, 0 );
        //Here I've added no stroke around the ellipse
        noStroke();
        ellipse( 350, 180, 30, 20 );
        //R EYE
        fill( 0, 0, 0 );
        //Here I've added no stroke around the ellipse
        noStroke();
        ellipse( 450, 180, 30, 20 );
        //P               U                P              I            L             S
        //EYE BALL
        fill( 255, 255, 255 );
        noStroke();
        ellipse( 350, 178, 12, 12 );
        //EYE BALL
        fill( 255, 255, 255 );
        noStroke();
        ellipse( 450, 178, 12, 12 );
        noFill();
        stroke( 0 );

        bezier( 450, 305, mouseX, mouseY, mouseX, mouseY, 350, 305 );


        if (mouseY <= 200) {
    mouseY=300;
    // Upper-left
  } 
          if (mouseX <= 400) {
    mouseX=400;
    // Upper-left
  }   
}

0 个答案:

没有答案