ICL
Search…
Week 03
Animation, Variables, Interaction

1. Variable

number

1
var s = 90;
Copied!

string

1
var name = "don"
Copied!

object

1
var circle = {
2
radius: 13,
3
x: 60,
4
y: 100
5
};
6
7
8
circle.radius
9
circle.x
10
circle.y
Copied!

array

1
var num = [1, 2, 3];
2
3
4
num[0]
5
num[1]
6
num[2]
Copied!

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.
1
let x = 1;
Copied!

3. console.log()

4. Animation

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.

random()

1
// random in number
2
random(50); // range in 0 to 50
3
random(-50, 50); // range in -50 to 50
4
5
6
//random in string
7
var words = ['a', 'b', 'c', 'd'];
8
var word = random(words); // select a random word from a,b,c,d
Copied!

mouseX, mouseY

1
ellipse(mouseX, mouseY, 24, 24);
2
ellipse(mouseX, mouseY,mouseX, mouseY);
Copied!

map()

1
map(which value had current range,currentMin,currentMax,newMin,newMax)
Copied!

mousePressed()

1
function mousePressed() {
2
};
Copied!

5. Assignment

Make any project that interacts with the user.

Last modified 3yr ago