HTML and CSS Reference
In-Depth Information
Combine component colors
color = red << 16 | green << 8 | blue;
Extract component colors
red = color24 >> 16 & 0xFF;
green = color24 >> 8 & 0xFF;
blue = color24 & 0xFF;
Draw a curve through a point
//xt, yt is the point you want to draw through
//x0, y0 and x2, y2 are the end points of the curve
x1 = xt * 2 - (x0 + x2) / 2;
y1 = yt * 2 - (y0 + y2) / 2;
context.moveTo(x0, y0);
context.quadraticCurveTo(x1, y1, x2, y2);
Chapter 5
Convert angular velocity to x, y velocity
vx = speed * Math.cos(angle);
vy = speed * Math.sin(angle);
Convert angular acceleration (any force acting on an object) to x, y
acceleration
ax = force * Math.cos(angle);
ay = force * Math.sin(angle);
Add acceleration to velocity
vx += ax;
vy += ay;
Add velocity to position
object.x += vx;
object.y += vy;
 
Search WWH ::




Custom Search