1234567891011121314151617181920212223242526272829303132333435363738 |
- var wSize, hSize;
- function dimensionner(bloc) {
-
- if( typeof( window.innerHeight ) == 'number' )
- hSize = window.innerHeight;
- else if( document.documentElement && document.documentElement.clientHeight )
- hSize = document.documentElement.clientHeight;
- if( typeof( window.innerWidth ) == 'number' )
- wSize = window.innerWidth;
- else if( document.documentElement && document.documentElement.clientWidth )
- wSize = document.documentElement.clientHeight;
-
- document.getElementById(bloc).height = hSize;
- document.getElementById(bloc).width = wSize;
- }
- window.onload = function(){ dimensionner("canvas") };
- window.onresize = function(){ dimensionner("canvas") };
- var canvas = document.querySelector('#canvas');
- var context = canvas.getContext('2d');
- context.lineWidth = "5";
- function mainLoop() {
-
- context.strokeStyle = "blue";
- context.strokeRect(1, 1, wSize-30, hSize-30);
- }
- setInterval(mainLoop, 1000);
|