-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5787 from processing/fixes5785
fixes for #5785
- Loading branch information
Showing
4 changed files
with
166 additions
and
30 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<html> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<script language="javascript" type="text/javascript" src="../../../../lib/p5.js"></script> | ||
|
||
<script language="javascript" type="text/javascript" src="sketch.js"></script> | ||
|
||
</head> | ||
</html> |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
let xpos = 50; | ||
let ypos = 100; | ||
let str = | ||
'One Two Three Four Five Six Seven Eight Nine Ten Eleven Twelve Thirteen Fourteen Fifteen Sixteen Seventeen Eighteen Nineteen Twenty Twenty-one Twenty-two Twenty-three Twenty-four Twenty-five Twenty-six Twenty-seven Twenty-eight Twenty-nine Thirty Thirty-one Thirty-two Thirty-three Thirty-four Thirty-five Thirty-six Thirty-seven Thirty-eight Thirty-nine Forty Forty-one Forty-two Forty-three Forty-four Forty-five Forty-six Forty-seven Forty-eight Forty-nine Fifty Fifty-one Fifty-two Fifty-three'; | ||
|
||
function setup() { | ||
createCanvas(1050, 800); | ||
background(245); | ||
|
||
let ta = textAscent(); | ||
|
||
textAlign(CENTER, TOP); | ||
rect(xpos, ypos, 200, 200); | ||
text(str, xpos, ypos, 200, 200); | ||
xpos += 250; | ||
|
||
textAlign(CENTER, CENTER); | ||
rect(xpos, ypos, 200, 200); | ||
text(str, xpos, ypos, 200, 200); | ||
xpos += 250; | ||
|
||
textAlign(CENTER, BOTTOM); | ||
rect(xpos, ypos, 200, 200); | ||
text(str, xpos, ypos, 200, 200); | ||
xpos += 250; | ||
|
||
textAlign(CENTER, BASELINE); | ||
rect(xpos, ypos, 200, 200); | ||
text(str, xpos, ypos, 200, 200); | ||
|
||
textSize(18); | ||
textAlign(CENTER, TOP); | ||
text('TOP', 150, height / 2 - 40); | ||
text('CENTER', 400, height / 2 - 40); | ||
text('BOTTOM', 650, height / 2 - 40); | ||
text('BASELINE', 900, height / 2 - 40); | ||
textSize(12); | ||
|
||
xpos = 50; | ||
ypos += 400; | ||
|
||
textAlign(CENTER, TOP); | ||
rect(xpos, ypos, 200, 200); | ||
text(str, xpos, ypos, 200); | ||
xpos += 250; | ||
|
||
textAlign(CENTER, CENTER); | ||
rect(xpos, ypos, 200, 200); | ||
text(str, xpos, ypos, 200); | ||
xpos += 250; | ||
|
||
textAlign(CENTER, BOTTOM); | ||
rect(xpos, ypos, 200, 200); | ||
text(str, xpos, ypos, 200); | ||
xpos += 250; | ||
|
||
textAlign(CENTER, BASELINE); | ||
rect(xpos, ypos, 200, 200); | ||
text(str, xpos, ypos, 200); | ||
|
||
textSize(18); | ||
textAlign(CENTER, TOP); | ||
text('TOP', 150, height / 2 - 40); | ||
text('CENTER', 400, height / 2 - 40); | ||
text('BOTTOM', 650, height / 2 - 40); | ||
text('BASELINE', 900, height / 2 - 40); | ||
text('TOP', 150, ypos + 270); | ||
text('CENTER', 400, ypos + 270); | ||
text('BOTTOM', 650, ypos + 270); | ||
text('BASELINE', 900, ypos + 270); | ||
|
||
fill(255); | ||
noStroke(); | ||
textSize(24); | ||
|
||
rect(0, height / 2, width, 15); | ||
fill(0); | ||
textAlign(LEFT, TOP); | ||
text('text(s, x, y, w, h)', 20, 40); | ||
text('text(s, x, y, w) [no height]', 20, height / 2 + 40); | ||
} |