Return to Video

Center ViewRect - HTML5 Game Development

  • 0:00 - 0:04
    >> Now, the first thing we do is actually set the viewRect width and height
  • 0:04 - 0:07
    equal to the canvas size. This way we know that the viewRect is actually going
  • 0:07 - 0:12
    to encompass everything that the canvas can actually see. From here, we actually
  • 0:12 - 0:15
    translate the x and y value of the viewRect by offsetting it by half of the
  • 0:15 - 0:19
    canvas size. Now, what this is going to do is effectively shift the viewRect,
  • 0:19 - 0:23
    such the x and y value are at the center. Of the viewRect, meaning that it's at
  • 0:23 - 0:25
    the center of what the canvas will draw.
Title:
Center ViewRect - HTML5 Game Development
Description:

more » « less
Video Language:
English
Team:
Udacity
Project:
CS255 - HTML5 Game Development
Duration:
0:25

English subtitles

Revisions Compare revisions