# Changing alignment on bang from cp5

**URL:** https://discourse.processing.org/t/changing-alignment-on-bang-from-cp5/3185
**Category:** Libraries
**Created:** [September 2, 2018, 2:52am UTC](https://discourse.processing.org/t/changing-alignment-on-bang-from-cp5/3185 "2018-09-02T02:52:24Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![kat](https://avatars.discourse-cdn.com/v4/letter/k/b19c9b/32.png) [@kat](https://discourse.processing.org/u/kat)
#### Post date: [September 2, 2018, 2:52am UTC](https://discourse.processing.org/t/changing-alignment-on-bang-from-cp5/3185/1 "2018-09-02T02:52:24Z")

</div>

Hi all,

I’m using a bang from the cp5 library as a button. Is there a way to make the given coordinates the center of the button, similar to the imageMode(CENTER) for images? I’ve looked through the cp5 library and I can’t find a method that does this.

Thanks!

---

<div class="post-metadata">

### Author: ![kfrajer](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kfrajer/32/196_2.png) [@kfrajer](https://discourse.processing.org/u/kfrajer)
#### Post date: [September 2, 2018, 4:30am UTC](https://discourse.processing.org/t/changing-alignment-on-bang-from-cp5/3185/2 "2018-09-02T04:30:43Z")

</div>

Not sure if it is possible as controlP5 is an external library and `imageMode` is a nice feature of Processing. You can always make a request in the controlP5 github but not sure how much support this library is receiving at the moment.

As a temporal solution, you could create a generic function where you can convert from corner-to-center OR center-to-corner. This transformations are generic and required three pieces of information: corner pos, center pos and length/dimension of the object. If you post a simple sketch, I could try to implement the idea, if you think that could help you with your sketches.

Kf

---

<div class="post-metadata">

### Author: ![kat](https://avatars.discourse-cdn.com/v4/letter/k/b19c9b/32.png) [@kat](https://discourse.processing.org/u/kat)
#### Post date: [September 2, 2018, 3:43pm UTC](https://discourse.processing.org/t/changing-alignment-on-bang-from-cp5/3185/3 "2018-09-02T15:43:49Z")

</div>

Okay I see. I figured out a way around it but thank you so much for offering!!

---

<div class="post-metadata">

### Author: ![jeremydouglass](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jeremydouglass/32/20_2.png) [@jeremydouglass](https://discourse.processing.org/u/jeremydouglass)
#### Post date: [September 3, 2018, 4:49pm UTC](https://discourse.processing.org/t/changing-alignment-on-bang-from-cp5/3185/4 "2018-09-03T16:49:56Z")

</div>

> [@kat](#):
>
> I figured out a way around it

Could I ask what it was that you figured out?

---

<div class="post-metadata">

### Author: ![kat](https://avatars.discourse-cdn.com/v4/letter/k/b19c9b/32.png) [@kat](https://discourse.processing.org/u/kat)
#### Post date: [September 3, 2018, 5:37pm UTC](https://discourse.processing.org/t/changing-alignment-on-bang-from-cp5/3185/5 "2018-09-03T17:37:32Z")

</div>

I didn’t actually find a way to make the coordinates the center. All I wanted to do was center the buttons so I just made the x position `width/2-(cp5.get(Bang.class, "Start").getWidth())/2` which is definitely not the best solution but it worked. Eventually I might make a function similar to the one @kfrajer suggested but for now, this will do.
