added code-design
This commit is contained in:
13
content/docs/2023/code-design/13/_index.en.md
Normal file
13
content/docs/2023/code-design/13/_index.en.md
Normal file
@ -0,0 +1,13 @@
|
||||
---
|
||||
title: Week 11
|
||||
date: 2023-06-23
|
||||
weight: 11
|
||||
params:
|
||||
pdf_path: 2023-code-and-design-11.pdf
|
||||
---
|
||||
|
||||
# 2023 Tokyo University of the Arts Art media Center「Code and Design」 Week 11
|
||||
|
||||
## Slide
|
||||
|
||||
{{< embed_pdf >}}
|
61
content/docs/2023/code-design/13/_index.md
Normal file
61
content/docs/2023/code-design/13/_index.md
Normal file
@ -0,0 +1,61 @@
|
||||
---
|
||||
title: 第13週
|
||||
date: 2023-06-23
|
||||
weight: 13
|
||||
---
|
||||
|
||||
# 2023年 東京藝術大学 芸術情報センター開設科目 「コードとデザイン」 第13回
|
||||
|
||||
## スライド
|
||||
|
||||
(スライド行方不明・・・多分この日はスライドなかったと思います)
|
||||
|
||||
## 銅箔テープで作る平面コイルのSVGを出力するProcessingスケッチ
|
||||
|
||||
|
||||
|
||||
```java
|
||||
import processing.svg.*;
|
||||
|
||||
void setup(){
|
||||
noLoop();
|
||||
size(800,800);
|
||||
stroke(0);
|
||||
background(255);
|
||||
beginRecord(SVG, "spiral.svg");
|
||||
|
||||
}
|
||||
|
||||
float diameter = 800;
|
||||
|
||||
|
||||
void draw(){
|
||||
float angle = 0;
|
||||
float r = 1;
|
||||
float r_step =0.4;
|
||||
float angle_step = 0.1;
|
||||
translate(width/2,height/2);
|
||||
float x_tmp = 0;
|
||||
float y_tmp = 0;
|
||||
while(r < width/2-10){
|
||||
r += r_step;
|
||||
angle += angle_step;
|
||||
float x = r*sin(angle);
|
||||
float y = r*cos(angle);
|
||||
line(x_tmp,y_tmp,x,y);
|
||||
x_tmp = x;
|
||||
y_tmp = y;
|
||||
}
|
||||
r+=9;
|
||||
while(r > 0){
|
||||
r -= r_step;
|
||||
angle -= angle_step;
|
||||
float x = r*sin(angle);
|
||||
float y = r*cos(angle);
|
||||
line(x_tmp,y_tmp,x,y);
|
||||
x_tmp = x;
|
||||
y_tmp = y;
|
||||
}
|
||||
endRecord();
|
||||
}
|
||||
```
|
43
content/docs/2023/code-design/13/svg_spiral.pde
Normal file
43
content/docs/2023/code-design/13/svg_spiral.pde
Normal file
@ -0,0 +1,43 @@
|
||||
import processing.svg.*;
|
||||
|
||||
void setup(){
|
||||
noLoop();
|
||||
size(800,800);
|
||||
stroke(0);
|
||||
background(255);
|
||||
beginRecord(SVG, "spiral.svg");
|
||||
|
||||
}
|
||||
|
||||
float diameter = 800;
|
||||
|
||||
|
||||
void draw(){
|
||||
float angle = 0;
|
||||
float r = 1;
|
||||
float r_step =0.4;
|
||||
float angle_step = 0.1;
|
||||
translate(width/2,height/2);
|
||||
float x_tmp = 0;
|
||||
float y_tmp = 0;
|
||||
while(r < width/2-10){
|
||||
r += r_step;
|
||||
angle += angle_step;
|
||||
float x = r*sin(angle);
|
||||
float y = r*cos(angle);
|
||||
line(x_tmp,y_tmp,x,y);
|
||||
x_tmp = x;
|
||||
y_tmp = y;
|
||||
}
|
||||
r+=9;
|
||||
while(r > 0){
|
||||
r -= r_step;
|
||||
angle -= angle_step;
|
||||
float x = r*sin(angle);
|
||||
float y = r*cos(angle);
|
||||
line(x_tmp,y_tmp,x,y);
|
||||
x_tmp = x;
|
||||
y_tmp = y;
|
||||
}
|
||||
endRecord();
|
||||
}
|
Reference in New Issue
Block a user