etsted Posted April 5, 2014 Share Posted April 5, 2014 what does it mean that i can back-reference the canvas element through the context object in this script? alert(ctx.canvas.id+" | "+ctx.canvas.width+" | "+ctx.canvas.height); in w3school they would only write "ctx.id". Link to comment Share on other sites More sharing options...
Ingolme Posted April 5, 2014 Share Posted April 5, 2014 No, I don't believe they would write ctx.id because that wouldn't work. You get a context object from a canvas element. var ctx = canvas.getContext("2d"); If you somehow lost the reference to canvas but you still have the context you can get back to the canvas with var canvas = ctx.canvas; Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now