Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

canvas setup

const canvas = document.querySelector('canvas'), c = canvas.getContext('2d');

(window.onresize=e=>{canvas.width=innerWidth,canvas.height=innerHeight})();

(function animate () {
	c.clearRect(0, 0, canvas.width, canvas.height);
	requestAnimationFrame(animate);	
})();
 
PREVIOUS NEXT
Tagged: #canvas #setup
ADD COMMENT
Topic
Name
5+8 =