Last active
August 29, 2015 14:27
-
-
Save shiffman/22bb21705ce2829207b1 to your computer and use it in GitHub Desktop.
Move a sketch into a div after it runs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <html> | |
| <head> | |
| <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> | |
| <script language="javascript" src="../../lib/p5.js"></script> | |
| <script language="javascript" src="sketch.js"></script> | |
| <script language="javascript"> | |
| //$(document).ready(function() { | |
| window.onload = function() { | |
| $('#defaultCanvas').appendTo("#container"); | |
| }; | |
| //}); | |
| </script> | |
| <style> | |
| #container { | |
| background-color: #0000FF; | |
| margin: 24px; | |
| padding: 54px; | |
| width: 300px; | |
| height: 300px; | |
| } | |
| </style> | |
| </head> | |
| <body> | |
| <div id ="container"></div> | |
| </body> | |
| </html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function setup() { | |
| createCanvas(200,200); | |
| } | |
| function draw() { | |
| background(255,0,0); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment