# Intro to Computational Language

컴퓨터언어기초 (자바스크립트 코딩 기초)

### Hello! ICL

#### This is an online syllabus for the 'Intro to Computational Language' so called 'ICL' class.

#### [Processing](https://processing.org/) has been a great tool for the media artists, creative technologists, designers, educators and etc. And here we have [p5.js](https://p5js.org/), a javascript library which promotes the same goal as the processing. It has come to this internet world because the web is to be alive forever.&#x20;

#### At the browser, we have P5.js which welcomes you to experiment your intentions in media. A great thing about the P5.js is we have a youtube channel by [Daniel Shiffman](https://www.youtube.com/user/shiffman) at [NYU ITP](https://tisch.nyu.edu/itp). You can subscribe and easily learn p5.js, and even cutting-edge machine learning.&#x20;

#### You can learn more about p5.js[ here](https://p5js.org/).  The great thing about the [p5.js](https://p5js.org/) is that you can learn the mechanisms of the coding environment. Just like when you are learning a new language you learn how to use a dictionary, you can learn the mechanisms of how to learn a new computational language and eventually learn how to vitalize yourself from 'illiterate' to 'literate' in any language.

### Schedule <a href="#schedule" id="schedule"></a>

1. Introduction and Workflow(Javascript, Text Editor)
2. Introduction and Drawing
3. Animation and Variables, Interaction
4. If Statements, Repeat Loops
5. Functions: the basics
6. Objects and Arrays
7. Events and Callback Function
8. Data
9. Video and Sound
10. Mobile and Chrome
11. After p5.js - Final Project Proposal 1
12. Web Socket and Node - Final Project Proposal 2
13. User Testing
14. Final Presentation 1
15. Final Presentation 2

### Books

* **Getting Started with p5.js (Recommended) :** [**Link**](< http://shop.oreilly.com/product/0636920032076.do>)
* **JavaScript: The Good Parts** (**Recommended**) : [**Link**](https://www.amazon.com/JavaScript-Good-Parts-Douglas-Crockford/dp/0596517742)

### Resources

{% embed url="<https://www.w3schools.com/>" %}

{% embed url="<https://p5js.org/>" %}

{% embed url="<https://www.youtube.com/user/shiffman>" %}


# Academic Policy

### Fall 2018 (Course Number 7882187-1)

* 홍익대학교 국제디자인전문대학원 508호 / Hongik University IDAS Rm 508
* 화 14:00 - 17:00 / Tuesday 14:00 - 17:00
* [**First day ICL Student Survey**](https://goo.gl/forms/le9N02WLLu0OZS2n2)

### **Why are you taking this class?**

1. Portfolio
2. Want to learn coding/ other language
3. Growth Hacking??&#x20;
4. Designer needs to learn coding / for professional need(career)

### **Do you have coding experience?**

9 Yes / 1 In-between / 8 No

### **What is your dream project you want to make from this class?**

Media Art, IoT, Webpage, Web game, Toy, Arduino, Machine Learning, Block Chain, etc<br>

## What is Creative ?

Communication  ?

<https://www.theatlantic.com/national/archive/2013/07/malcolm-gladwells-cockpit-culture-theory-everywhere-after-asiana-crash/313442/>

####

### Attendance&#x20;

* 결석 4회 : Fail  / 4 Unexcused Absences : Fail
* 결석 사유 발생 시 사전 이메일 통보 필수 (병가, 직무사유 등)&#x20;
* Get excused before OR on the day of the absence.
* 지각 1회 = 1/2회 결석 처리
* Being late once = 1/2 of Absence (15min)

### Grades

* Regular Assignments (주간과제) : 30%&#x20;
* Participation (토론참여) :20%
* Attendance (출석) : 20%&#x20;
* Final Project: 30%
* 성적 등급표 Grade Table
* Absolute Grading

| 등급 | 점수       | 평점  |
| -- | -------- | --- |
| A+ | 95 - 100 | 4.5 |
| A0 | 90 - 94  | 4.0 |
| B+ | 85 - 89  | 3.5 |
| B0 | 80 - 84  | 3.0 |
| C+ | 75 - 79  | 2.5 |
| C0 | 70 - 74  | 2.0 |
| D+ | 65 - 69  | 1.5 |
| D0 | 60 - 64  | 1.0 |
| F  | 0 - 59   | 0.0 |

### Office Hour&#x20;

* <novelcollide@gmail.com>
* Arrange by email
* 이메일로 시간/장소(본교/대학로) 약속
* Office : [대학로캠퍼스 교육동 502호](https://goo.gl/maps/5adsJAg1Utv)​/  Hongik University IDAS Rm 502


# Week 01

Introduction and Workflow(Javascript, Text Editor)

## 1. Introduction and Workflow(Javascript, Text Editor)

### A. What is JavaScript ?&#x20;

JavaScript is a programming language for the World Wide Web.  It is a scripting language that a computer reads out your code just like reading a book. You can get the hint by the term, "Script." However it has a callback function which allows to objectify one's function to match other compiling language. C, C++ is a father of all computer language but it needs compiling. Compiling is basically like a baking a bread before eating. On the other hand, the JavaScript is live just like when you are talking to someone and it is great for the World Wide Web, the live web environment.  &#x20;

#### 자바스크립트란?

자바스크립트는 인터넷을 위한 프로그래밍 언어입니다. '스크립트'에서 볼수 있듯이 스크립팅언어로 책을 읽듯 컴퓨터가 코드를 읽습니다. 그러나 콜백 기능이 있어 기능을 오브젝트화 할 수 있습니다. 이는 컴파일링 언어와 대조됩니다. C, C++ 는 컴파일링 언어의 아버지로 컴파일링이 필요합니다. 컴파일링은 빵을 먹기 전에 빵을 굽는 것과 같습니다. 반대로 자바스크립트는 남에게 대화하듯 라이브한 인터넷에 최적화 되어 있습니다. &#x20;

### B. Workflow

HTML -  CSS - JS (Javascript)

![](https://3008602149-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LENuoEyK2N20-qT-Oc8%2F-LHl1FCFU5rwbhMCDNzf%2F-LHl1Gfa-dr-VJ_NedAZ%2Fwhen-im-stuck-nou-start-explaining-your-while-coding-problem-7946286.png?alt=media\&token=ff620e6f-9946-4f66-9b6a-05b0f0efdae4)

Every coding person has its workflow. One might need a [rubber duck](https://rubberduckdebugging.com/) for debugging. Just like you are setting up your desk for studying, you need a work flow.&#x20;

코딩을 하는 모든 사람은  작업흐름이 있습니다. 누구는 [러버덕](https://rubberduckdebugging.com/)이 꼭 필요할 수 도 있습니다. 공부를 하기전 책상을 정리하듯, 코딩엔 작업흐름이 있습니다.&#x20;

### C. How does WWW Work?&#x20;

| **HTML**                  | **CSS**                | **JavaScript**                    |
| ------------------------- | ---------------------- | --------------------------------- |
| Hypertext Markup Language | Cascading Style Sheets | Object Oriented Computer Language |
| Structure                 | Appearance             | Logic                             |
|                           |                        |                                   |
| Where the eyes, mouth?    | Color of eyes, lips... | Open mouth when there is food     |

#### HTML, CSS, JAVASCRIPT

```
<!DOCTYPE html>
<html>
  <head>
	<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width">
    <script src="sketch.js"></script>
    <link rel="stylesheet" href="style.css" type="text/css">
  </head>
  <body> 
  Hello!
  </body>
</html>
```

#### <https://jsfiddle.net/kdoodoo/dmvj1t8e/>

### D. Text Editor

When you write an essay in English what would be your text editor? One would answer "Microsoft Word." Then, why do you use the Microsoft Word? It is because it offers various features like typo checker. Just like the Microsoft Word offers English typo checking feature, there are text editors which help computer language coding.  &#x20;

에세이를 영어로 쓸 때, 어떤  텍스트 에디터를 쓰나요? 누구는 마이크로소프트 워드라고 답할겁니다. 그렇다면 왜 마이크로소프트 워드를 쓰나요? 오타를 잡아주는 기능 같은 것들 때문이라고 답할 것입니다. 마이크로소프트 워드가 영어 오타를 찾아주듯, 컴퓨터 언어 코딩에도 도움이 되는 텍스트 에디터가 있습니다.&#x20;

For Mac and Windows

{% embed url="<https://www.sublimetext.com/>" %}

{% embed url="<https://atom.io/>" %}

{% embed url="<http://brackets.io/>" %}

Web Text Editor

{% embed url="<https://alpha.editor.p5js.org/>" %}

{% embed url="<https://codepen.io/>" %}

{% embed url="<https://jsfiddle.net/>" %}

## 2. Assignment

### Download one of the text editor: Sublime (Recommended)

### and Watch: <https://youtu.be/8j0UDiN7my4>

##

##


# Week 02

Introduction and Drawing

## Discussion

#### Map of Computer Languages&#x20;

#### <http://www.pfnp.me/wp-content/uploads/2012/11/programming-language-history2.png>

#### Popular Languages these days

#### <https://www.computerscience.org/resources/computer-programming-languages/>

#### <https://spectrum.ieee.org/static/interactive-the-top-programming-languages-2018>

## 1. What would be a computer programming project? &#x20;

{% embed url="<http://hint.fm/wind/>" %}

{% embed url="<https://www.youtube.com/watch?v=1ZPJ0U_kpNg>" %}

## 2. Server-side vs. client-side

What is server? Service!

What is client? User!

## 3. CDN and LOCAL

### A. CDN : Content Delivery Network

#### What is CDN?   <https://www.cloudflare.com/learning/cdn/what-is-a-cdn/>

#### What is CDN?   <https://cdnjs.com/about>

#### p5.js  :  <https://cdnjs.com/libraries/p5.js>

```
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.6.1/p5.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.6.1/addons/p5.dom.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.6.1/addons/p5.sound.js"></script>

```

### B. Local :  Open up a new folder and Download file

{% file src="/files/-LJHaY9tvGLeV5sXXuCY" %}
Start.zip
{% endfile %}

### C. Live Coding

#### Go to <https://alpha.editor.p5js.org/>  (Recommended)

**Go to** [**https://jsfiddle.net/kdoodoo/fcsv9kw2/**](https://jsfiddle.net/kdoodoo/fcsv9kw2/)

## 4. LET'S START WITH P5.JS

### A. function setup() and function draw()

```
function setup()
```

function setup() is static, not changing over time.&#x20;

```
function draw()
```

function draw() is continuously changing over time.

### B. Canvas in the web browser

![](https://3008602149-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LENuoEyK2N20-qT-Oc8%2F-LMZvSAhJJC4TGU6Z4SQ%2F-LMZz3Wab1heHvPBKrRv%2F%ED%94%84%EB%A0%88%EC%A0%A0%ED%85%8C%EC%9D%B4%EC%85%981.png?alt=media\&token=a5c4de5d-4616-4329-a2fb-042a1d0b79ef)

Unlike mathematical quadrant origins, the origin (0,0) of the web browser canvas is at the top-left corner.

### C. SHAPES

#### point()

```
point(30, 20);
```

#### line()

```
line(30, 20, 85, 75);
stroke(126,0,0);
```

#### ellipse()

```
fill(80);
ellipse(56, 46, 55, 55);
```

#### rect()

```
stroke(0,0,255);
fill(0,0,255);
rect(30, 20, 55, 55);
```

#### triangle()

```
fill(10,200,35,0.6);
triangle(30, 75, 58, 20, 86, 75);
```

### D. COLOR

#### color()

```
var inside = color(204, 102, 0);

fill(inside);
triangle(30, 75, 58, 20, 86, 75);
```

### E. CONSOLE

#### console.log()

```
console.log("hello");
```

#### print()

```
print("Hello, World");
```

## 5. How to upload your project?

#### A. Documentation:&#x20;

#### <https://wordpress.com/> (recommended)

Signup for the wordpress and upload your project one by one every week. (recommended)&#x20;

Wordpress is free and easy to use.&#x20;

#### B. How to share your code easily.&#x20;

You can share your code via Gist. \
​<https://gist.github.com/>

## 6. In-class Activity

#### A. Draw a self-portrait of yourself.&#x20;

## 7. Assignment

#### A. Find a project that works with the computer programming.&#x20;

#### - Recommended: Improve OR Add additional objects to your in-class self-portrait.&#x20;

#### (eg. adding favorite animal, favorite food and etc)

#### B. Submit your in-class activity and the assignment.&#x20;

#### Here : <https://goo.gl/forms/XHD9edphZxcGF0lb2>


# Week 03

Animation, Variables, Interaction

## 1. Variable&#x20;

#### number

```javascript
var s = 90; 
```

#### string

```javascript
var name = "don"
```

#### object

<https://editor.p5js.org/kdoodoo/sketches/S1eJIVpdQ>

```
var circle = {
    radius: 13,
    x: 60,
    y: 100
};


circle.radius 
circle.x
circle.y
```

#### array

```
var num = [1, 2, 3];


num[0]
num[1]
num[2]
```

## 2. Let and Variable

**let** allows you to declare variables that are limited in scope to the block, statement, or expression on which it is used. This is unlike the var keyword, which defines a variable globally, or locally to an entire function regardless of block scope.

```
let x = 1;
```

<https://editor.p5js.org/kdoodoo/sketches/rJ1s90hdm>

## 3. console.log()&#x20;

####

![](https://3008602149-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LENuoEyK2N20-qT-Oc8%2F-LJXnZTau5XD5k8DWc-X%2F-LJXnkZaYT9YKuPSW2LA%2FScreen%20Shot%202018-08-10%20at%2016.48.12.png?alt=media\&token=a8bbbd6c-ba19-43b6-a4ad-d231129758c9)

## 4. Animation&#x20;

#### What is animation? Either something that moves by the intention of the user or something that moves automatically for the better interaction in functionality and emotions.

#### <https://jsfiddle.net/kdoodoo/c0esafg4/>

<https://editor.p5js.org/kdoodoo/sketches/Hy1BtR3u7>

#### random()

```
// random in number
random(50); // range in 0 to 50
random(-50, 50); // range in -50 to 50 


//random in  string
var words = ['a', 'b', 'c', 'd'];
var word = random(words); // select a random word from a,b,c,d
```

[**https://editor.p5js.org/kdoodoo/sketches/HJlfT03um**](https://editor.p5js.org/kdoodoo/sketches/HJlfT03um)

#### mouseX, mouseY

<https://jsfiddle.net/kdoodoo/53graLpd/>

```
  ellipse(mouseX, mouseY, 24, 24);
  ellipse(mouseX, mouseY,mouseX, mouseY);
```

#### map()

<https://editor.p5js.org/kdoodoo/sketches/H1gGsETOQ>

```
map(which value had current range,currentMin,currentMax,newMin,newMax)
```

#### mousePressed()

<https://editor.p5js.org/kdoodoo/sketches/ByYWeS6uX>

```
function mousePressed() {
};
```

## 5. Assignment

#### Make any project that interacts with the user.

#### Submit here: <https://goo.gl/forms/zlr9n5bNbT0iPTyJ2>

#### Always submit link as an editor view from now on.

![](https://3008602149-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LENuoEyK2N20-qT-Oc8%2F-LMfcC6WgBqYVfXeGQWs%2F-LMfcFlgdNBMseO3wwW4%2FScreen%20Shot%202018-09-18%20at%2016.41.38.png?alt=media\&token=0ac4abca-d84d-4002-9459-a8b772e8dc3b)

| 이상은            | <https://jsfiddle.net/53graLpd/30/#>                                     |
| -------------- | ------------------------------------------------------------------------ |
| 이의진            | <https://editor.p5js.org/full/ByYWeS6uX>                                 |
| 이가하            | <https://editor.p5js.org/full/Byj_iMRdQ>                                 |
| 이다영            | <https://editor.p5js.org/full/rJPBA0Vu7>                                 |
| Celso Urroz    | <https://editor.p5js.org/celso/sketches/rJmulVLY7>                       |
| Lukas Merten   | <https://editor.p5js.org/lukasmerten321123@gmail.com/sketches/BybhwppY7> |
| Alexis Sechoir | <https://editor.p5js.org/full/Syd2KgCF7>                                 |
| 이재은            | <https://editor.p5js.org/gojenn90@gmail.com/sketches/rJQLTH15Q>          |
| 김다인            | <https://editor.p5js.org/dain5832/sketches/BJWoBskcQ>                    |
| 김지원            | <https://editor.p5js.org/dion/sketches/rk8zWLCKQ>                        |


# Week 04

Conditional Statements, Repeat Loops

{% embed url="<https://youtu.be/YsIHQkeZy1Q>" %}

### Back Then Schematic  >>>  Now Faster to Prototype!  >>> Real World!

### Was there IoT in 2009??

{% embed url="<https://youtu.be/M66ZU2PCIcM>" %}

### Conditional Statements

How does computer language make different decision? So far we learned **setup() : something happens at the start, draw(): something same event happens over and over.** Also we  learned event function like : **mousepressed.** &#x20;

### Something changes over time.

Today we want to learn something that happens different from previous event. For example, the color of the ellipse changes after one draw, the position of the rectangle change over based on the position of the user's mouse.&#x20;

## Conditional Logic/ Control Structure

if something is true : Do this code&#x20;

if something is  not true : Don't do this code&#x20;

### Boolean Expression ([George Boole](https://en.wikipedia.org/wiki/George_Boole)) : True / False

![](https://3008602149-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LENuoEyK2N20-qT-Oc8%2F-LNhaUrKKxpOAHFRmp1F%2F-LNhaZQYVyil7Vsot0jT%2FTruth_table_for_AND%2C_OR%2C_and_NOT.png?alt=media\&token=cb05d8a7-003e-4dcb-b297-4b48ccca00db)

![](https://3008602149-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LENuoEyK2N20-qT-Oc8%2F-LNhaUrKKxpOAHFRmp1F%2F-LNhaksWJ153WjETCWdR%2Fscr0360-02.jpg?alt=media\&token=2f37cfa7-e712-4b6e-8b65-4b352f60685c)

| TRUE | FALSE |
| ---- | ----- |
| 1    | 0     |

### Relational Operator

5 > 8 : False

7 < 210 : True

| <            | >         | =        |
| ------------ | --------- | -------- |
| Greater Than | Less Than | Equal To |

## if statement

```
if (boolean expresssion here is true){
    this code here exectutes
};
```

```
if (1 < 8){
   fill(255,0,0);
}; 
```

```
if (mouseX > 100){
    fill(255,0,0);
}       
```

#### <https://editor.p5js.org/kdoodoo/sketches/HJ-xqZyc7>

### Computer Language != Mathematical Expression&#x20;

```
var x = 90; // Assignment
if (x == 90); // Conditional Expression
```

| Greater Than | Less Than | Equal To | Not Equal To | <p>Greater Than </p><p>or Equal To</p> | <p>Less Than or </p><p>Equal To</p> |
| ------------ | --------- | -------- | ------------ | -------------------------------------- | ----------------------------------- |
| <            | >         | =        | ≠            | ≤                                      | ≥                                   |
| <            | >         | ==       | !=           | <=                                     | >=                                  |

| + | ‒ | ×  | ÷ |
| - | - | -- | - |
| + | - | \* | / |

### In-class

#### Let's make it bouncing!     Console.log()

#### <https://editor.p5js.org/kdoodoo/sketches/SJ17zE19Q>

#### Working Great!

## if-else statement

```
if( something is true){
    execute this code
}
else{
 execute this code
}
```

```
if (mouseX > 100){
 fill(255,0,0);
 }
 else
 {
 fill(0,0,255);
 }
```

#### <https://editor.p5js.org/kdoodoo/sketches/H1Ybrsk9X>

### if - else if - else if statement

```
if (mouseX > 150){
 fill(255,0,0);
 }
 else if(mouseX >120) // 1 else if
 {
 fill(255,0,255);
 }
 else if(mouseX >50) // 2 else if
 {
 fill(0,0,0);
 }
 else
 {
 fill(255,255,255);
 }
```

#### <https://editor.p5js.org/kdoodoo/sketches/Bk3fDjycm>

### if - if - if statement

```
if (mouseX > 150){
 fill(255,0,0);
 }
 if(mouseX >120) // 1 else if
 {
 fill(255,0,255);
 }
 if(mouseX >50) // 2 else if
 {
 fill(0,0,0);
 }
```

### AND&#x20;

#### <https://editor.p5js.org/kdoodoo/sketches/By4q0tx5X>

```
if (100 < mouseX AND mouseX < 200){ }
if (100 < mouseX && mouseX <200){ }
```

#### 100 < mouseX AND mouseX < 200

```
var x,y;

function setup() {
  createCanvas(400, 400);
 
}


function draw() {
  background(255,255,255);
  stroke(50);
  noFill();
  
  if(100 < mouseX && mouseX < 200 ){  
    
  fill(255,0,210);
  ellipse(200, 200, 50, 50);

  }

}
```

### OR

```
if (100 < mouseX OR mouseX < 200){ }
if (100 < mouseX || mouseX <200){ }
```

#### x < 0  OR  x > height  &#x20;

```
var x = 0;
var y = 0;
var speed = 3;

function setup() {  
  createCanvas(400, 400); }

function draw() {  
  background(255,255,255);  
  stroke(50);  noFill();    
  fill(255,0,210);  
  ellipse(200, y, 50, 50); 
  
  if(y < 0 || y > height ){      
    speed = speed * -1  
  }  
   y = y + speed; }
```

#### <https://editor.p5js.org/kdoodoo/sketches/H1Y3DjJ5X>

## Repeat Loops

```
if(something is ture){
   Do this code
}
// Happened ONCE and Move On!!
```

### While ...하는 동안

```
while(something is true){
  Do this code
}
//Continue this code over, over, onv and over...
```

#### Ellipses one by one....&#x20;

```
function setup() {
  createCanvas(400, 400);
}

function draw() {
  background(220);
  
  var x = 0; //local variable
  
  ellipse(x,50,25,25);
  x = x + 50;
  
  ellipse(x,50,25,25);
  x = x + 50;

  ellipse(x,50,25,25);
  x = x + 50;

  ellipse(x,50,25,25);
  x = x + 50;

}
```

### While loop

#### <https://editor.p5js.org/kdoodoo/sketches/Bk90PLeq7>

```
var x = 0; 
while(x < width){
    ellipse(x,50,25,25);
    x = x + 50;
}
```

#### While loop has 3 components:

* Initial Variable&#x20;

```
var x = 0; 
```

* Boolean Condition Test

```
while(x < width)
```

* Incremental  Function

```
 x = x + 50;
```

### For Loop

```
for( var x = 0 ; x < width ; x = x + 50){ 
}
```

```
function setup() {
  createCanvas(400, 400);
}

function draw() {
  background(220);
  
for( var x = 0 ; x < width ; x = x + 50){
  ellipse(x,50,25,25);    
  }
}
```

#### <https://editor.p5js.org/kdoodoo/sketches/B1EHdUlqX>

#### Incremental Methods

```
x = x + 50
x += 50
```

```
x = x + 1
x++
```

### For - For Loops

#### <https://editor.p5js.org/kdoodoo/sketches/HJnQTLeq7>

```
for( var x = 20 ; x < width ; x = x + 50){
  for( var y = 20; y < height; y += 50){
    ellipse(x,y,20,20);    
  }
 }
```

####

## Assignment

Make a sketch using both **Conditional Statements** and **Repeat Loops.**

#### <https://goo.gl/forms/PcRNuwlkt3quGLng2>


# Week 05

Functions: the basics

## We have used functions before......

## 1. Function we are calling 'ellipse function" to make ellipse..

```
ellipse(100,100,100,100); 
```

#### But we did not make/define this function as "ellipse(x, y, width, height){  .... .... ...}"

#### We are just using the function!!

## 2. Function setup started functioning when the page opens without calling it...

#### But we made/defined it.

```
function setup() {
  createCanvas(500, 500);  
}
```

## Both are functions but it was either 'Defined Previously' OR 'Functioning before Calling it.'

#### These are library functions. It is done by P5js library.  For example, tone.js is a musical library which has functions already defined by the developer, [Yotam Mann ](https://yotammann.info/)

#### <https://tonejs.github.io/>

## Function needs "Define" and "Call"

#### function setup()

{% hint style="success" %}

#### We defined setup:

```
function setup(){    
  ellipse(10,10,10,10);
 }
```

{% endhint %}

{% hint style="danger" %}

#### But we did not call:&#x20;

```
 setup();
 
```

{% endhint %}

#### ellipse()

{% hint style="danger" %}
**We did not define:**

```
 function ellipse(){
      stroke(10,10,10,10);
      rotate(1,1,1,10); 
 }

```

{% endhint %}

{% hint style="success" %}
**But we called:**&#x20;

```
ellipse(10,10,10,10);

```

{% endhint %}

### These are library functions... we are using p5.js library.

## Let's 'Define' and 'Call' Your Own Function.&#x20;

1. Modular&#x20;
2. Reusable

### We made ball bouncing with ball object.

```
var ball = {    
  x : 300,    
  y : 200,    
  xspeed : 4,    
  yspeed : -5
}

function setup() {
  createCanvas(400, 400);
}

function draw() {
  background(220);
	ellipse(ball.x,ball.y,20,20);
  
  
  	if (ball.x>width || ball.x<0){
    ball.xspeed = ball.xspeed*-1;
    }
  	if (ball.y>height || ball.y<0){
    ball.yspeed = ball.yspeed*-1;
    }
  
    ball.y = ball.y + ball.yspeed;
    ball.x = ball.x + ball.xspeed;
  
}
```

#### <https://editor.p5js.org/kdoodoo/sketches/SJyXQ_g5m>

### Here we have 3 functions:

1. Drawing
2. Bouncing
3. Moving

### Let's make with functions.

#### function move

```
function move(){
  ball.y = ball.y + ball.yspeed;
  ball.x = ball.x + ball.xspeed;
}
```

#### function bounce

```
function bounce(){
	if (ball.x>width || ball.x<0){
    ball.xspeed = ball.xspeed*-1;
    }
  	if (ball.y>height || ball.y<0){
    ball.yspeed = ball.yspeed*-1;
    }
}
```

#### function display

```
function display(){
  	ellipse(ball.x,ball.y,20,20);
}
```

#### <https://editor.p5js.org/kdoodoo/sketches/ByW1H_x9X>

```
var ball = {    
  x : 300,    
  y : 200,    
  xspeed : 4,    
  yspeed : -5
}

function setup() {
  createCanvas(400, 400);
}

function draw() {
  background(220);  
  move();
  bounce();
  display();
}

function move(){
  
    ball.y = ball.y + ball.yspeed;
    ball.x = ball.x + ball.xspeed;
}

function bounce(){
  	if (ball.x>width || ball.x<0){
    ball.xspeed = ball.xspeed*-1;
    }
  	if (ball.y>height || ball.y<0){
    ball.yspeed = ball.yspeed*-1;
    }
}

function display(){
  	ellipse(ball.x,ball.y,20,20);
}
```

## **Define and Call**

#### Define

{% hint style="success" %}
**Define functions:**

```
function move(){
  
    ball.y = ball.y + ball.yspeed;
    ball.x = ball.x + ball.xspeed;
}

function bounce(){
  	if (ball.x>width || ball.x<0){
    ball.xspeed = ball.xspeed*-1;
    }
  	if (ball.y>height || ball.y<0){
    ball.yspeed = ball.yspeed*-1;
    }
}

function display(){
  	ellipse(ball.x,ball.y,20,20);
}
```

{% endhint %}

#### Call

{% hint style="success" %}
**Call functions:**

```
  move();
  bounce();
  display();
```

{% endhint %}

## Assignment

### Make a project with your own function.

#### <https://goo.gl/forms/FslZlLy46wAns0HI3>

## Schedule for Next Week Thursday OR Friday

#### 보강 시간 입력 바랍니다. 다음 주  목/금  중 가능시간

#### <https://goo.gl/forms/WFa0kI75GirvCU8B3>


# Week 06

Function II,  Object and Array

## 1. Function with Parameters

#### Define with Parameter

```
fxunction sun(x,y,rays){
   ellipse(x,y,20,20);
      for(i = 0; i < rays; i++){
          rect(x-30,y+20,30,30);        
      }
}
```

#### Call with Parameters

```
 sun(10,10,100); 
```

#### You can call many more

```
 sun(10,10,100); 
 sun(20,20,110); 
 sun(30,30,120); 
 sun(40,40,130); 
```

## Example

#### Let's draw a lolipop..

```
function setup() {
  createCanvas(400, 400);
}

function draw() {
  background(220);
  
  fill(25,20,255);
  rect(90,120,20,100);
  
  fill(255,20,0);
  ellipse(100,100,100,100);

}

```

<https://editor.p5js.org/kdoodoo/sketches/HyAmvbGj7>

#### Lolipop with 'define' and 'call' function lolipop()

```
function setup() {  
  createCanvas(400, 400);
}

function draw() {  
  background(220);  
  lolipop();
  
  }
  
function lolipop(){    
  fill(25,20,255); 
  rect(90,120,20,100);    
  fill(255,20,0);  
  ellipse(100,100,100,100);
  
}
```

### Now lolipop function with parameters

#### Define with parameters: x, y, diameter&#x20;

```
function lolipop(x,y,diameter){    
  fill(25,20,255); 
  rect(x-10,y,20,100);
  
  fill(255,20,0);  
  ellipse(x,y,diameter,diameter);
}
```

#### Call with parameters: 100, 120, 150, 200, 300 .....

```
  lolipop(100,100,50);
  lolipop(200,120,100);
  lolipop(300,200,150);
```

#### <https://editor.p5js.org/kdoodoo/sketches/HJA4tbGsm>

```
function setup() {  
  createCanvas(400, 400);
}

function draw() {  
  background(220); 
  
  lolipop(100,100,50);
  lolipop(200,120,100);
  lolipop(300,200,150);


}
  
function lolipop(x,y,diameter){    
  fill(25,20,255); 
  rect(x-10,y,20,diameter);
  
  fill(255,20,0);  
  ellipse(x,y,diameter,diameter);
  
  
}
```

## 2. Function that returns a value

#### No value returned

```
elipse(10,10,10,10);  // no value returned just drawing a circle.
```

#### Value returned

```
random(0,255);    // it returns VALUE/NUMBER between 0 - 255.
```

### Let's Define with Parameter AND Return

```
function farenToCels(ff){
		var calculation = (ff - 32) *  (5/9);
    return calculation;    

}
```

### Let's Call

```
 var room = farenToCels(100);
 print(room);  // Will return a value
```

#### <https://editor.p5js.org/kdoodoo/sketches/HyLwxmfiQ>

```
function setup() {
  createCanvas(400, 400);
  var room = farenToCels(100);
  print(room);
  
  
  var ok = celsToFaren(37.777);
  print(ok);
  
}

function draw() {
  background(220);
}


function farenToCels(ff){
	var calculation = (ff - 32) *  (5/9);
    return calculation;    

}


function celsToFaren(cc){
	var calculation = (cc *(9/5) ) + 32;
    return calculation;    

}
```

## 3. Object

#### We learned simple object.

```
var bubble = {
    x:200,
    y:200
}
```

```
bubble.x;
bubble.y;
```

#### Object with function

```
var bubble = {
    x:200,
    y:200,
    display: function(){
        ellipse(this.x,this.y, 30,30);
    }
}
```

#### Function in the object  uses this.x and this.y &#x20;

```
ellipse(this.x,this.y, 30,30);
```

#### How to read object elements.

```
bubble.x;
bubble.y;

bubble.display();
```

## Example

### Define functions inside of the object : display and move

```
var bubble = {
  x:100,
  y:200,
  display: function(){
  		ellipse(this.x, this.y, 20,20);
  },
  move: function(){
  		this.x = this.x + random(-1,1);
    	this.y = this.y + random(-1,1);
  },
}
```

### Call functions inside of the object: bubble.display() and bubble.move()&#x20;

```
function setup() {
  createCanvas(400, 400);
}

function draw() {
  background(220);
	
  bubble.display();
  bubble.move();
}
```

#### <https://editor.p5js.org/kdoodoo/sketches/rk-AvQfim>

## 4. Array

#### List of values in the \[    ]

```
var number = 3;
var numbers = [5,3,4,3];
```

#### Similar to object in the {  }

```
var object = {
    x:3,
    y:5,
}
```

#### Array has indices, indexes    : 0, 1, 2, 3, 4, 5, 6....

```
var numbers = [2,4,7,-3]; // We have 0,1,2,3 indexes
```

### A. Access Values in the Array

```
var numbers = [2,4,7,-3]; // We have 0,1,2,3 indexes

var a = numbers[0];  // 2
var b = numbers[1];  // 4
var c = numbers[2];  // 7
var d = numbers[3];  // -3
```

```
var numbers = [100,50,90,70];
var number = 30;

function setup() {
  createCanvas(400, 400);
}

function draw() {
  background(220);
  fill('red');
  ellipse(100,150, number, number);

  fill('blue');
  ellipse(200,250, numbers[1], numbers[1]);
  
}
```

#### <https://editor.p5js.org/kdoodoo/sketches/Sk4k1NGj7>

### B. Array can have numbers, strings, objects.

```
var world = ["Spain", "Canada", "Austrailia", "Japan", "United_States", "Korea"];
print(world[4]);  // United_States
```

## Example

```
var world = ["Spain", "Canada", "Austrailia", "Japan", "United_States", "Korea"];
var indexxx = 0;

function setup() {  
  createCanvas(400, 400);
  }

function draw() {  
  background(220);      
  textSize(32);  
  text(world[indexxx], 40,300);  
  }

function mousePressed(){	
  indexxx = indexxx + 1;	

  if(indexxx == 4){	  // We NEVER get to Korea !!
    indexxx = 0;	    // indexxx == world.length
  }
}
```

#### <https://editor.p5js.org/kdoodoo/sketches/H1jPb4Mom>

### world.length gives the last index of the array&#x20;

```
if(indexxx == world.length) // 6
```

## Example

#### Drawing 4 ellipses

```
var numbers = [100,50,90,70];
var number = 30;

function setup() {
  createCanvas(400, 400);
}

function draw() {
  background(220);
  fill('red');
  ellipse(50,200, numbers[0], numbers[0]);
  ellipse(150,200, numbers[1], numbers[1]);
  ellipse(250,200, numbers[2], numbers[2]);
  ellipse(350,200, numbers[3], numbers[3]);  
  
}
```

#### Drawing 4 ellipses with for loop.

```
var numbers = [100,50,90,70];
var number = 30;

function setup() {
  createCanvas(400, 400);
}

function draw() {
  background(220);
  fill('red');
  
  for(i = 0;i<4;i++){           
  		ellipse(100*i+50,200, numbers[i], numbers[i]);
  }
}
```

#### As we discussed, we can use .length here:

```
for(i = 0;i<numbers.length;i++){            
  		ellipse(100*i+50,200, numbers[i], numbers[i]);
  }
```

#### <https://editor.p5js.org/kdoodoo/sketches/By0YvVfoQ>

## 5. Array and Object (w/ Functions)

```
var bubble ={
	x:100,
  y:200,
  display: function(){
  		ellipse(this.x, this.y, 20,20);
  },
  move: function(){
  		this.x = this.x + random(-1,1);
    	this.y = this.y + random(-1,1);
  },
};
```

## Example

```
var bubbles = []; //empty

function setup() {
  createCanvas(400, 400);

for(i = 0; i < 500; i++){
	bubbles[i] ={
	    x:random(0,width),
  	    y:random(0,height),
  	    display: function(){
  		    ellipse(this.x, this.y, 20,20);
  	    },
     	move: function(){
  		this.x = this.x + random(-1,1);
    	this.y = this.y + random(-1,1);
        },
     }
  }
}

function draw() {
  background(220);
	
  for(i=0;i<bubbles.length;i++){
    bubbles[i].display();
    bubbles[i].move();
  }
}
```

#### <https://editor.p5js.org/kdoodoo/sketches/S1cjoVGs7>

## 6. It is complex :(   So, Let's do 'Constructor Functions'

Make(construct) object

```
var bubbles = []; //empty

function setup() {
  createCanvas(400, 400);

  for(i = 0; i < 500; i++){
	  bubbles[i] = new bubble();
  }
}

function draw() {
  background(220);
	
  for(i=0;i<bubbles.length;i++){
    bubbles[i].display();
    bubbles[i].move();
  }

}
  
function bubble(){
  this.x = random(0,width);
  this.y = random(0,height);
  
  this.display = function(){
  ellipse(this.x,this.y,10,10);
  }
  this.move = function(){
  this.x = this.x + random(-1,1);
  this.y = this.y + random(-1,1);
  
  }
}
```

#### Constructor function is to make a 'new' object.

```
function bubble(){
  this.x = random(0,width);
  this.y = random(0,height);
  
  this.display = function(){
  ellipse(this.x,this.y,10,10);
  }
  this.move = function(){
  this.x = this.x + random(-1,1);
  this.y = this.y + random(-1,1);
  
  }
}
```

#### <https://editor.p5js.org/kdoodoo/sketches/ryzlPfmoX>

## 7. Add and Remove object for the array.

```
push(value that goes into the last index);
splice(index you want to remove, the number of indexes you want to delete after);
```

#### We can add value to the array like this:

```
numbers = [4, 23, 42, 1, 4, 24]
//index    0  1   2   3  4  5
numbers[6] = 12; 
//Only if when you know the last index is 5
```

### A. So we use push()

```
numbers = [4, 23, 42, 1, 4, 24]
//index    0  1   2   3  4  5
numbers.push(12);
```

```
numbers = [4, 23, 42, 1, 4, 24, 12]
//index    0  1   2   3  4  5   6
numbers.push(12);
```

### Add bubble into bubbles\[ ] by push()

```
var bubbles = []; //empty

function setup() {
  createCanvas(400, 400);
}

function mousePressed(){
		bubbles.push(new bubble(mouseX,mouseY));
}

function mouseDragged(){
		bubbles.push(new bubble(mouseX,mouseY));
		//var b = new bubble(mouseX,mouseY);
		//bubbles.push(b);
}

function draw() {
  background(220);
	
  for(i=0;i<bubbles.length;i++){
    bubbles[i].display();
    bubbles[i].move();
  }

}
  
function bubble(xx,yy){
  this.x = xx;
  this.y = yy;
  this.display = function(){
  ellipse(this.x,this.y,10,10);
  }
  this.move = function(){
  this.x = this.x + random(-1,1);
  this.y = this.y + random(-1,1);
  
  }
}
```

#### <https://editor.p5js.org/kdoodoo/sketches/H1DifHGiQ>

### B. Splice is checking code and remove the value.

```
var bubbles = []; //empty

function setup() {
  createCanvas(400, 400);

}

function mousePressed(){
		bubbles.push(new bubble(mouseX,mouseY));
}

function mouseDragged(){
		bubbles.push(new bubble(mouseX,mouseY));
}


function draw() {
  background(220);
	
  for(i=0;i<bubbles.length;i++){
  // for(i=bubbles.length -1;i>=0; i--){

    bubbles[i].display();
    bubbles[i].move();
    if(bubbles[i].delaytime < 0){
       bubbles.splice(i,1);
       }
  }

}
  
function bubble(xx,yy){
  this.x = xx;
  this.y = yy;
  this.delaytime = 255;
  
  this.display = function(){
  fill(this.delaytime);
  ellipse(this.x,this.y,20,20);
  }
  this.move = function(){
  this.x = this.x + random(-1,1);
  this.y = this.y + random(-1,1);
  this.delaytime = this.delaytime - 1;
  }
}
```

#### <https://editor.p5js.org/kdoodoo/sketches/BJ8byLMjQ>

```
for(i=0;i<bubbles.length;i++){
// Starting from the start will skip
for(i=bubbles.length -1 ; i>=0 ;  i--){
//Starting from the end will not skip
```

#### Splice (index, how many items from index)

```
numbers = [42, 370, 59, 438, 6, -93, 502]
//index     0   1   .2.   3  4    5    6
numbers.splice(2,1);
```

```
numbers = [42, 370, 438, 6, -93, 502]
//index     0    1  .2.  3   4    5    
```

## Assignment: if Confident > with Array.

#### <https://goo.gl/forms/iacdNBqXLv3gi4X82>


# Week 07

Multiple JS, DOM, Events and Callback Function

{% embed url="<https://youtu.be/Z-5cVpWhp30>" %}

{% embed url="<https://youtu.be/nKzrupwnI0M>" %}

{% embed url="<https://vimeo.com/244397751>" %}

Week6 #7

## 1. Multiple JS files

#### <https://editor.p5js.org/kdoodoo/sketches/B1yC6roi7>

#### You can keep your file in a separate js file.&#x20;

## 2. DOM element and Callback Function

#### Document Object Model (**DOM**)

![](https://3008602149-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LENuoEyK2N20-qT-Oc8%2F-LPQj8HOYlM5oDrOB-bW%2F-LPRAvxN5dSfViwUXjf7%2Fdom-body-a.png?alt=media\&token=87c0dbc7-8e37-4de5-9845-bcc4dc3567e4)

![](https://3008602149-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LENuoEyK2N20-qT-Oc8%2F-LPQj8HOYlM5oDrOB-bW%2F-LPRB61R6fayLxZYdXjP%2Fpic_htmltree.gif?alt=media\&token=27cf34cb-06a1-4f42-a6b4-b01718dd80cd)

```
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.7.2/addons/p5.dom.min.js"></script>
```

## P5.dom library

#### <https://p5js.org/reference/#/libraries/p5.dom>

### Example

#### <https://editor.p5js.org/kdoodoo/sketches/rJfcgPsjm>

### Example

#### <https://editor.p5js.org/kdoodoo/sketches/rJ9XZwijm>

### Example

#### <https://editor.p5js.org/kdoodoo/sketches/SJfe7PjsX>

####

## Callback function

#### Callback function is simple that&#x20;

1. &#x20;**The function createButton is attached to the variable button.**
2. **And when the button is pressed, I want changeColor function os called.**

   ```
   button.mousePressed(changeColor);
   ```

### Callback is simply one function is called and the other function is continuously called.&#x20;

```
  var button = createButton("Color??");
  button.mousePressed(changeColor);
```

### Example

#### <https://editor.p5js.org/kdoodoo/sketches/rJS8rDjsm>

## Assignment

1. Have multiple .js file (at least 2)
2. Have DOM element (it can be anything, button, slider, check, wordform, etc)

#### <https://goo.gl/forms/BLQxwU8giiMkDzxk2>


# Week 08

Data

## JSON (JavaScript Object Notation)

```
{
  "title": "Oldboy",
  "director": "Park Chan-wook",
  "year": 2003,
  "rating": 8.4
}
```

```
{
  "firstName": "John",
  "lastName": "Smith",
  "age": 25,
  "address": {
    "streetAddress": "21 2nd Street",
    "city": "New York",
    "state": "NY",
    "postalCode": "10021"
  },
  "phoneNumber": [
    {
      "type": "home",
      "number": "212 555-1234"
    },
    {
      "type": "fax",
      "number": "646 555-4567"
    }
  ],
  "gender":{
    "type":"male"
  }
}
```

{% embed url="<https://www.w3schools.com/js/js_json_intro.asp>" %}

### We have played with JSON already.......

```
var ball = {    
  x : 300,    
  y : 200,    
  xspeed : 4,    
  yspeed : -5
}
```

#### When we access the values in the JSON object.

```
var person = {
  "firstName": "John",
  "lastName": "Smith",
  "age": 25,
  "address": {
    "streetAddress": "21 2nd Street",
    "city": "New York",
    "state": "NY",
    "postalCode": "10021"
  },
  "phoneNumber": [
    {
      "type": "home",
      "number": "212 555-1234"
    },
    {
      "type": "fax",
      "number": "646 555-4567"
    }
  ],
  "gender":{
    "type":"male"
  }
}
```

```
person.fisrtName
person.lastName
person.address.streetAddress
```

#### <https://editor.p5js.org/kdoodoo/sketches/HkMKXi42Q>

### Let's make your own .json file.

#### food.json

```
{
 "name":"curry",
 "red": 100,
 "green":200,
 "blue":100,
}
```

#### Let's validate

#### <https://jsonlint.com/>

```
{
	"name": "curry",
	"red": 100,
	"green": 200,
	"blue": 100
}
```

#### <https://editor.p5js.org/kdoodoo/sketches/Hk-YisNnm>

### JSON with \[Array]

<https://github.com/dariusk/corpora/tree/master/data>

```
{
	"description": "A list of car manufacturers.",
	"cars": [
		"Abarth",
		"Alfa Romeo",
		"Aston Martin",
		"Audi",
		"Bentley",
		"BMW",
		"Bugatti",
		"Cadillac",
		"Caparo",
		"Caterham",
		"Chevrolet",
		"Chrysler",
		"Citroen",
		"Dacia",
		"Daihatsu",
		"Dodge",
		"Ferrari",
		"Fiat",
		"Fisker",
		"Ford",
		"Gordon Murray",
		"Holden",
		"Honda",
		"Hummer",
		"Hyundai",
		"Infiniti",
		"Jaguar",
		"Jeep",
		"Kia",
		"Koenigsegg",
		"KTM",
		"Lamborghini",
		"Lancia",
		"Land Rover",
		"Lexus",
		"Lotus",
		"Maserati",
		"Maybach",
		"Mazda",
		"McLaren",
		"Mercedes-Benz",
		"MG",
		"Mini",
		"Mitsubishi",
		"Morgan",
		"Nissan",
		"Noble",
		"Pagani",
		"Peugeot",
		"Porsche",
		"Proton",
		"Renault",
		"Rolls-Royce",
		"Seat",
		"Skoda",
		"Smart",
		"Subaru",
		"Suzuki",
		"Tata",
		"Tesla Motors",
		"Toyota",
		"Vauxhall",
		"VW",
		"Volvo"
	]
}
```

### We use   AAA.BBB\[ i ] &#x20;

#### i as an index

```
var maker = carmaker.cars[4]; // Bentley
```

#### <https://editor.p5js.org/kdoodoo/sketches/B1Gxvn42m>

## API (Application programming interface)

{% embed url="<https://en.wikipedia.org/wiki/Application_programming_interface>" %}

#### It can be anything like CSV, XML, TXT, PDF but we want "JSON!"&#x20;

#### Why?? J = Javascript

## JSON VIEWER

#### Before >>>

![](https://3008602149-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LENuoEyK2N20-qT-Oc8%2F-LPxUisnhUFxKJKtn2Rw%2F-LPxUp1iczYmG1MvgS-O%2F%EC%A0%9C%EB%AA%A9%20%EC%97%86%EC%9D%8C2666.png?alt=media\&token=5a436377-a0e3-4cea-803d-1edae82f1be1)

#### After >>>

![](https://3008602149-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LENuoEyK2N20-qT-Oc8%2F-LPxQkBotl0lnpEnRqkI%2F-LPxUb8kE2ad4Ac63ZEy%2F%EC%A0%9C%EB%AA%A9%20%EC%97%86%EC%9D%8C2.png?alt=media\&token=74fb426d-909f-4fc6-a559-4aab31d19795)

#### <https://samples.openweathermap.org/data/2.5/forecast?q=M%C3%BCnchen,DE&appid=b6907d289e10d714a6e88b30761fae22>

{% embed url="<https://chrome.google.com/webstore/search/json>" %}

![](https://3008602149-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LENuoEyK2N20-qT-Oc8%2F-LPxVKaSBNPKYkmRphhM%2F-LPxVOI7dQk1VZextFJH%2F%EC%A0%9C%EB%AA%A9%20%EC%97%86%EC%9D%8C26667.png?alt=media\&token=adec1916-c3ce-461d-97b1-9ae3b1b72779)

## Simple API example

{% embed url="<https://openweathermap.org/price>" %}

#### Sign Up here:

#### <https://openweathermap.org/appid>

![](https://3008602149-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LENuoEyK2N20-qT-Oc8%2F-LQ-WZCVaKfrc4b2SdDu%2F-LQ-XX_V8YfhvqKAv1E8%2FScreen%20Shot%202018-10-30%20at%2012.55.13%20AM.png?alt=media\&token=4c2f5fe9-9e24-4918-891a-8ad3b69df612)

### Try it here: Weather in London:

<https://samples.openweathermap.org/data/2.5/weather?q=London,uk>

#### ?q=london,uk

#### ?q=london,uk& \_\_\_\_\_\_\_\_ = \_\_\_\_\_\_\_\_ &\_\_\_\_\_\_\_\_=\_\_\_\_\_\_\_\_\_

<https://samples.openweathermap.org/data/2.5/weather?q=London,uk&appid=e4d37ccc2c4f3977c2e466fa78b38fcb>

#### \&units=metric

#### ?lat=35\&lon=139&#x20;

```
https://api.openweathermap.org/data/2.5/forecast?q=Seoul&APPID=e4d37ccc2c4f3977c2e466fa78b38fcb&units=metric
```

```
https://api.openweathermap.org/data/2.5/forecast?q=Seoul&APPID=e4d37ccc2c4f3977c2e466fa78b38fcb
```

#### <https://editor.p5js.org/kdoodoo/sketches/HJfYl643m>

## Assignment

<https://goo.gl/forms/lZGI0Nf5iW6GT1ei1>


# Week 09

Video and Sound

## Load Images

```
var img;  
var k = 2;

function setup() {
  createCanvas(720, 400);
  
  img = loadImage('images/car' + k + '.jpg');
  console.log(k);
}

function draw() {
  image(img, 0, 0, width, height);
}
```

<https://editor.p5js.org/kdoodoo/sketches/r1nYPIa27>

## Preload()

```
var img;  
var k = 3;


function preload(){
  img = loadImage('images/car' + k + '.jpg');

}


function setup() {
  createCanvas(720, 400);  
}


function draw() {
  image(img, 0, 0, width, height);
}

```

<https://editor.p5js.org/kdoodoo/sketches/H1n6OITn7>

## createCapture()

It will create separate DOM element&#x20;

```
<canvas>
</canvas>

<video>
</video>
```

## Simply ADD Video as an DOM element

```
  createCapture(VIDEO);
```

<https://editor.p5js.org/kdoodoo/sketches/rkoa9npnX>

### You can add your video DOM on to the Canvas with image();

```
var video;

  function setup() {
  createCanvas(320, 240);
  video = createCapture(VIDEO);
  video.size(320,240);  
}


function draw() {
  background(220);
  image(video, 0, 0,320,240);
}
```

<https://editor.p5js.org/kdoodoo/sketches/SkiGXTThQ>

## tint()

<https://editor.p5js.org/kdoodoo/sketches/SJi3mp627>

```
var video;
function setup() {
  createCanvas(320, 240);
  video = createCapture(VIDEO);
  video.size(320,240);  
}

function draw() {
  tint(255,0,255);
  image(video, 0, 0,320,240);
}
```

### hide()

```
video.hide();
```

### Http VS Https&#x20;

https is necessary for your website to access your camera.&#x20;

## Simple Snapshot Function

```
var video;

  function setup() {
  createCanvas(320, 240);
  background(255,255,255);  
  video = createCapture(VIDEO);
  video.size(320,240);  
  button = createButton("Shot!!");  
  button.mousePressed(takeashot);
    
}

function takeashot(){
 image(video, 0, 0,320,240);

}

function draw() {
  
 //  image(video, 0, 0,320,240);
  
}
```

<https://editor.p5js.org/kdoodoo/sketches/SyaDMA6hX>

### Snapshot in an Array

<https://editor.p5js.org/kdoodoo/sketches/SJVVFRa2m>

```
var video;
var button;
var snapshots = [];

function setup() {
  createCanvas(480, 240);
  background(255,255,255);  
  video = createCapture(VIDEO);
  video.size(320,240);  
  button = createButton("Shot!!");  
  button.mousePressed(takeshot);    
}

function takeshot() {
  snapshots.push(video.get());
}
 
function draw() {
  var x = 0;
  var y = 0; 
  var w = 80;
  var h = 60;
  
  for(i=0;i<snapshots.length;i++) {
    image(snapshots[i], x, y, w, h);
    x = x + w;
    if(x > width){
      x = 0;
      y = y + h;
    }
  }
  
}





```

### Other Example

<https://editor.p5js.org/kdoodoo/sketches/ryujhCpnX>

```
var video;
var button;
var snapshots = [];
var counter = 0;
var vScale = 4;
var total;

function setup() {
  createCanvas(800, 300);
  background(51);
  video = createCapture(VIDEO);
  video.size(320, 240);
  // button = createButton('snap');
  // button.mousePressed(takesnap);
}

function draw() {
  var w = 80;
  var h = 60;
  var x = 0;
  var y = 0;

  // How many cells fit in the canvas
  total = floor(width / w) * floor(height / h);

  snapshots[counter] = video.get();
  counter++;
  if (counter == total) {
    counter = 0;
  }

  for (var i = 0; i < snapshots.length; i++) {
    //tint(255, 50);
    var index = (i + frameCount) % snapshots.length;
    image(snapshots[index], x, y, w, h);
    x = x + w;
    if (x >= width) {
      x = 0;
      y = y + h;
    }
  }
}


```

## Audio

### AudioIn()

<https://editor.p5js.org/kdoodoo/sketches/H1Z-0Cahm>

```

var mic;

function setup() {
  createCanvas(500, 500);

  // Create an Audio input
  mic = new p5.AudioIn();

  // start the Audio Input.
  // By default, it does not .connect() (to the computer speakers)
  mic.start();
}

function draw() {
  background(200);

  // Get the overall volume (between 0 and 1.0)
  var vol = mic.getLevel();
  fill(255,0,255);
  stroke(0);

  // Draw an ellipse with height based on volume
  var h = map(vol, 0, 1, 0, height/2);
  ellipse(width/2,height/2, 25+h ,25 +h);
}

```

## Simple Music Player

<https://editor.p5js.org/kdoodoo/sketches/ry9RJJAhQ>

```
var music;

function setup() {
  song = loadSound('sound/intmus3.mp3');
  createCanvas(400,400);
  background(255,0,255);
}

function mousePressed() {
  if ( song.isPlaying() ) { // .isPlaying() returns a boolean
    song.stop();
    var r = random(0,255);
    var b = random(100,255);
    
    background(r,0,b);
  } else {
    song.play();
    background(100,100,100);
  }
}

```

## Face Tracker

<https://editor.p5js.org/kdoodoo/sketches/HksKmt0h7>

<https://github.com/auduno/clmtrackr>

## Assignment: Either Video OR Sound

<https://goo.gl/forms/HXuxh1lnSbdwoLh03>


# Week 10

Mobile and Chrome

## Bye Bye Preload() , Hello Call back

```
var town;
var url;
var name;


function setup() {
  createCanvas(400, 400);
  background(200,200,100);

  
  town = createInput("london");

  name = town.value();
  url = "https://api.openweathermap.org/data/2.5/forecast?q=" + name + "&APPID=e4d37ccc2c4f3977c2e466fa78b38fcb&units=metric"

  loadJSON(url,gotData);
  
}


function gotData(data){ 
  console.log(data.list[0].main.temp);
  text(data.list[0].main.temp,100,30);
}


function draw() {
}

 
```

#### &#x20;<https://editor.p5js.org/kdoodoo/sketches/B17AhWwa7>

####

## Download&#x20;

{% file src="/files/-LR7OoOnJakAomhJap\_W" %}
MOBILE
{% endfile %}

## Use Chrome

![](https://3008602149-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LENuoEyK2N20-qT-Oc8%2F-LR7OgJ-rVD2c_bDc0V7%2F-LR7P6f0t5HyzrT3ZjzH%2FScreen%20Shot%202018-11-12%20at%2011.51.25%20PM.png?alt=media\&token=2ebd40e8-52b8-4450-8060-e31a3b76f96c)

![](https://3008602149-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LENuoEyK2N20-qT-Oc8%2F-LR7OgJ-rVD2c_bDc0V7%2F-LR7PHxqOm5fqpKH7hNv%2FScreen%20Shot%202018-11-12%20at%2011.52.39%20PM.png?alt=media\&token=55164087-b1f1-4cdd-bdfb-b4c7079d1311)

![](https://3008602149-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LENuoEyK2N20-qT-Oc8%2F-LR7OgJ-rVD2c_bDc0V7%2F-LR7PKUyHcKtWMiy8dt_%2FScreen%20Shot%202018-11-12%20at%2011.52.31%20PM.png?alt=media\&token=ebb4c585-09a1-4f9d-87e9-6cb3108e3cce)

## Click Sensors

![](https://3008602149-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LENuoEyK2N20-qT-Oc8%2F-LR7OgJ-rVD2c_bDc0V7%2F-LR7P_iGvwve74srA0j1%2FScreen%20Shot%202018-11-12%20at%2011.53.55%20PM.png?alt=media\&token=e135975a-d213-497d-b585-e85314a9a5b7)

## Click Orientation

![](https://3008602149-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LENuoEyK2N20-qT-Oc8%2F-LR7OgJ-rVD2c_bDc0V7%2F-LR7PsqZi1XXCicVaZNL%2FScreen%20Shot%202018-11-12%20at%2011.54.57%20PM.png?alt=media\&token=ea9bdc31-9825-4d22-b343-e798aa920ca5)

## deviceMoved()

```
var value = 0;
function draw() {
  fill(value);
  rect(25, 25, 50, 50);
}
function deviceMoved() {
  value = value + 5;
  if (value > 255) {
    value = 0;
  }
}
```

## deviceTurned()

```
var value = 0;
function draw() {
  fill(value);
  rect(25, 25, 50, 50);
}
function deviceTurned() {
  if (turnAxis === 'X') {
    if (value === 0) {
      value = 255;
    } else if (value === 255) {
      value = 0;
    }
  }
}
```

## deviceShaken()

```
var value = 0;
function draw() {
  fill(value);
  rect(25, 25, 50, 50);
}
function deviceShaken() {
  value = value + 5;
  if (value > 255) {
    value = 0;
  }
}
```

## deviceShaken()

```
```

```
// Jiashan Wu
// https://github.com/OhJia/p5MobileWebExamples
// Revised Daniel Shiffman

var balls = [];

function setup() {
  createCanvas(windowWidth, windowHeight);
  for (var i = 0; i < 15; i++) {
    balls.push(new Ball());
  }
  setShakeThreshold(50);
}

function draw() {
  background(0);

  for (var i = 0; i < balls.length; i++) {
    balls[i].move();
    balls[i].turn();
    balls[i].display();
  }
}


function deviceShaken() {
  for (var i = 0; i < balls.length; i++) {
    balls[i].shake();
  }
}
```

## Geo-location

```
// must be in HTTPS
function setup() {
  createCanvas(windowWidth, windowHeight);
  console.log('starting');
	noStroke();
  // get position once
  if (!navigator.geolocation) {
    alert("navigator.geolocation is not available");
  }
  navigator.geolocation.getCurrentPosition(setPos);
}

function setPos(position) {
  var lat = position.coords.latitude;
  var lng = position.coords.longitude;
  background(0);
  fill(255);
  textSize(32);
  text("Current position: " + nf(lat,2,2) + " " + nf(lng,2,2), 10, height/2);
}

```

## Mobile phone - USB debugging

<https://developers.google.com/web/tools/chrome-devtools/remote-debugging/?hl=en>

## Server.js - HTML - Editor - Terminal

![](https://3008602149-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LENuoEyK2N20-qT-Oc8%2F-LR9fm_NQCRUqGCrWsL7%2F-LR9fzo76UV_vFDGBwWX%2FScreen%20Shot%202018-11-13%20at%2010.26.30.png?alt=media\&token=4780edd6-311a-45e9-a260-cf5a24686c48)

![](https://3008602149-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LENuoEyK2N20-qT-Oc8%2F-LR9fm_NQCRUqGCrWsL7%2F-LR9g34V1JuhlPoYmiD4%2FScreen%20Shot%202018-11-13%20at%2010.26.08.png?alt=media\&token=eb1a744f-cd55-417b-973e-a16f221c3dca)

## Web Development

![](https://3008602149-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LENuoEyK2N20-qT-Oc8%2F-LR9iFSbAUdqvVKedhYY%2F-LR9iLa2f5pvxO9aq5nf%2Fimage33-3uneg3lque.png?alt=media\&token=205c6b0e-6bdb-4d04-8cda-a71971b51df5)

## MEAN Stack

![](https://3008602149-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LENuoEyK2N20-qT-Oc8%2F-LR9iFSbAUdqvVKedhYY%2F-LR9iTnEXiCTO-Z4erGC%2Fkickstarting-nodejs-projects-with-yeoman-35-638.jpg?alt=media\&token=0f35a146-5ae9-4998-880e-785518fcb280)

## Assignment&#x20;

### 10 Minute talk on your final project: can be either formal or informal


# Week 11

After p5.js - Final Project Proposal

## Add your name here

<https://docs.google.com/spreadsheets/d/11QDBryw2LMpaipnfwKyb4U85Lfsv3Kf3F8MXGFpcFXc/edit?usp=sharing>

## After P5.js

#### Machine Learning

{% embed url="<https://youtu.be/aircAruvnKk>" %}

## ml5

#### <https://github.com/ml5js/ml5-library>

## p5-speech

#### <https://github.com/IDMNYU/p5.js-speech>

## ml5 + p5-speech by Shawn Van Every  <https://github.com/vanevery/>

#### <https://editor.p5js.org/kdoodoo/sketches/ByxJRXxR7>

## Node-Server

<https://stackabuse.com/how-to-start-a-node-server-examples-with-the-most-popular-frameworks/>

## Assignment

### Start working on your final to user-test on week 13.


# Week 12

Node and Web Socket

## Introduction

![](https://3008602149-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LENuoEyK2N20-qT-Oc8%2F-LSF4r5Avjotg8cbkKeS%2F-LSF5Ju9VyvdjraICefO%2FScreen%20Shot%202018-11-26%20at%209.58.03%20PM.png?alt=media\&token=01555760-f2b5-441d-b22a-6426a9d7e656)

## 1. Create a Folder

![](https://3008602149-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LENuoEyK2N20-qT-Oc8%2F-LSF2nELOqpjFM1Pslei%2F-LSF1Kvxc6NxS2tjloH8%2FScreen%20Shot%202018-11-26%20at%208.38.00%20PM.png?alt=media\&token=9398a7ea-1bd1-4639-a8c8-af876939b56f)

## 2. Use Terminal OR iTerm to Access the Folder

```
cd (change directory)
ls (list items)
```

![](https://3008602149-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LENuoEyK2N20-qT-Oc8%2F-LSF2nELOqpjFM1Pslei%2F-LSF1EmX5ikaucNV9rde%2FScreen%20Shot%202018-11-26%20at%208.39.17%20PM.png?alt=media\&token=7666954e-2b28-4360-918c-82d4a6a41deb)

## 3. Install Node.js

![](https://3008602149-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LENuoEyK2N20-qT-Oc8%2F-LSF2nELOqpjFM1Pslei%2F-LSF0MdeezNxpgr8SfIW%2FScreen%20Shot%202018-11-26%20at%209.36.11%20PM.png?alt=media\&token=c1aebfad-67a5-4be3-83c0-a629df9eeaed)

#### Download

<https://nodejs.org/en/download/>

![](https://3008602149-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LENuoEyK2N20-qT-Oc8%2F-LSF2nELOqpjFM1Pslei%2F-LSF0liVprTNLS3zWny_%2FScreen%20Shot%202018-11-26%20at%208.45.21%20PM.png?alt=media\&token=07772d8b-b956-452a-9078-dae288115ead)

#### Install

![](https://3008602149-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LENuoEyK2N20-qT-Oc8%2F-LSF2nELOqpjFM1Pslei%2F-LSF0vrC_BodNZoDQ6uf%2FScreen%20Shot%202018-11-26%20at%208.45.46%20PM.png?alt=media\&token=ab3dd766-c10b-4744-8034-46989ed230df)

## 4. Check if it is installed well&#x20;

```
node -v
```

![](https://3008602149-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LENuoEyK2N20-qT-Oc8%2F-LSF2nELOqpjFM1Pslei%2F-LSF2X2RHJg9jDiawDyt%2FScreen%20Shot%202018-11-26%20at%209.45.25%20PM.png?alt=media\&token=033ac9ab-236c-497e-83e9-2c77a8a0a2b3)

## 5. Install Socket.io

<https://socket.io/>

![](https://3008602149-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LENuoEyK2N20-qT-Oc8%2F-LSF4r5Avjotg8cbkKeS%2F-LSF5iWnolZsT_JUYjdI%2FScreen%20Shot%202018-11-26%20at%208.56.09%20PM.png?alt=media\&token=8132bd3c-4f68-4cab-8ee9-8e578b73f61e)

<https://github.com/socketio/socket.io>

```
npm install socket.io
```

![](https://3008602149-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LENuoEyK2N20-qT-Oc8%2F-LSF4r5Avjotg8cbkKeS%2F-LSF5rTz1DqbsGuHMtwC%2FScreen%20Shot%202018-11-26%20at%208.57.36%20PM.png?alt=media\&token=b061cb95-6e48-4cc0-b554-c30ad8ac9d7c)

## Installation Finished&#x20;

* **node**
* **socket.io**

## 1. Server.js

{% file src="/files/-LSIkYvEuyHgWb3R57vq" %}
server.js
{% endfile %}

## 2. index.html

{% file src="/files/-LSIntAPqF5sWjx3phTD" %}
index.html
{% endfile %}

## Files are made

## Now Let's RUN IT!!

![](https://3008602149-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LENuoEyK2N20-qT-Oc8%2F-LSF6iClUmK9FRwcD1Ib%2F-LSF8-jMVxBH0OQF2uYQ%2FScreen%20Shot%202018-11-26%20at%2010.09.32%20PM.png?alt=media\&token=43e91e9b-f703-46e8-a3bb-1b35b9f49bae)

## 1. Go to Terminal

![](https://3008602149-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LENuoEyK2N20-qT-Oc8%2F-LSF6iClUmK9FRwcD1Ib%2F-LSF885oE-t3vjUmZNJw%2FScreen%20Shot%202018-11-26%20at%208.57.58%20PM.png?alt=media\&token=a4355766-6cbd-4f55-8fca-f9756f20de07)

```
node server.js
```

## 2. Check your Browser

![](https://3008602149-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LENuoEyK2N20-qT-Oc8%2F-LSF6iClUmK9FRwcD1Ib%2F-LSF8aLjt159vNIt2qFe%2FScreen%20Shot%202018-11-26%20at%209.07.50%20PM.png?alt=media\&token=3ce09d41-fa92-4a31-9514-d7d4a1560476)

#### localhost:3000/index.html

## CTRL + C

It will kill the node server

![](https://3008602149-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LENuoEyK2N20-qT-Oc8%2F-LSF9iZDMmJuc2RqeW1y%2F-LSF9yh51E0bYV9nTu7k%2FScreen%20Shot%202018-11-26%20at%2010.17.37%20PM.png?alt=media\&token=e984d4c4-c710-4d7b-bdcc-b5762a05b1da)

## killall node&#x20;

It will kill node server

![](https://3008602149-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LENuoEyK2N20-qT-Oc8%2F-LSF9iZDMmJuc2RqeW1y%2F-LSFA411skdmi89IE6xU%2FScreen%20Shot%202018-11-26%20at%2010.18.16%20PM.png?alt=media\&token=cd9e54b3-414c-44b2-8e16-49c0666bca93)

## SERVER&#x20;

![](https://3008602149-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LENuoEyK2N20-qT-Oc8%2F-LSHppfhk7foqTGGVr2u%2F-LSHptwzBx9_yeRTUDzt%2FScreen%20Shot%202018-11-27%20at%2010.00.37.png?alt=media\&token=c3f78bd9-407a-4f17-ba2f-0d079ed8b4b3)

## 1. You need a Hosting Server

![](https://3008602149-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LENuoEyK2N20-qT-Oc8%2F-LSHp4EnEXpPA1Lj0z3x%2F-LSHp9Ld6YWYknroxFzu%2FScreen%20Shot%202018-11-27%20at%2010.03.30.png?alt=media\&token=eeabd3cb-b0a8-4c60-9092-1a9dec9526ed)

## 2. Access the server by SSH with terminal

```
ssh root@111.111.111.111 
```

## 3. Node can be installed at the Ubuntu(Any) server&#x20;

{% embed url="<https://www.digitalocean.com/community/tutorials/how-to-install-node-js-on-ubuntu-16-04>" %}

## 4. Install Necessary NPM's : **Node** Package Manager

* socket
* express
* passport
* etc

## 5. Once installed, you can browse the server&#x20;

![](https://3008602149-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LENuoEyK2N20-qT-Oc8%2F-LSHp4EnEXpPA1Lj0z3x%2F-LSHpFrkJqXUOpcSnBJR%2FScreen%20Shot%202018-11-27%20at%2010.12.59.png?alt=media\&token=66821dc0-a7f2-42d6-8772-b306c99e5923)

## 6. Upload Files

![](https://3008602149-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LENuoEyK2N20-qT-Oc8%2F-LSHp4EnEXpPA1Lj0z3x%2F-LSHpKS1c_kqRR94uPSS%2FScreen%20Shot%202018-11-27%20at%2010.15.32.png?alt=media\&token=d56dd567-870b-4677-8b7e-79f41259fa06)

## 7. Go to the folder and RUN IT with Terminal

![](https://3008602149-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LENuoEyK2N20-qT-Oc8%2F-LSHp4EnEXpPA1Lj0z3x%2F-LSHpNh1YyxMI67XEn28%2FScreen%20Shot%202018-11-27%20at%2010.24.03.png?alt=media\&token=89b4ea7c-5cdb-4b2d-b2c2-d27d542644fb)

![](broken://files/-LSHl9DArmIyTbXfGAhB)

## 8. Go to   111.111.111.111:8000/index.html&#x20;

#### **<http://YOUR\\_IP:8080/index.html>**

## **9. Ctrl + D to disconnect**&#x20;


# Week 13

User Testing

## What is User Testing?

#### 1. Take your idea and make it real

#### 2. It is OK to Fail

#### 3. Be ready to pivot, change

#### 4. Be ready to deepen, strengthen your idea.

#### 5. Give useful feedback.

#### 6. It is always great to document. Video, Picture, Words, etc.

## Before You Start: Try not to give too much information ahead.

## Don't : This is not user test.

![](https://3008602149-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LENuoEyK2N20-qT-Oc8%2F-LSrmhoNC4p9wCnAZXS4%2F-LSrn2iQbcepojiFdBG_%2F1163FF514DD3645B2E.jpeg?alt=media\&token=fc7806c3-154a-44ec-bd29-aff3527d8787)

## Do : This is user test.

![](https://3008602149-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LENuoEyK2N20-qT-Oc8%2F-LSrmhoNC4p9wCnAZXS4%2F-LSrn6MKDqfe5DXPy6aR%2F110A8B474DE1112404.jpeg?alt=media\&token=e478e907-6f2b-4d73-bbd2-a19cffa218d9)

## Give explanation after the User Test.

## Assignment

![](https://3008602149-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LENuoEyK2N20-qT-Oc8%2F-LSs2JOkCSrXgU-hzYYe%2F-LSs2PmnQ-DR-OLH8Fqp%2FScreen%20Shot%202018-12-04%20at%2016.09.48.png?alt=media\&token=f1c5f5ff-62fb-4806-91e4-5af29aa2d380)

## Present your Final with REASON why you "changed" OR "did not change."


# Week 14

Final Presentation

## 15 Min (15분) Final Presentation

<https://docs.google.com/spreadsheets/d/1kjf64F9bXYhBdCWQID3-tpfNJARliJTOLaqMaI1WZ4g/edit?usp=sharing>

| 순서 | 이름     |
| -- | ------ |
| 1  | 이창범    |
| 2  | 루카스    |
| 3  | 안소영    |
| 4  | 이다영    |
| 예비 |        |
| 예비 |        |
| 5  | Alexis |
| 6  | 박재성    |
| 7  | 이의진    |
| 8  | 신슬기    |
| 9  | 이가하    |
| 10 | 박윤하    |
| 11 | Celso  |


# Week 15

No Class


# Portfolio

Portfolio by wordpress hosting.

### 1. Go to Dreamhost.com

![](https://3008602149-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LENuoEyK2N20-qT-Oc8%2F-LLbO59uzdeZjLB8xxR-%2F-LLbO7QzIWG446JqeKpv%2FScreen%20Shot%202018-09-05%20at%2010.41.30.png?alt=media\&token=8d569aa7-16fa-464b-93a9-4c79daedf42b)

### 2. Click Get Started.

![](https://3008602149-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LENuoEyK2N20-qT-Oc8%2F-LLbO59uzdeZjLB8xxR-%2F-LLbOQHC-t_48C0533Jo%2FScreen%20Shot%202018-09-05%20at%2010.42.30.png?alt=media\&token=186c9aaf-5cd9-4540-8a45-125a9d3cdf65)

### 3. Pick whichever you prefer, but recommend the cheapest $2.59/mo.

### 4. Sign up!

![](https://3008602149-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LENuoEyK2N20-qT-Oc8%2F-LLbO59uzdeZjLB8xxR-%2F-LLbOp4AWoV5xFOUCnrQ%2FScreen%20Shot%202018-09-05%20at%2010.44.33.png?alt=media\&token=f0ddc723-1321-4566-a538-3b581f032119)

#### 5. Pick a domain and register. Usually ".com" is cheap, but io, ml, is, kim are cool.

![](https://3008602149-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LENuoEyK2N20-qT-Oc8%2F-LLbO59uzdeZjLB8xxR-%2F-LLbQRrsK3pTZLIeZ4g7%2FScreen%20Shot%202018-09-05%20at%2010.48.13.png?alt=media\&token=ef05f56d-6526-45e3-92fa-3b1644df6c69)

#### 6. OR you can either start with free or set this up later.&#x20;

![](https://3008602149-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LENuoEyK2N20-qT-Oc8%2F-LLbO59uzdeZjLB8xxR-%2F-LLbQkAvJIZF0Dvvp9GP%2FScreen%20Shot%202018-09-05%20at%2010.52.34.png?alt=media\&token=5d9783c9-4249-40d0-b8b1-3e17b0b04625)

#### 7. Pick a plan.&#x20;

![](https://3008602149-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LENuoEyK2N20-qT-Oc8%2F-LLbO59uzdeZjLB8xxR-%2F-LLbR24TzkhfwRUXkBnf%2FScreen%20Shot%202018-09-05%20at%2010.53.54.png?alt=media\&token=44eedf26-2b21-457e-9bfa-65b51f1fa31c)

#### 8. Check Install WordPress.

![](https://3008602149-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LENuoEyK2N20-qT-Oc8%2F-LLbO59uzdeZjLB8xxR-%2F-LLbRUbdjZHd-3OahvN3%2FScreen%20Shot%202018-09-05%20at%2010.55.39.png?alt=media\&token=2e556ef8-ab18-4f5b-8ce5-0f12cf669948)

#### 9. Payment...

![](https://3008602149-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LENuoEyK2N20-qT-Oc8%2F-LLbO59uzdeZjLB8xxR-%2F-LLbRk48-irS2SthBXkf%2FScreen%20Shot%202018-09-05%20at%2010.57.10.png?alt=media\&token=02c6eabe-d234-4cde-8cb0-88a5a0a719eb)

#### 10. Go to dashboard.

![](https://3008602149-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LENuoEyK2N20-qT-Oc8%2F-LLbO59uzdeZjLB8xxR-%2F-LLbXGHe8Wsl94hPpDZn%2FScreen%20Shot%202018-09-05%20at%2011.21.05.png?alt=media\&token=17352c86-34e6-4142-b0a6-fbfdacd27f3b)

#### 11. Once it is set, you will get an email.&#x20;

![](https://3008602149-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LENuoEyK2N20-qT-Oc8%2F-LLbO59uzdeZjLB8xxR-%2F-LLbYhTd3uWNa1hXIJm3%2FScreen%20Shot%202018-09-05%20at%2011.27.42.png?alt=media\&token=f21e036f-7d00-42a8-be65-a3eba3321135)

#### 12. Go to [www.your\\\_website.com/wp-admin/install.php](http://www.your\\_website.com/wp-admin/install.php)

#### 13. Set your admin user by typing in username and password.

#### 14. Go to [www.your\\\_website.com/wp-login.php](http://www.your\\_website.com/wp-login.php)

#### 15. Now you have your wordpress website.&#x20;

![](https://3008602149-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LENuoEyK2N20-qT-Oc8%2F-LLbO59uzdeZjLB8xxR-%2F-LLbZwud-Hvbs6Tgpfvu%2FScreen%20Shot%202018-09-05%20at%2011.32.43.png?alt=media\&token=941ac3c6-6518-4e6e-b31b-3698ab3a1366)

#### &#x20;16. Modify theme, category, post, menu, pages and etc.&#x20;

![](https://3008602149-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LENuoEyK2N20-qT-Oc8%2F-LLbO59uzdeZjLB8xxR-%2F-LLb_DV9GHMRlX3PAhpq%2FScreen%20Shot%202018-09-05%20at%2011.34.25.png?alt=media\&token=54d90902-5fce-4872-b9c7-420d984a335b)

## OTHER

[**https://www.squarespace.com**](https://www.squarespace.com)

#### <https://2.cargocollective.com/>

#### <https://wordpress.com/>

#### <https://www.wix.com>

#### Use github pages

#### <https://medium.com/@svinkle/publish-and-share-your-own-website-for-free-with-github-2eff049a1cb5>


