# Making a shape face the mouse

**URL:** <https://discourse.processing.org/t/making-a-shape-face-the-mouse/19735>\
**Category:** Coding Questions\
**Created:** [April 13, 2020, 10:00am UTC](https://discourse.processing.org/t/making-a-shape-face-the-mouse/19735 "2020-04-13T10:00:39Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![poppyseeds](https://avatars.discourse-cdn.com/v4/letter/p/dec6dc/32.png) [@poppyseeds](https://discourse.processing.org/u/poppyseeds)\
**Post date:** [April 13, 2020, 10:00am UTC](https://discourse.processing.org/t/making-a-shape-face-the-mouse/19735/1 "2020-04-13T10:00:39Z")

</div>

In this sketch, I have two ellipses that look like a fish. It follows the position of the invisible cursor. Along with moving as it currently is, I want to make the fish face the cursor at all times which means if i move the cursor up, the fish faces and moves up like a real fish in water would. Always swimming forward. I hope you can help me with this.

```auto
function setup() {
    createCanvas(600, 600);
  noCursor();
}

function draw() {
    background(255);
  
  
    noStroke();
    fill(random(0,0,0), random(105,105,105));
  ellipse(mouseX+14,mouseY,10,12);
  fill(random(0,0,0),random(105,105,105));
  ellipse(mouseX,mouseY,25,15)
     
}

```

---

<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:** [April 13, 2020, 9:41pm UTC](https://discourse.processing.org/t/making-a-shape-face-the-mouse/19735/2 "2020-04-13T21:41:23Z")

</div>

I think look at atan2

---

<div class="post-metadata">

**Author:** ![poppyseeds](https://avatars.discourse-cdn.com/v4/letter/p/dec6dc/32.png) [@poppyseeds](https://discourse.processing.org/u/poppyseeds)\
**Post date:** [April 14, 2020, 9:45am UTC](https://discourse.processing.org/t/making-a-shape-face-the-mouse/19735/3 "2020-04-14T09:45:24Z")

</div>

I will have a look at that 🙂 Thank you.

---

<div class="post-metadata">

**Author:** ![poppyseeds](https://avatars.discourse-cdn.com/v4/letter/p/dec6dc/32.png) [@poppyseeds](https://discourse.processing.org/u/poppyseeds)\
**Post date:** [April 14, 2020, 10:30am UTC](https://discourse.processing.org/t/making-a-shape-face-the-mouse/19735/4 "2020-04-14T10:30:15Z")

</div>

It worked!! Thank you very much :)))))
