text 随机放置旋转gloves.pde

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了text 随机放置旋转gloves.pde相关的知识,希望对你有一定的参考价值。

PImage img, img1, img2, img3, img4;  // Declare a variable of type PImage
int x = 0;
int y = 0;
int bigdistance = 2000;
int distance = 200;
int gridpoints = (bigdistance/distance);
int picheight = 400,picwidth = 400;
int glovenumber = 700;


void setup() {
  size(2000,2000);
 // background(255, 123, 41);
 background(0, 255, 226);
   //background(237, 26, 150);
  imageMode(CENTER);
  img1 = loadImage("one (1).png");
  img1.resize(picheight,picwidth);
  img2 = loadImage("one (2).png");
  img2.resize(picheight,picwidth);
  img3 = loadImage("one (3).png");
  img3.resize(picheight,picwidth);
  img4 = loadImage("one (4).png");
  img4.resize(picheight,picwidth);
  noLoop();
  
}

void draw() {
  
for (int j = 0; j < glovenumber; j++){

pushMatrix();

// Make a new instance of a PImage by loading an image file
int random = int(random(4));

x = int(random(2000));
y = int(random(2000));


if (random == 0){
  img =img1;
} else if (random == 1){
  img = img2;
} else if (random == 2){
img = img3;
} else if (random == 3){
img = img4;
} 

//translate(x+picheight/2,y+picwidth/2);
translate(x,y);
//translate(img.width/2, img.height/2);

//int twisty = int((random(360)));
rotate(radians(int(random(360))));

image(img,0,0);
 
//x += distance;
 
 popMatrix();
 

//if ((x % distance) == 0){
//x = (distance/2);
//} else {
//  x = 0;
//}
//y += distance;

    save("glovesrandom.png");
}
}

以上是关于text 随机放置旋转gloves.pde的主要内容,如果未能解决你的问题,请参考以下文章

旋转放置和移动视图 (UIView)

WPF TextBlock文本纵向排列

ios 9 UIPopoverPresentationController 在旋转时不断放置

在旋转滑块上方放置图像

在横向调整和放置旋转视图:更新约束或平移/更改框架?

旋转时,从 UITableViewCell 显示的 UIPopoverController 放置不正确