Skip to content

Commit 579a1c3

Browse files
author
Lauren McCarthy
committed
Merge branch 'master' of github.com:processing/p5.js
2 parents fa56cfe + 8ece3f8 commit 579a1c3

File tree

28 files changed

+680
-268
lines changed

28 files changed

+680
-268
lines changed

docs/js/p5.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1731,17 +1731,17 @@ var colorcreating_reading = function (require, core, p5Color) {
17311731
if (c1 instanceof Array) {
17321732
var c = [];
17331733
for (var i = 0; i < c1.length; i++) {
1734-
c.push(p5.prototype.lerp(c1[i], c2[i], amt));
1734+
c.push(Math.sqrt(p5.prototype.lerp(c1[i]*c1[i], c2[i]*c2[i], amt)));
17351735
}
17361736
return c;
17371737
} else if (c1 instanceof p5.Color) {
17381738
var pc = [];
17391739
for (var j = 0; j < 4; j++) {
1740-
pc.push(p5.prototype.lerp(c1.rgba[j], c2.rgba[j], amt));
1740+
pc.push(Math.sqrt(p5.prototype.lerp(c1.rgba[j]*c1.rgba[j], c2.rgba[j]*c2.rgba[j], amt)));
17411741
}
17421742
return new p5.Color(this, pc);
17431743
} else {
1744-
return p5.prototype.lerp(c1, c2, amt);
1744+
return Math.sqrt(p5.prototype.lerp(c1*c1, c2*c2, amt));
17451745
}
17461746
};
17471747
p5.prototype.red = function (c) {
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>

0 commit comments

Comments
 (0)