Can anyone help or give ideas on how to use HTML5 canvas translate to make a scrolling camera to follow an object?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You want to use
ctx.translate(x, y)to move the canvas context while you draw your objects normally.For more detail and suggestions see my answer here: 2D side scrolling camera view in html5
The accepted answer for that question is another valid way of doing things but is much worse performance-wise.