Skip to content

[p5.js 2.0 Bug Report]: Transforms in clip() stopped working in 2.x #7903

Open
@davepagurek

Description

@davepagurek

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

Web browser and version

Firefox

Operating system

MacOS

Steps to reproduce this

The following code clips to a circle at the center of the screen:

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

function draw() {
  background(220);
  noStroke()
  
  clip(() => {
    push()
    translate(width/2, height/2)
    circle(0, 0, 60)
    pop()
  })
  fill(0)
  rect(0, 0, 400, 400)
}

In 1.11.8 it looks like this:

Image

In 2.0.3 it looks like this, which is unexpected:

Image

Live: https://editor.p5js.org/davepagurek/sketches/IVloB6s76W

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Ready for Work

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions