Skip to content

Commit 21f191d

Browse files
author
Lauren McCarthy
committed
Merge pull request #625 from jshaw/master
Updated DOM examples
2 parents e757a5e + 1fcca66 commit 21f191d

File tree

15 files changed

+27
-18
lines changed

15 files changed

+27
-18
lines changed
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
<head>
22
<script language="javascript" type="text/javascript" src="../../../../lib/p5.js"></script>
3+
<script language="javascript" type="text/javascript" src="../../../../lib/addons/p5.dom.js"></script>
34
<script language="javascript" type="text/javascript" src="sketch.js"></script>
45
</head>
56

67
<body>
78
<h1>HI THIS IS THE HEADER</h1>
8-
</body>
9+
</body>

examples/tutorials/DOM-extensions/0/sketch.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ function setup() {
1111
// This is because the most the program tries to draw into the most recently created element.
1212
// If you create the HTML element second, it doesn't make work to draw background and ellipse into it
1313
// because drawing only works with graphics elements.
14-
var text = createHTML("This is an HTML string!");
14+
var text = createP("This is an HTML string!");
1515
var canvas = createCanvas(600, 400);
1616

1717
// Here we call methods of each element to set the position and id, try changing these values.
@@ -31,4 +31,4 @@ function draw() {
3131
ellipse(width/2, height/2, 100, 100);
3232
ellipse(width/4, height/2, 50, 50);
3333

34-
}
34+
}
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
<head>
22
<script language="javascript" type="text/javascript" src="../../../../lib/p5.js"></script>
3+
<script language="javascript" type="text/javascript" src="../../../../lib/addons/p5.dom.js"></script>
34
<script language="javascript" type="text/javascript" src="sketch.js"></script>
45
</head>
56

67
<body>
7-
</body>
8+
</body>

examples/tutorials/DOM-extensions/1/sketch.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ function setup() {
1313
// because drawing only works with graphics elements.
1414

1515
// Now let's try putting some more HTML in.
16-
var text = createHTML("Here is some text and <a href='http://i.imgur.com/WXaUlrK.gif'>this is an HTML link</a>!");
16+
var text = createP("Here is some text and <a href='http://i.imgur.com/WXaUlrK.gif'>this is an HTML link</a>!");
1717
var canvas = createCanvas(600, 400);
1818

1919
// Here we call methods of each element to set the position and id, try changing these values.
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
<head>
22
<script language="javascript" type="text/javascript" src="../../../../lib/p5.js"></script>
3+
<script language="javascript" type="text/javascript" src="../../../../lib/addons/p5.dom.js"></script>
34
<script language="javascript" type="text/javascript" src="sketch.js"></script>
45
</head>
56

67
<body>
7-
</body>
8+
</body>

examples/tutorials/DOM-extensions/2/sketch.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ var canvas;
88
function setup() {
99

1010
// We are still calling createCanvas like before, but now we are storing a pointer to each one.
11-
img = createHTMLImage("http://th07.deviantart.net/fs70/PRE/i/2011/260/3/5/dash_hooray_by_rainbowcrab-d49xk0d.png");
11+
img = createImg("http://th07.deviantart.net/fs70/PRE/i/2011/260/3/5/dash_hooray_by_rainbowcrab-d49xk0d.png");
1212
canvas = createCanvas(400, 400);
1313

1414
// Here we call methods of each element to set the position and id.
@@ -33,4 +33,4 @@ function draw() {
3333
line(i, 0, i, height);
3434
}
3535

36-
}
36+
}
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
<head>
22
<script language="javascript" type="text/javascript" src="../../../../lib/p5.js"></script>
3+
<script language="javascript" type="text/javascript" src="../../../../lib/addons/p5.dom.js"></script>
34
<script language="javascript" type="text/javascript" src="sketch.js"></script>
45
</head>
56

67
<body>
7-
</body>
8+
</body>

examples/tutorials/DOM-extensions/3/sketch.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ function setup() {
99

1010
// We are still calling createCanvas like before, but now we are storing a pointer to each one.
1111
canvas = createCanvas(400, 400);
12-
img = createHTMLImage("http://th07.deviantart.net/fs70/PRE/i/2011/260/3/5/dash_hooray_by_rainbowcrab-d49xk0d.png");
12+
img = createImg("http://th07.deviantart.net/fs70/PRE/i/2011/260/3/5/dash_hooray_by_rainbowcrab-d49xk0d.png");
1313

1414
// Here we call methods of each element to set the position and id.
1515
// Use view-source to look at the HTML generated from this code when you load the sketch in your browser.
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
<head>
22
<script language="javascript" type="text/javascript" src="../../../../lib/p5.js"></script>
3+
<script language="javascript" type="text/javascript" src="../../../../lib/addons/p5.dom.js"></script>
34
<script language="javascript" type="text/javascript" src="sketch.js"></script>
45
</head>
56

67
<body>
7-
</body>
8+
</body>

examples/tutorials/DOM-extensions/4/sketch.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ function setup() {
88

99
// We are still calling createCanvas like before, but now we are storing a pointer to each one.
1010
canvas = createCanvas(400, 400);
11-
img = createHTMLImage("http://th07.deviantart.net/fs70/PRE/i/2011/260/3/5/dash_hooray_by_rainbowcrab-d49xk0d.png");
11+
img = createImg("http://th07.deviantart.net/fs70/PRE/i/2011/260/3/5/dash_hooray_by_rainbowcrab-d49xk0d.png");
1212

1313
// Here we call methods of each element to set the position and id.
1414
// Use view-source to look at the HTML generated from this code when you load the sketch in your browser.
@@ -47,4 +47,4 @@ function uniShow() {
4747
// Define keyPressed behavior. This one doesn't need to be hooked in, it's automatically called on key press.
4848
function keyPressed() {
4949
uniShow();
50-
}
50+
}

0 commit comments

Comments
 (0)