旋转个人形状

时间:2015-07-14 15:23:54

标签: rotation processing

我目前正致力于复制Processing中的一件艺术品。但是我遇到了旋转功能的问题。

因此可以找到here的图像。您可以在下面看到我的代码来自Processing。我们可以看到不同的部分是椭圆的旋转。

我试过改变原点,例如:

translate(midpoint - (position*tenth + layer*tenth/2.0), i*tenth + layer*tenth/2.0,)

然后在(0,0)旋转并创建形状,但不做我想要的!

任何想法都将不胜感激

这会将原点更改为我希望绘制椭圆的x, y位置。

void setup(){
  size(550,550);
  background(187,182,179);

  midpoint = height/2.0;
  tenth = height/10.0;
  circle_radius = 20.0;
}

float circle_radius = 15.0;
float midpoint;
float tenth;
float base_colour = 0;

float getColour(float x_value){
  float colour_val = ((x_value - 50.0)*255.0)/(450.0-50.0);

  if(floor(colour_val/255.0)%2 == 0){
    return colour_val%255.0;
  }
  return 225.0 - (colour_val%255.0);
}

void draw(){
  noStroke();
  background(187,182,179);
  base_colour += 5.0;
  for(int layer = 0; layer < 2; layer++){
    for(int i = 1; i < 12; i++){
      for (int position = 0; position < 5 - layer; position+=1){
         if(i*tenth > tenth && i*tenth + layer*tenth/2.0 < height - tenth){

           fill(getColour(base_colour + midpoint - position*tenth - layer*tenth/2.0 - (i*tenth - layer*tenth/2.0)));
           //rotate(PI/12.0);
           ellipse(midpoint - (position*tenth + layer*tenth/2.0), i*tenth + layer*tenth/2.0,  2.0*circle_radius/3.0, circle_radius);

           fill(getColour(base_colour + midpoint + position*tenth + layer*tenth/2.0 - (i*tenth - layer*tenth/2.0)));
          // rotate(PI/);
           ellipse(midpoint + position*tenth + layer*tenth/2.0, i*tenth + layer*tenth/2.0, 2.0*circle_radius/3.0, circle_radius);
         }  
      }
    }
 }
}

0 个答案:

没有答案
相关问题