# P5js - Why can't I apply this specific invert clip to a shape?

**URL:** <https://discourse.processing.org/t/p5js-why-cant-i-apply-this-specific-invert-clip-to-a-shape/45132>\
**Category:** Coding Questions\
**Created:** [October 3, 2024, 3:25pm UTC](https://discourse.processing.org/t/p5js-why-cant-i-apply-this-specific-invert-clip-to-a-shape/45132 "2024-10-03T15:25:18Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![pedromgoncalves](https://avatars.discourse-cdn.com/v4/letter/p/8797f3/32.png) [@pedromgoncalves](https://discourse.processing.org/u/pedromgoncalves)\
**Post date:** [October 3, 2024, 3:25pm UTC](https://discourse.processing.org/t/p5js-why-cant-i-apply-this-specific-invert-clip-to-a-shape/45132/1 "2024-10-03T15:25:18Z")

</div>

Hi 🙂

I’m trying to apply an invert clip to a shape, but, for this specific clip shape, the clip is not being applied to the shape. It works if the clip is not inverted, and it works with other clips, such as ellipses, simple shapes and shapes with bezier curves.

Here is the code:

```auto
function setup() {
  createCanvas(400, 400);
  background(200);

  push();
  translate(-130,50);
  
  beginClip({ invert: true });
  beginShape();
  vertex(332.83,125.59);
  bezierVertex(308.92, 125.59, 303.01, 143.18, 303.01, 153.9);
  vertex(364.44, 153.9);
  bezierVertex(364.44, 143.45, 358.67, 125.59, 332.83, 125.59);
  endShape(CLOSE);
  endClip();
  
  beginShape();
  vertex(397.15, 174.93);
  vertex(303.42, 174.93);
  bezierVertex(304.66, 187.99, 317.71, 194.58, 339.15, 194.58);
  bezierVertex(371.31, 194.58, 394.26, 186.33, 395.5, 185.92);
  vertex(395.5, 212.86);
  bezierVertex(394.54, 213.27, 376.81, 221.79, 337.23, 221.79);
  bezierVertex(289.95, 221.79, 267.96, 199.66, 267.96, 162.42);
  bezierVertex(267.96, 125.18, 292.42, 100.85, 332.56, 100.85);
  bezierVertex(379.15, 100.85, 397.43, 132.32, 397.43, 165.17);
  bezierVertex(397.43, 168.61, 397.43, 172.18, 397.16, 174.93);
  endShape(CLOSE);
  
  pop();  
}

```

Can you help me?

Thank you.

---

<div class="post-metadata">

**Author:** ![svan](https://avatars.discourse-cdn.com/v4/letter/s/82dd89/32.png) [@svan](https://discourse.processing.org/u/svan)\
**Post date:** [October 3, 2024, 9:59pm UTC](https://discourse.processing.org/t/p5js-why-cant-i-apply-this-specific-invert-clip-to-a-shape/45132/2 "2024-10-03T21:59:45Z")

</div>

1.Try doing away with the push() and pop() and add a noStroke(); at the top.  
2. Use only one beginShape() … endShape() with all of your code in between (except noStroke() and translate()).

**Output:**

 ![e](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/3X/5/8/585673eeb9f915dc243e544981ff6f76915f0e94.png)

---

<div class="post-metadata">

**Author:** ![pedromgoncalves](https://avatars.discourse-cdn.com/v4/letter/p/8797f3/32.png) [@pedromgoncalves](https://discourse.processing.org/u/pedromgoncalves)\
**Post date:** [October 4, 2024, 9:16am UTC](https://discourse.processing.org/t/p5js-why-cant-i-apply-this-specific-invert-clip-to-a-shape/45132/3 "2024-10-04T09:16:30Z")

</div>

Thank you so much 🙂  
It is working.
