Advertisement
Guest User

penis

a guest
Dec 9th, 2019
423
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.03 KB | None | 0 0
  1. // shit i should put in a lib
  2. function circle(x, y, radie, color) {
  3. let c = document.getElementById('canvas')
  4. let ctx = c.getContext('2d')
  5. ctx.beginPath()
  6. ctx.arc(x, y, radie, 0, 2 * Math.PI)
  7. ctx.fillStyle = color
  8. ctx.fill()
  9. }
  10.  
  11. function clear() {
  12. let c = document.getElementById('canvas')
  13. let ctx = c.getContext('2d')
  14. ctx.clearRect(0, 0, canvas.width, canvas.height)
  15. }
  16.  
  17. function randomInt(min, max) {
  18. min = Math.ceil(min);
  19. max = Math.floor(max);
  20. return Math.floor(Math.random() * (max - min + 1)) + min;
  21. }
  22.  
  23. function fadeOut(target) {
  24. var fadeTarget = document.getElementById(target);
  25. var fadeEffect = setInterval(function () {
  26. if (!fadeTarget.style.opacity) {
  27. fadeTarget.style.opacity = 1;
  28. }
  29. if (fadeTarget.style.opacity > 0) {
  30. fadeTarget.style.opacity -= 0.05;
  31. } else {
  32. clearInterval(fadeEffect);
  33. }
  34. }, 10);
  35. }
  36.  
  37. function randomColor() {
  38. var letters = '0123456789ABCDEF';
  39. var color = '#';
  40. for (var i = 0; i < 6; i++) {
  41. color += letters[Math.floor(Math.random() * 16)];
  42. }
  43. return color;
  44. }
  45.  
  46. function redirect() {
  47. document.location.href = 'sida2'
  48. }
  49.  
  50. let W = window.innerWidth
  51. let H = window.innerHeight
  52. document.getElementById('canvas').width = W
  53. document.getElementById('canvas').height = H
  54.  
  55.  
  56.  
  57. // shid that does stuff
  58. let bubbles1 = []
  59. let bubbles2 = []
  60. let timer = 40
  61. let timer2 =
  62.  
  63. function draw() {
  64. clear()
  65. timer++
  66. if (timer > 40 && bubbles1.length < 10) {
  67. let bubble1 = {
  68. x: randomInt(0, W),
  69. y: H+100,
  70. size: randomInt(50, 100),
  71. color: randomColor(),
  72. speed: randomInt(1, 3)
  73. }
  74. bubbles1.push(bubble1)
  75. timer = 0
  76. }
  77. if (timer > 40 && bubbles2.length < 10) {
  78. let bubble2 = {
  79. x: randomInt(0, W),
  80. y: H+100,
  81. size: randomInt(50, 100),
  82. color: randomColor(),
  83. speed: randomInt(1, 3)
  84. }
  85. bubbles2.push(bubble2)
  86. timer = 0
  87. }
  88.  
  89. for (let i = bubbles1.length-1; i >= 0; i--){
  90. circle(bubbles1[i].x, bubbles[i].y, bubbles1[i].size, bubbles1[i].color)
  91. bubbles1[i].y -= bubbles1[i].speed
  92. if (bubbles1[i].y < -100) {
  93. bubbles1.splice(i, 1)
  94. }
  95. }
  96.  
  97. for (let j = bubbles2.length-1; j >= 0; j--){
  98. circle(bubbles2[j].x, bubbles2[j].y, bubbles2[j].size, bubbles2[j].color)
  99. bubbles2[j].y += bubbles2[j].speed
  100. if (bubbles2[j].y < H + 100) {
  101. bubbles2.splice(j, 1)
  102. }
  103. }
  104.  
  105. }
  106.  
  107.  
  108.  
  109. setInterval(draw, 30)
  110. setTimeout(function showText() {
  111. document.getElementById('content').style.display = 'block'
  112. }, 500)
  113.  
  114. let button = document.getElementById('button')
  115.  
  116. button.onclick = () => {
  117. fadeOut('sida1')
  118. setTimeout(function redirect() {document.location.href = 'sida2.html'}, 200)
  119. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement