-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Closed
Description
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
- Internalization
- Friendly Errors
- Other (specify if possible)
p5.js version
1.6.0 to 1.8.0
Web browser and version
Firefox 117
Operating System
MacOS 14
Steps to reproduce this
Steps:
- Make a video with
createVideo - Hide it with
video.hide() - Resize it with
video.size(w, h) - Draw it to the canvas with
image(video, 0, 0)
This shows nothing on canvas post 1.6.0. Omitting steps 2 or 3 makes it work again (it seems it's the combination of both of them that does it.)
Specifically, these two lines evaluate to 0 when setting the size on the hidden element:
Lines 2267 to 2268 in 28740f9
| this.width = this.elt.offsetWidth; | |
| this.height = this.elt.offsetHeight; |
Snippet:
let movie;
function preload() {
// my video is 640 x 360
movie = createVideo("flyboard.mp4");
movie.volume(0);
}
function setup() {
createCanvas(640, 360);
pixelDensity(1);
movie.play();
// Commenting this out makes it work
movie.hide();
}
function draw() {
background(220);
// Commenting this out makes it work
// (or moving it to setup it seems)
movie.size(width, height);
image(movie, 0, 0);
}