Advertisement
Guest User

Untitled

a guest
Nov 29th, 2015
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.63 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4.  
  5. <style>
  6. #navigation {
  7. position: absolute;
  8. top: 0;
  9. left: 0;
  10. width: 200px;
  11. }
  12.  
  13. #content {
  14. margin-left: 200px;
  15. }
  16. h1 ,p{
  17.  
  18. padding:20px;
  19. box-shadow: inset 0 0 17px 10px #cd0;
  20. text-shadow: 2px 2px 2px #999;
  21.  
  22. }
  23.  
  24. h2 {
  25. padding: 50px;
  26. background-image: url(paper.gif);
  27. color: rgba(0,0,0,0.8);
  28. }
  29.  
  30. a:link {
  31. color: hsl(36,50%,50%);
  32. }
  33. a:hover {
  34. color: hsl(36,100%,50%);
  35. }
  36. .note {
  37. width: 300px;
  38. height: 300px;
  39. background: linear-gradient(hsl(0,100%,50%),hsl(60,100%,50%),hsl(120,100%,50%),hsl(180,100%,50%),hsl(240,100%,50%),hsl(300,100%,50%));
  40. transform: rotate(-10deg);
  41. transform: skew(20deg,10deg);
  42. transform: matrix(2,-0.35,0.35,2,0,0);
  43. }
  44.  
  45.  
  46. </style>
  47.  
  48. </head>
  49.  
  50. <body>
  51. <canvas id="wittykitty" width="200" height="200">
  52. <!-- Here be fall-back content -->
  53. </canvas>
  54.  
  55.  
  56. <script>
  57. //alert("In script");
  58. var canvas = document.querySelector('canvas');
  59. var ctx = canvas.getContext('2d');
  60.  
  61. var resize = function () {
  62. canvas.width = window.innerWidth;
  63. canvas.height = window.innerHeight;
  64. };
  65.  
  66. window.addEventListener('resize', resize);
  67.  
  68. window.addEventListener('load', function () {
  69.  
  70. resize();
  71.  
  72. var pos, vel;
  73. pos = {
  74. x: 10,
  75. y: 10
  76. };
  77. vel = {
  78. x: 1,
  79. y: 1
  80. };
  81.  
  82. var loop = function () {
  83. //alert("In loop");
  84. ctx.clearRect(0, 0, canvas.width, canvas.height);
  85. pos.x += vel.x;
  86. pos.y += vel.y;
  87. if (pos.x < 5 || pos.x > canvas.width - 5 - 50) {
  88. vel.x *= -1;
  89. }
  90. if (pos.y < 5 || pos.y > canvas.height - 5 - 50) {
  91. vel.y *= -1;
  92. }
  93. ctx.fillRect(pos.x - 5, pos.y - 5, 50, 50);
  94. };
  95.  
  96. setInterval(loop, 1000 / 60);
  97. });
  98. </script>
  99.  
  100. </body>
  101.  
  102. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement