File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ <h1>Some Simple P5 Tutorials</h1>
1414 < li > < a href ="create-canvas.html "> createCanvas()</ a > </ li >
1515 < li > < a href ="background.html "> background()</ a > </ li >
1616 < li > < a href ="point.html "> point()</ a > </ li >
17+ < li > < a href ="rect.html "> rect()</ a > </ li >
1718 < li > < a href ="translate-and-rotate.html "> translate() and rotate()</ a > </ li >
1819 < li > < a href ="ellipse.html "> ellipse()</ a > </ li >
1920 < li > < a href ="save.html "> save()</ a > </ li >
Original file line number Diff line number Diff line change 1+ 'use strict' ;
2+
3+ const WIDTH = 640 ,
4+ HEIGHT = 480 ;
5+
6+ function setup ( ) {
7+ createCanvas ( WIDTH , HEIGHT ) ;
8+ }
9+
10+ function draw ( ) {
11+ // Read more at https://p5js.org/reference/#/p5/rect
12+ rect ( 0 , 0 , ( WIDTH / 2 ) , ( HEIGHT / 2 ) ) ;
13+ }
Original file line number Diff line number Diff line change 1+ <!DOCTYPE html>
2+ < html lang ="en ">
3+ < head >
4+ < meta charset ="utf-8 ">
5+ < title > rect | P5 Tutorial</ title >
6+ < script src ="https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.6.0/p5.min.js "
7+ integrity ="sha256-GDuv15eqQpLqWvLkRnd+EvvsHLngEUnerY5BDSYfLuM= "
8+ crossorigin ="anonymous "> </ script >
9+ < script src ="js/rect.js "> </ script >
10+
11+ <!-- Delete the following CSS if you don’t want a border around your canvas. -->
12+ < style > canvas { border : 1px solid # ddd ; }</ style >
13+ </ head >
14+ < body > <!-- Your P5 code does not go here. It goes in js/rect.js. --> </ body >
15+ </ html >
You can’t perform that action at this time.
0 commit comments