差分
このページの2つのバージョン間の差分を表示します。
両方とも前のリビジョン 前のリビジョン 次のリビジョン | 前のリビジョン 次のリビジョン両方とも次のリビジョン | ||
lecture:design_with_prototyping:p5.js編:03デジタルキュビズム [2021/02/28 11:22] – ↷ lecture:design_with_prototyping:p5.js編:cubisme_キュビズム から lecture:design_with_prototyping:p5.js編:03デジタルキュビズム へページを名称変更しました。 baba | lecture:design_with_prototyping:p5.js編:10デジタルキュビズム [2021/02/28 11:34] – [Sample03] baba | ||
---|---|---|---|
行 20: | 行 20: | ||
===== 形を表現する ===== | ===== 形を表現する ===== | ||
* 四角を描いてください. | * 四角を描いてください. | ||
- | この課題に対してみなさん,どのように対応するでしょうか? | + | この課題に対してみなさん,どのように対応するでしょうか? |
プログラムでスケッチしてみます. | プログラムでスケッチしてみます. | ||
- | <file .pde 01_sample01.pde> | + | <file .js sketch.js> |
- | size(500, | + | function setup() { |
- | background(0); | + | createCanvas(500, 500);// 画面サイズ 500 x 500 px |
- | rectMode(CENTER); | + | } |
- | noFill(); | + | |
- | strokeWeight(10); | + | function draw() { |
- | stroke(255); | + | |
- | rect(width/ | + | rectMode(CENTER);// |
+ | noFill();// 塗りつぶしなし | ||
+ | strokeWeight(10);// | ||
+ | stroke(255);// | ||
+ | rect(width/ | ||
+ | } | ||
</ | </ | ||
{{ : | {{ : | ||
行 39: | 行 44: | ||
https:// | https:// | ||
</ | </ | ||
- | |||
- | |||
- | {{: | ||
- | <file .pde 01_sample02.pde> | ||
- | size(250, | ||
- | background(0); | ||
- | rectMode(CENTER); | ||
- | noStroke(); | ||
- | rect(width/ | ||
- | </ | ||
<WRAP clear/> | <WRAP clear/> | ||
+ | |||
+ | ==== Sample01 ==== | ||
{{: | {{: | ||
- | <file .pde 01_sample03.pde> | + | <file .js sketch.js> |
- | size(200, | + | function setup() { |
- | background(0); | + | createCanvas(200, 200); |
- | stroke(255); | + | } |
- | strokeWeight(10); | + | |
- | line(50,50, 50, 150); | + | function draw() { |
- | line(50, | + | |
- | line(150, | + | stroke(255); |
- | line(150, | + | strokeWeight(10); |
+ | line(50, 50, 50, 150); | ||
+ | line(50, 150, 150, 150); | ||
+ | line(150, 150, 150, 50); | ||
+ | line(150, 50, 50, 50); | ||
+ | } | ||
</ | </ | ||
<WRAP clear/> | <WRAP clear/> | ||
+ | |||
+ | ==== Sample02 ==== | ||
{{: | {{: | ||
- | <file .pde 01_sample04.pde> | + | <file .js sketch.js> |
- | size(200, 200); | + | function setup() { |
- | background(0); | + | createCanvas(200, 200); |
- | stroke(255); | + | } |
- | strokeWeight(10); | + | |
- | noFill(); | + | function draw() { |
- | beginShape(); | + | |
- | vertex(50, 50); | + | stroke(255); |
- | vertex(50, 150); | + | strokeWeight(10); |
- | vertex(150, 150); | + | noFill(); |
- | vertex(150, 50); | + | beginShape(); |
- | endShape(CLOSE); | + | vertex(50, 50); |
+ | vertex(50, 150); | ||
+ | vertex(150, 150); | ||
+ | vertex(150, 50); | ||
+ | endShape(CLOSE); | ||
+ | } | ||
</ | </ | ||
<WRAP clear/> | <WRAP clear/> | ||
+ | ==== Sample03 ==== | ||
{{: | {{: | ||
- | <file .pde 01_sample05.pde> | + | <file .js sketch.js> |
- | size(200, 200); | + | function setup() { |
- | background(0); | + | createCanvas(200, 200); |
- | stroke(255); | + | } |
- | strokeWeight(1); | + | |
- | noFill(); | + | function draw() { |
- | beginShape(POINTS); | + | |
- | for ( int i = 0; i < 100; i++ ) { | + | stroke(255); |
- | vertex(50, 50+i); | + | strokeWeight(10); |
- | vertex(50+i, | + | noFill(); |
- | vertex(150, 150-i); | + | beginShape(POINTS); |
- | vertex(150-i, | + | for (let i = 0; i < 100; i++) { |
+ | vertex(50, 50 + i); | ||
+ | vertex(50 + i, 150); | ||
+ | vertex(150, 150 - i); | ||
+ | vertex(150 - i, 50); | ||
+ | } | ||
+ | endShape(CLOSE); | ||
} | } | ||
- | endShape(CLOSE); | ||
</ | </ | ||
<WRAP clear/> | <WRAP clear/> | ||
+ | |||
+ | ==== Sample04 ==== | ||
{{: | {{: | ||
<file .pde 01_sample06.pde> | <file .pde 01_sample06.pde> | ||
行 117: | 行 134: | ||
<WRAP clear/> | <WRAP clear/> | ||
+ | ==== Sample05 ==== | ||
{{: | {{: | ||
<file .pde 01_sample07.pde> | <file .pde 01_sample07.pde> | ||
行 136: | 行 154: | ||
<WRAP clear/> | <WRAP clear/> | ||
+ | |||
+ | ==== Sample06 ==== | ||
{{: | {{: | ||
<file .pde 01_sample08.pde> | <file .pde 01_sample08.pde> | ||
行 153: | 行 173: | ||
<WRAP clear/> | <WRAP clear/> | ||
+ | |||
+ | ==== Sample07 ==== | ||
{{: | {{: | ||
<file .pde 01_sample09.pde> | <file .pde 01_sample09.pde> | ||
行 172: | 行 194: | ||
<WRAP clear/> | <WRAP clear/> | ||
+ | ==== Sample08 ==== | ||
{{: | {{: | ||
<file .pde 01_sample10.pde> | <file .pde 01_sample10.pde> |