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

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
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.


Hi @ontherun,

Welcome to the community! :wink:

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:

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


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


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);

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);

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

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));
rotate(random (TWO_PI));


Could you maybe guide through the next step?

Thanks best ontherun

1 Like

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?

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?

1 Like

Can you please provide the code online to run

Is this p5 or really processing?

Do you see error messages