# Align for TextLabel in Processing

**URL:** <https://discourse.processing.org/t/align-for-textlabel-in-processing/9079>\
**Category:** Libraries\
**Created:** [March 7, 2019, 2:47pm UTC](https://discourse.processing.org/t/align-for-textlabel-in-processing/9079 "2019-03-07T14:47:11Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![padmakn](https://avatars.discourse-cdn.com/v4/letter/p/ce73a5/32.png) [@padmakn](https://discourse.processing.org/u/padmakn)\
**Post date:** [March 7, 2019, 2:47pm UTC](https://discourse.processing.org/t/align-for-textlabel-in-processing/9079/1 "2019-03-07T14:47:11Z")

</div>

Hi,

Can you please tell me how to use the .align(int, int , int, int) for textlabel in processing?

Regards,  
Padma

---

<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:** [March 10, 2019, 5:45pm UTC](https://discourse.processing.org/t/align-for-textlabel-in-processing/9079/2 "2019-03-10T17:45:37Z")

</div>

Hi Padma –

textlabel is not a part of Processing – it is a part of the Processing library ControlP5.

[http://sojamo.de/libraries/controlP5/reference/controlP5/Textlabel.html](http://sojamo.de/libraries/controlP5/reference/controlP5/Textlabel.html)

The example sketch is:

PDE \> File \> Examples \> Contributed Libraries \> ControlP5 \> controllers \> ControlP5textlabel

`.align()` is an inherited property of any Controller – it has an xy for the Caption and another for the Value:

[http://sojamo.de/libraries/controlP5/reference/controlP5/Controller.html#align-int-int-int-int-](http://sojamo.de/libraries/controlP5/reference/controlP5/Controller.html#align-int-int-int-int-)

I’m not sure this will do anything with a TextLabel.

**What are you trying to do?**

---

<div class="post-metadata">

**Author:** ![padmakn](https://avatars.discourse-cdn.com/v4/letter/p/ce73a5/32.png) [@padmakn](https://discourse.processing.org/u/padmakn)\
**Post date:** [March 11, 2019, 12:10pm UTC](https://discourse.processing.org/t/align-for-textlabel-in-processing/9079/3 "2019-03-11T12:10:23Z")

</div>

I understand that now. I was just making textlabels and trying to aligning them in boxes.

Thank you,

Padma

---

<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:** [March 11, 2019, 4:02pm UTC](https://discourse.processing.org/t/align-for-textlabel-in-processing/9079/4 "2019-03-11T16:02:40Z")

</div>

I remember seeing this question long before – I don’t think align works on TextLabel in this way: [Text Alignment in ControlP5 button - Processing 2.x and 3.x Forum](https://forum.processing.org/two/discussion/10129/text-alignment-in-controlp5-button)

See also the idea of a callback workaround here: [Reddit - Dive into anything](https://www.reddit.com/r/processing/comments/9wbfb0/is_there_no_alignment_function_for_controlp5/)

For the label could you display it with a simple `text()`, so that you can use `textAlign()`?

Another discussion of using align on matrix vs scrollablelist:

> [@Problem with ControlP5, Scrollablelist and align method](https://discourse.processing.org/t/problem-with-controlp5-scrollablelist-and-align-method/1808):
>
> Hi everyone, I have trouble aligning text in a scrollable list in the ControlP5 library. Here is an example : import controlP5.\*; import java.util.\*; ControlP5 cp5; void setup() { size(400, 400); cp5 = new ControlP5(this); List l = Arrays.asList("a", "b", "c", "d", "e", "f", "g", "h"); cp5.addScrollableList("dropdown") .setPosition(100, 100) .setSize(200, 100) .setBarHeight(20) .setItemHeight(20) .addItems(l); cp5.getController("dropdown").getCaptio…

---

<div class="post-metadata">

**Author:** ![padmakn](https://avatars.discourse-cdn.com/v4/letter/p/ce73a5/32.png) [@padmakn](https://discourse.processing.org/u/padmakn)\
**Post date:** [March 13, 2019, 9:55am UTC](https://discourse.processing.org/t/align-for-textlabel-in-processing/9079/5 "2019-03-13T09:55:36Z")

</div>

Hi,

Do you know how tracers work? Any documentation available?

Regards,

Padma

---

<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:** [March 13, 2019, 3:19pm UTC](https://discourse.processing.org/t/align-for-textlabel-in-processing/9079/6 "2019-03-13T15:19:19Z")

</div>

By tracers, do you mean like this ?

> **[jmorrow1/tracer](https://github.com/jmorrow1/tracer)**
>
> A Processing library for creating generative art and animations by tracing paths - jmorrow1/tracer

---

<div class="post-metadata">

**Author:** ![padmakn](https://avatars.discourse-cdn.com/v4/letter/p/ce73a5/32.png) [@padmakn](https://discourse.processing.org/u/padmakn)\
**Post date:** [March 13, 2019, 6:18pm UTC](https://discourse.processing.org/t/align-for-textlabel-in-processing/9079/7 "2019-03-13T18:18:33Z")

</div>

Yes!

Regards,

Padma

---

<div class="post-metadata">

**Author:** ![padmakn](https://avatars.discourse-cdn.com/v4/letter/p/ce73a5/32.png) [@padmakn](https://discourse.processing.org/u/padmakn)\
**Post date:** [March 13, 2019, 7:54pm UTC](https://discourse.processing.org/t/align-for-textlabel-in-processing/9079/8 "2019-03-13T19:54:05Z")

</div>

Hi,

**Can we add a texture to a ellipse in the drawtracer method.** This is from the tracer example "custom\_path\_demo\_1 of tracer library. i am using a ellipse instead of a point.

**void drawTracer(Tracer t) {**

**img = loadImage(“image1.jpg”);**

**texture(img);**

**ellipse(t.x, t.y, 10, 40);**

**}**

Sincerely,

Padma

---

<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:** [March 13, 2019, 8:49pm UTC](https://discourse.processing.org/t/align-for-textlabel-in-processing/9079/9 "2019-03-13T20:49:03Z")

</div>

Texture does not apply to primitive render methods like `ellipse()` or `rect()`.

[https://processing.org/reference/texture\_.html](https://processing.org/reference/texture_.html)

It works on PShape, and you can use it inline with beginShape / endShape if you don’t want to declare a PShape object, or use createShape.

createShape has an ELLIPSE parameter.

[https://processing.org/reference/createShape\_.html](https://processing.org/reference/createShape_.html)

However, that shape mode does not support texture, for complex reasons. There are complex manual workarounds listed at the bottom of the issue:

> <https://github.com/processing/processing/issues/2508>

However, if you can use something other than an ellipse – like a polygon – then it is very easy to texture, as per the texture reference page linked above.

---

<div class="post-metadata">

**Author:** ![padmakn](https://avatars.discourse-cdn.com/v4/letter/p/ce73a5/32.png) [@padmakn](https://discourse.processing.org/u/padmakn)\
**Post date:** [March 16, 2019, 3:36am UTC](https://discourse.processing.org/t/align-for-textlabel-in-processing/9079/10 "2019-03-16T03:36:22Z")

</div>

Hi,

I used PShape and .enableStyle() method by giving the .svg format in loadShape. But currently styling is not enabled in processing, otherwise would have worked.

Thanks for the help,

Padma

---

<div class="post-metadata">

**Author:** ![padmakn](https://avatars.discourse-cdn.com/v4/letter/p/ce73a5/32.png) [@padmakn](https://discourse.processing.org/u/padmakn)\
**Post date:** [March 16, 2019, 10:15am UTC](https://discourse.processing.org/t/align-for-textlabel-in-processing/9079/11 "2019-03-16T10:15:27Z")

</div>

Hi,

The \*\*rotateY() \*\*is not working in the below case. Do you understand why? I am just trying to show a sphere with text on it as a label and make a small sphere revolve around it using rotateY…

```auto
nya.beginTransform(0);
fill(#E74C3C);
noStroke();
lights();
sphere(20);
fill(#000000);
translate(0, 0, 20.3); 
noStroke();
fill(255, 50);
circle(20, -15, 20); 
translate(0, 0, 0.3); 
fill(0);
textSize(8);
text("Text", 40, 40, -15);
fill(#E74C3C);
noStroke();
lights();
translate(0,0,21);
rotateY((PI * frameCount )/ 300);
sphere(6);
nya.endTransform();

```

Regards,

Padma

---

<div class="post-metadata">

**Author:** ![padmakn](https://avatars.discourse-cdn.com/v4/letter/p/ce73a5/32.png) [@padmakn](https://discourse.processing.org/u/padmakn)\
**Post date:** [March 16, 2019, 1:00pm UTC](https://discourse.processing.org/t/align-for-textlabel-in-processing/9079/12 "2019-03-16T13:00:58Z")

</div>

Please ignore the previous email, I am planning to use processing.js

Thanks,

Padma

---

<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:** [March 16, 2019, 3:31pm UTC](https://discourse.processing.org/t/align-for-textlabel-in-processing/9079/13 "2019-03-16T15:31:49Z")

</div>

Do you want to use Processing.js, or are you going to use p5.js? Processing.js is an old cross-compiler that you can program in Java and output JavaScript – p5.js is a native JavaScript.

---

<div class="post-metadata">

**Author:** ![padmakn](https://avatars.discourse-cdn.com/v4/letter/p/ce73a5/32.png) [@padmakn](https://discourse.processing.org/u/padmakn)\
**Post date:** [March 16, 2019, 4:07pm UTC](https://discourse.processing.org/t/align-for-textlabel-in-processing/9079/14 "2019-03-16T16:07:19Z")

</div>

I an using it for augmented reality, so I think I can’t use p5.js.

---

<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 20, 2020, 10:01pm UTC](https://discourse.processing.org/t/align-for-textlabel-in-processing/9079/15 "2020-09-20T22:01:16Z")

</div>

12 posts were split to a new topic: [Using nyar4psg library for augmented reality](https://discourse.processing.org/t/using-nyar4psg-library-for-augmented-reality/23992)
