How to position box

The code below is from the example 's that spins a box in the centre of the screen. Can someone please tell me how i move the box to spin in a different part of the screen

Thankyou for your time

// GetTessGroups, by Andres Colubri
// The getTessellation() function in Processing 4 returns a group shape 
// where the first shape contains only the fill geometry, the second, 
// the stroke lines, and third, only the points (if any).

PShape box;
PShape tess;

boolean onlyStrokeLines = false;

void setup() {  
  size(600, 600, P3D);
  
  strokeWeight(1);
 
  
  box = createShape(BOX,100,3,40);

tess = box.getTessellation();
}

void draw() {
  background(180);
  lights();
  translate(width/2, height/2);
  rotateX(frameCount * 0.01);
  rotateY(frameCount * 0.01);
  for (int i = 0; i < tess.getChildCount(); i++) {    
    if (!onlyStrokeLines || i == 1) {
      shape(tess.getChild(i));
    }
  }
}

void keyPressed() {
  onlyStrokeLines = !onlyStrokeLines;
}

Hello,

You can be that somebody! :)

This translates it to the center of the screen:

translate(width/2, height/2);

Try this to see what the value of width and height is:
println(width, height);

Reference:

There are resources (tutorials, references and examples here:

:)

Brilliant thankyou as you can probably see i am new to processing

1 Like