# Creating a word carpet by rotating and positioning a word a mulitple times

**URL:** <https://discourse.processing.org/t/creating-a-word-carpet-by-rotating-and-positioning-a-word-a-mulitple-times/33153>\
**Category:** Coding Questions\
**Created:** [October 29, 2021, 5:19am UTC](https://discourse.processing.org/t/creating-a-word-carpet-by-rotating-and-positioning-a-word-a-mulitple-times/33153 "2021-10-29T05:19:56Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![ontherun](https://avatars.discourse-cdn.com/v4/letter/o/59ef9b/32.png) [@ontherun](https://discourse.processing.org/u/ontherun)\
**Post date:** [October 29, 2021, 5:19am UTC](https://discourse.processing.org/t/creating-a-word-carpet-by-rotating-and-positioning-a-word-a-mulitple-times/33153/1 "2021-10-29T05:19:56Z")

</div>

Hi dear community,

Im quite new into processing, but seeing more and more the advantages for generative design aspects and experiments. So for an analog project I would try out the digital dummy.

As written in the headline, Im looking for a possibility in processing to position a word randomly and randomly rotated on the surface, repeated a (defined) multiple times.

As a base a think this should be made quite easy out of 3 functions.

(Defined Repeating Function  
(Word  
Rotate randomly  
Position randomly)  
)

Maybe the forum can assist me for this step by step?  
Maybe its also better put in the beginners section.

That would be great.  
I appreciate your help.

Best,  
ontherun

---

<div class="post-metadata">

**Author:** ![josephh](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/josephh/32/210_2.png) [@josephh](https://discourse.processing.org/u/josephh)\
**Post date:** [October 29, 2021, 9:14am UTC](https://discourse.processing.org/t/creating-a-word-carpet-by-rotating-and-positioning-a-word-a-mulitple-times/33153/2 "2021-10-29T09:14:43Z")

</div>

Hi @ontherun,

Welcome to the community! 😉

> [@ontherun](#):
>
> As written in the headline, Im looking for a possibility in processing to position a word randomly and randomly rotated on the surface, repeated a (defined) multiple times.

Do you want to achieve this in 3D (put text wrapped around a sphere) or in 2D (on a flat canvas)?

Because the workflow is a little bit different.

Otherwise if you are new to Processing, you should check the tutorials on the website:

> **[Tutorials](https://processing.org/tutorials/)**
>
> Links to videos that cover the Processing basics.

You already have the logic and the steps (think functions and possibly classes…), you only need to know the functions and the library 😋

---

<div class="post-metadata">

**Author:** ![ontherun](https://avatars.discourse-cdn.com/v4/letter/o/59ef9b/32.png) [@ontherun](https://discourse.processing.org/u/ontherun)\
**Post date:** [October 29, 2021, 6:35pm UTC](https://discourse.processing.org/t/creating-a-word-carpet-by-rotating-and-positioning-a-word-a-mulitple-times/33153/3 "2021-10-29T18:35:38Z")

</div>

Hi,

Thanks Josephh for the warm welcome and quick reply.  
I will have a look through the tutorials, maybe it is als a great chance to egt more insight and understanding.

Yes, 2D on a flat canvas.  
In the final I would like to see the difference between a 200 word carpets and just a 20 words carpet.

Best, ontherun

---

<div class="post-metadata">

**Author:** ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)\
**Post date:** [October 29, 2021, 10:34pm UTC](https://discourse.processing.org/t/creating-a-word-carpet-by-rotating-and-positioning-a-word-a-mulitple-times/33153/4 "2021-10-29T22:34:09Z")

</div>

When you check the reference it’s pretty easy

For example

for loop with 20 iterations

translate (random (width), random (height));

rotate(random (TWO\_PI));  
text(“geh hh”,0,0);

---

<div class="post-metadata">

**Author:** ![ontherun](https://avatars.discourse-cdn.com/v4/letter/o/59ef9b/32.png) [@ontherun](https://discourse.processing.org/u/ontherun)\
**Post date:** [October 30, 2021, 6:59pm UTC](https://discourse.processing.org/t/creating-a-word-carpet-by-rotating-and-positioning-a-word-a-mulitple-times/33153/5 "2021-10-30T18:59:37Z")

</div>

Hi,  
Thanks for the advise.  
Checked the reference, but I went not that good. At the moment not really something happens.

Version 1 at the moment (without rotation)

void setup() {

size(600, 800);  
background(0);

for (int i = 0; i\<100; i++) {  
float x = random(width);  
float y = random(height);

```
fill(255);
text("test", x, y);

```

}  
}

And this one,but it is also not working:

void setup() {

size(600, 800);  
background(255); {

```
translate (random (width), random (height));
fill(0);
rotate(random (TWO_PI));
text("Example",0,0);

```

}  
}

Could you maybe guide through the next step?

Thanks best ontherun

---

<div class="post-metadata">

**Author:** ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)\
**Post date:** [October 31, 2021, 6:02pm UTC](https://discourse.processing.org/t/creating-a-word-carpet-by-rotating-and-positioning-a-word-a-mulitple-times/33153/6 "2021-10-31T18:02:52Z")

</div>

I have to say both look very good to me and I am a bit lost why it’s not working

I didn’t mention setup () so can get rid of that OR use additionally draw() function and copy most of the code there

Can you please explain what happens? Do you get  
an error Message or does it run but doesn’t show a bit?

---

<div class="post-metadata">

**Author:** ![ontherun](https://avatars.discourse-cdn.com/v4/letter/o/59ef9b/32.png) [@ontherun](https://discourse.processing.org/u/ontherun)\
**Post date:** [November 7, 2021, 5:25pm UTC](https://discourse.processing.org/t/creating-a-word-carpet-by-rotating-and-positioning-a-word-a-mulitple-times/33153/7 "2021-11-07T17:25:38Z")

</div>

Hi Chris, thanks for the feedback.

Both are starting, with the first one I get my white sketchpad, but nothing more happens.  
The second is almost the same, the sketchpad opens in greyish color (no color given?) and nothing happens.  
Maybe my text is not shown? or something like that?  
Best  
ontherun

---

<div class="post-metadata">

**Author:** ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)\
**Post date:** [November 8, 2021, 12:26am UTC](https://discourse.processing.org/t/creating-a-word-carpet-by-rotating-and-positioning-a-word-a-mulitple-times/33153/8 "2021-11-08T00:26:30Z")

</div>

Can you please provide the code online to run

Is this p5 or really processing?

Do you see error messages
