# How to position box

**URL:** https://discourse.processing.org/t/how-to-position-box/41154
**Category:** Beginners
**Created:** [March 5, 2023, 5:39pm UTC](https://discourse.processing.org/t/how-to-position-box/41154 "2023-03-05T17:39:28Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Dave](https://avatars.discourse-cdn.com/v4/letter/d/ee7513/32.png) [@Dave](https://discourse.processing.org/u/Dave)
#### Post date: [March 5, 2023, 5:39pm UTC](https://discourse.processing.org/t/how-to-position-box/41154/1 "2023-03-05T17:39:28Z")

</div>

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

```auto
// 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;
}

```

---

<div class="post-metadata">

### Author: ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)
#### Post date: [March 5, 2023, 6:20pm UTC](https://discourse.processing.org/t/how-to-position-box/41154/2 "2023-03-05T18:20:36Z")

</div>

> [@Dave](#):
>
> Can someone please tell me how i move the box to spin in a different part of the screen

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:

> **[translate() / Reference](https://processing.org/reference/translate_.html)**
>
> Specifies an amount to displace objects within the display window. The x parameter specifies left/right translation, the y parameter specifies up/down translation, and the z param…

There are resources (tutorials, references and examples here:

> **[Welcome to Processing!](https://processing.org/)**
>
> Processing is a flexible software sketchbook and a language for learning how to code. Since 2001, Processing has promoted software literacy within the visual arts and visual literacy within technology…

`:)`

---

<div class="post-metadata">

### Author: ![Dave](https://avatars.discourse-cdn.com/v4/letter/d/ee7513/32.png) [@Dave](https://discourse.processing.org/u/Dave)
#### Post date: [March 7, 2023, 9:35am UTC](https://discourse.processing.org/t/how-to-position-box/41154/3 "2023-03-07T09:35:27Z")

</div>

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