Here are two JavaScript example illustrating 2D translation.