Open
Description
Nature of issue?
- Found a bug
Most appropriate sub-area of p5.js?
- Color
createGraphics()
set()
Which platform were you using when you encountered this?
- Desktop/Laptop
Details about the bug:
- p5.js version: 0.6.1 (using the alpha web editor)
- Web browser and version: Chrome 67.0.3396.62
- Operating System: Linux
- Steps to reproduce this:
From this Stack Overflow question.
It appears that the set()
function does not work with P5.Graphics
values. Is this expected?
let redRect;
function setup() {
createCanvas(100,100);
redRect = createGraphics(100,100);
redRect.fill(255, 0, 0);
redRect.rect(20,20,40,40);
const blueRect = createGraphics(20, 20);
blueRect.background(0, 0, 255);
redRect.set(30, 30, blueRect);
redRect.updatePixels();
}
function draw() {
background(0, 255, 0);
image(redRect,0,0);
}
I would expect this to create a graphics that contains a red rectangle, and then draw a blue rectangle to that first graphics. Instead, only a single pixel is set, and it's set to transparent?
Metadata
Metadata
Assignees
Type
Projects
Status
Ready for Work