How do I take code from code and use it locally in a text editor?
http://codepen.io/mfields/pen/BhILt
I try to play with this creation locally, but when I open it in chrome, I get a blank white page in which nothing happens.
<!DOCTYPE HTML> <html> <head> <script> src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script> <script type="text/javascript" src="celtic.js"></script> <link rel="stylesheet" type="text/css" src="celtic.css"></link> </head> <body> <canvas id="animation" width="400" height="400"></canvas> </body> </html>
I have a copy, pasting and saving css and js to different files and saving them, and then tried to link them to the html file as shown above.
I also included the jquery library, as I understand that many of the code files use it.
The only console error I get is
Uncaught TypeError: Cannot read property 'getContext' of null
which refers to my js file, line 4
(function(){ var canvas = document.getElementById( 'animation' ), c = canvas.getContext( '2d' ),
Sorry if this is stupid, but I'm new to all of this. I'm sure it's just damn. Any help would be awesome!
source share