Skip to content

[p5.js 2.0 Bug Report]: Transform not respected in bezier shapes for clipping masks #8475

@pbayer8

Description

@pbayer8

Most appropriate sub-area of p5.js?

  • Accessibility
  • Color
  • Core/Environment/Rendering
  • Data
  • DOM
  • Events
  • Image
  • IO
  • Math
  • Typography
  • Utilities
  • WebGL
  • Build process
  • Unit testing
  • Internationalization
  • Friendly errors
  • Other (specify if possible)

p5.js version

2.2.0

Web browser and version

Chrome 143.0.7499.193

Operating system

MacOS

Steps to reproduce this

Steps:

  1. Open a new sketch in the playground (use p5 version 2.2.0)
  2. Paste in the snippet
  3. Notice the circle is translated / shows up twice in the clipping mask, but the bezier curve only shows up once.
  4. (Optional) Modify the snippet to not use a clipping mask, and just stroke the two circles and two beziers.
  5. Notice all four shapes, 2 beziers, 2 circles render properly.
Image Image

Snippet:

function setup() {
  createCanvas(1000, 1000);	
}

function drawClipShape() {
  circle(100, 100, 100)
  beginShape();
  bezierVertex(30, 20);
  bezierVertex(80, 0);
  bezierVertex(80, 75);
  bezierVertex(30, 75);
  endShape();
}

function draw() {
  push()
  beginClip()
  drawClipShape()
  push()
  translate(100,0)
  drawClipShape()
  pop()
  endClip()
  fill("#ff0000")

  rect(0,0,600,600)
  pop()

}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions