# Transforming object to a letter (text)

**URL:** <https://discourse.processing.org/t/transforming-object-to-a-letter-text/20548>\
**Category:** Coding Questions\
**Created:** [May 6, 2020, 5:29pm UTC](https://discourse.processing.org/t/transforming-object-to-a-letter-text/20548 "2020-05-06T17:29:55Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![LennieCZ](https://avatars.discourse-cdn.com/v4/letter/l/3be4f8/32.png) [@LennieCZ](https://discourse.processing.org/u/LennieCZ)\
**Post date:** [May 6, 2020, 5:29pm UTC](https://discourse.processing.org/t/transforming-object-to-a-letter-text/20548/1 "2020-05-06T17:29:55Z")

</div>

Hello everyone!  
I’ve got a question. I am absolute newbie in processing and I want to create some interactive typographic thing.  
Can you help me?  
I need to transform an ellipse to a letter (text). Let’s say “A”. It should move around the sketch - i’ve already got this code.  
I would be greatful for your answer and help! Thank you!

Here’s the code

> float x, y;  
> float easing = 0.1;  
> boolean go=false;  
> PFont F;
> 
> void setup() {  
> size(1920,1080);  
> rectMode(CENTER);  
> newPosition();  
> F=createFont(“Arial”,200,true);  
> }
> 
> void draw() {  
> background(128);  
> PVector p = new PVector( mouseX-x, mouseY-y, 0);  
> p.limit(2);  
> if (go && dist(mouseX, mouseY, x, y)\<400) {  
> x-=p.x;  
> y-=p.y;  
> }  
> x = constrain(x,25,width-25);  
> y = constrain(y,25,height-25);  
> textFont(F);  
> ellipse(x, y, 50, 50);  
> if (mouseX\>x-25 && mouseX\<x+25 && mouseY\>y-25 && mouseY\<y+25) {  
> newPosition();  
> }
> 
> fill(0);  
> //textFont(F);  
> translate(120,240);  
> text (“H”,0,0);  
> translate(210,70);  
> text (“E”,0,0);  
> translate(220,10);  
> text (“L”,0,0);  
> translate(230,20);  
> text (“L”,0,0);  
> translate(240,30);  
> text (“O”,0,0);
> 
> }
> 
> void mouseMoved() {  
> go=true;  
> }
> 
> void newPosition() {  
> x=random(width);  
> y=random(height);  
> }

---

<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:** [May 6, 2020, 5:36pm UTC](https://discourse.processing.org/t/transforming-object-to-a-letter-text/20548/2 "2020-05-06T17:36:28Z")

</div>

> [@LennieCZ](#):
>
> to transform an ellipse to a letter (text). Let’s say “A”.

you mean that the ellipses evolves into A and that this happens in an animation?

Like a morphing effect?

---

<div class="post-metadata">

**Author:** ![LennieCZ](https://avatars.discourse-cdn.com/v4/letter/l/3be4f8/32.png) [@LennieCZ](https://discourse.processing.org/u/LennieCZ)\
**Post date:** [May 6, 2020, 5:41pm UTC](https://discourse.processing.org/t/transforming-object-to-a-letter-text/20548/3 "2020-05-06T17:41:31Z")

</div>

No. I mean transforming like exchaning the object (ellipse) to a letter. I want basicly this ( [https://dia.tv/project/klim-sohne/#slide-4](https://dia.tv/project/klim-sohne/#slide-4) ) for example - i have a code for moving the object, but I want the object to be a letter and the letter should move around the sketch 🙂 . If you understand me (sorry for bad english).

---

<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:** [May 6, 2020, 5:45pm UTC](https://discourse.processing.org/t/transforming-object-to-a-letter-text/20548/4 "2020-05-06T17:45:56Z")

</div>

> [@LennieCZ](#):
>
> ellipse(x, y, 50, 50);

replace this by

```auto
text ( "A", 
      x, y );

```

maybe set textSize() before this?

---

<div class="post-metadata">

**Author:** ![LennieCZ](https://avatars.discourse-cdn.com/v4/letter/l/3be4f8/32.png) [@LennieCZ](https://discourse.processing.org/u/LennieCZ)\
**Post date:** [May 6, 2020, 5:50pm UTC](https://discourse.processing.org/t/transforming-object-to-a-letter-text/20548/5 "2020-05-06T17:50:10Z")

</div>

Great! That works! Thank you 🙂

---

<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:** [May 6, 2020, 5:58pm UTC](https://discourse.processing.org/t/transforming-object-to-a-letter-text/20548/6 "2020-05-06T17:58:00Z")

</div>

Great!

And welcome to the forum!

Great to have you here.

Warmest regards,

Chrisir
