|
|
Line 7: |
Line 7: |
| | | |
| <script> | | <script> |
− | var canvas = document.getElementById("myCanvas");
| |
− | var context= canvas.getContext("2d");
| |
− | context.fillStyle = "#FF00FF";
| |
− | context.fillRect(0,0,150,75);
| |
− |
| |
− | initialize();
| |
− |
| |
− | function initialize() {
| |
− | window.addEventListener("resize", resizeCanvas, false);
| |
− | window.requestAnimFrame = (function() {
| |
− | return (
| |
− | window.requestAnimationFrame ||
| |
− | window.webkitRequestAnimationFrame ||
| |
− | window.mozRequestAnimationFrame ||
| |
− | window.oRequestAnimationFrame ||
| |
− | window.msRequestAnimationFrame ||
| |
− | function(callback) {
| |
− | window.setTimeout(callback, 1000 / 60);
| |
− | }
| |
− | );
| |
− | })();
| |
− |
| |
− | (function animloop() {
| |
− | requestAnimFrame(animloop);
| |
− | render();
| |
− | })();
| |
− |
| |
− | resizeCanvas();
| |
− | }
| |
− |
| |
− | function resizeCanvas() {
| |
− | canvas.width = window.innerWidth;
| |
− | canvas.height = window.innerHeight;
| |
− | }
| |
− |
| |
− | </script>
| |
− |
| |
− |
| |
− |
| |
− |
| |
− |
| |
− |
| |
− |
| |
− |
| |
− | <!--
| |
| (function() { | | (function() { |
| var particlesQuantity = 100, | | var particlesQuantity = 100, |
Line 61: |
Line 16: |
| particles = []; | | particles = []; |
| | | |
− | if (canvas && canvas.getContext) {
| |
| context = canvas.getContext("2d"); | | context = canvas.getContext("2d"); |
| | | |
Line 77: |
Line 31: |
| } | | } |
| initialize(); | | initialize(); |
− | }
| + | |
| | | |
| function resizeCanvas() { | | function resizeCanvas() { |
Line 153: |
Line 107: |
| } | | } |
| })(); | | })(); |
− | -->
| |
− |
| |
| | | |
| | | |
| | | |
| + | </script> |
| | | |
| | | |