Show a WebPage in the canvas

I am trying to use the p5.dom.js library for showing a webpage in the canvas if some buttons are pressed, I don't want to link the page with createA() but to actually visualize it, is there any way?

Thanks!

Answers

  • Answer ✓

    It would be easier to simply open the page in an iframe...

    Visualising it would involve rendering the requested page to an offscreen buffer; rendering this to an image and then loading the image into the canvas. Looks like html2canvas already does this; but whether you can get that to play nicely alongside p5 is another matter...

  • Ok, thanks, with the iframe works well!

  • Hi, giulioisac. How did you work with iframe? There is an function for that?

  • edited December 2016

    Hey, here an example to put in the setup function:

    var frame;
    frame = createElement("iframe");
    frame.attribute("src","www.google.com")
    frame.attribute("frameborder","0");
    frame.position(windowWidth*0.25, windowHeight*0.65);
    frame.size(570, height*0.3);
    frame.show();
    
Sign In or Register to comment.