[p5.js 2.0+ Bug Report]: Fill interpolation in TRIANGLE_FAN in P2D mode
Open
Nobody has claimed this yet.
Area:Color
p5.js 2.0+
- Dominant language
- JavaScript
- Stars
- 24k
- Forks
- 3.8k
- Avg merge
- 3d 16h
- Merged PRs (30d)
- 25
Description
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:
- Draw a TRIANGLE_FAN in PSD mode, changing the fill color on every vertex
- 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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by running the provided TRIANGLE_FAN sketch in p5.js 2.3.3 and compare its output with 1.x. Inspect the TRIANGLE_FAN shape handling and per-vertex fill behavior; done means the color wheel renders the expected changing colors instead of one uniform color.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- computer-graphics
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100