Skip to content

[p5.js 2.0+ Bug Report]: Fill interpolation in TRIANGLE_FAN in P2D mode #9159

Description

@ChristopherPAndrews

Most appropriate sub-area of p5.js?

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

p5.js version

2.3.3

Web browser and version

Safari 26.5.2, Arc 1.163.1

Operating system

MacOSX 15.7.7

Steps to reproduce this

Steps:

  1. Draw a TRIANGLE_FAN in PSD mode, changing the fill color on every vertex
  2. Observe that the resulting shape is a single color

Snippet:

const NUM_SLICES = 28;
const RADIUS = 280

function setup() {
    createCanvas(600, 600);
    background(255);
    noLoop();
    colorMode(HSB, TWO_PI, 100, 100);
}

function draw() {
    const step = TWO_PI /  NUM_SLICES;
    const cx = width/2;
    const cy = height / 2;

    noStroke();
    beginShape(TRIANGLE_FAN);
    vertex(cx , cy );
    for (let theta = 0; theta <= TWO_PI; theta+=step){
        fill(theta, 100, 100);

        vertex(cx + RADIUS * cos(theta), cy + RADIUS * sin(theta));
    }
    endShape();

}

This is a very simple color wheel that used to work in v 1.x. Now I get a circle that is entirely red. A little poking suggests that the library is combining all of the vertices into a single shape instead of detecting the color changes and creating separate shapes.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions