# Week 03

## 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://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>                        |
