First off, congratulations and thank you for making Observable. Designing algorithms is the fun part of my job and Observable made it even more fun.
I have been trying to add a vector overlay (plain canvas commands or SVG) on top of an Image element or live video. Is there a reasonably easy way to do that? On top of a GL canvas (after webGL rendering) would work too. I searched for examples, but couldn’t find any.
Set up a relatively positioned DIV, then position an absolutely positioned image, followed by an absolutely positioned SVG. The overall structure would look like:
I generally find these things easier to discuss if there’s a link shared notebook to reference. I would think, though, that if your container is a d3 object, then you would probably do
I really, really should have tested this properly before making the above claim. foreignObject support is a hot mess. Browser support differs wildly, and there are all sorts of stacking issues with animated content.
Don’t use foreignObject for video (text content should be good, though). Follow @mcmcclur’s advice instead and use the established methods of CSS positioning.