Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head>
- <title>
- </title>
- <style>
- canvas{border: 2px solid black; background:#CD5C5C; display: block; margin:0 auto;}
- </style>
- </head>
- <body>
- <h1><center>Coin Animation</center></h1>
- <canvas id="myCanvas" width="640" height="360"></canvas>
- <script>
- window.addEventListener('load',function(){
- var canvas = document.getElementById("myCanvas");
- var ctx = canvas.getContext("2d");
- var goldcoin = new Image();
- goldcoin.src = "CoinSpriteSheet.png";
- function sprite (options){
- var coin = {};
- coin.context = options.context;
- coin.width = options.width;
- coin.height = options.height;
- coin.image = options.image;
- coin.x = 0;
- coin.y = 0;
- return coin;
- }
- void ctx.drawImage(image, sx, sy, sWidth, sHeight, dx, dy, dWidth, dHeight);
- });
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement