当前位置:网站首页>Processing function translate (mousex, mousey) learning

Processing function translate (mousex, mousey) learning

2022-06-26 13:05:00 Harmony between man and nature Peng

void setup() {
  size(200, 200);
}

void draw() {
  background(255);
  rectMode(CENTER);
  ellipseMode(CENTER);
  
  // Draw everything relative to (mouseX, mouseY)
  translate(mouseX, mouseY);
  
  // Draw Zoog's body
  stroke(0);
  fill(175);
  rect(0, 0, 20, 100);

  // Draw Zoog's head
  stroke(0);
  fill(255);
  ellipse(0, -30, 60, 60);
  // Draw Zoog's eyes
  stroke(0);
  fill(0);
  ellipse(-19, -30, 16, 32);
  ellipse( 19, -30, 16, 32);

  // Draw Zoog's legs
  stroke(0);
  line(-10, 50, -20, 60);
  line( 10, 50, 20, 60);
}

 

原网站

版权声明
本文为[Harmony between man and nature Peng]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/177/202206261208316320.html