Advertisement
coding_giants

websites starter

May 24th, 2023
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.33 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html lang="en">
  3.  
  4. <head>
  5. <meta charset="utf-8" />
  6. <meta name="viewport" content="width=device-width, initial-scale=1" />
  7.  
  8. <!-- add a title for the page -->
  9.  
  10. <link rel="stylesheet" href="/style.css" />
  11.  
  12. <!-- add an icon for the website -->
  13.  
  14.  
  15.  
  16. <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.1.1/animate.min.css" />
  17.  
  18. <!-- if the code does not work, remove the comment in the following line -->
  19. <!-- <script src="/script.js" defer></script> -->
  20.  
  21. </head>
  22.  
  23. <body>
  24.  
  25.  
  26. <div id="container">
  27.  
  28. <!-- add an h1 header with the text: Evolution of gaming -->
  29.  
  30.  
  31.  
  32.  
  33. <!-- add an h2 header with the text: Game title set: id="game-title" -->
  34.  
  35.  
  36. <div id="screenshot-panel">
  37.  
  38. <!-- add an image, set id="screenshot" -->
  39.  
  40.  
  41.  
  42.  
  43. <!-- add a button that rotates the screenshot 🔄 and set id="button-rotate" -->
  44.  
  45.  
  46. </div>
  47.  
  48. <!-- add a button that displays the next game, set id="button-next" -->
  49.  
  50.  
  51.  
  52. </div>
  53.  
  54. </body>
  55.  
  56. </html>
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66. @import url('https://fonts.googleapis.com/css2?family=Bungee+Outline&family=Lato&family=Press+Start+2P&display=swap');
  67.  
  68. body {
  69. background: #0F2027;
  70. background: -webkit-linear-gradient(bottom, #2C5364, #203A43, #0F2027);
  71. background: linear-gradient(to bottom, #2C5364, #203A43, #0F2027);
  72. font-family: 'Lato', sans-serif;
  73. color: white;
  74. text-align: center;
  75. overflow-x: hidden;
  76. height: 1000px;
  77. }
  78.  
  79. /* set the font family for the h1 header to: 'Press Start 2P', cursive */
  80.  
  81.  
  82. /*optional task*/
  83.  
  84.  
  85. #container {
  86. background-color: #1b2838;
  87. width: 1160px;
  88. /* position the game window in the centre of the page */
  89.  
  90. padding: 10px;
  91. /* set the border */
  92.  
  93. /* round the corners of the border */
  94.  
  95. }
  96.  
  97.  
  98.  
  99.  
  100.  
  101. #screenshot {
  102. object-fit: cover;
  103. }
  104.  
  105.  
  106. #screenshot-panel {
  107. position: relative;
  108. }
  109.  
  110.  
  111. #button-rotate {
  112.  
  113. background: none;
  114. opacity: 0.9;
  115. padding: 0;
  116. margin: 0;
  117. font-size: 30px;
  118. position: absolute;
  119. top: 0px;
  120. left: 230px;
  121. /*remove the default border of the button*/
  122.  
  123. /*set the mouse cursor to a pointer when hovering over a button*/
  124.  
  125. }
  126.  
  127.  
  128.  
  129.  
  130. #button-next {
  131. /*add a margin from the top edge of the border*/
  132.  
  133. /*add border padding to the text in the button */
  134.  
  135. border: none;
  136. cursor: pointer;
  137. background-color: #4ca2cd;
  138. opacity: 0.8;
  139. font-size: 30px;
  140. color: #ffffff;
  141. }
  142.  
  143.  
  144. /*optional task*/
  145.  
  146.  
  147.  
  148.  
  149.  
  150.  
  151.  
  152.  
  153.  
  154.  
  155.  
  156.  
  157.  
  158.  
  159. const games = [
  160.  
  161.  
  162.  
  163. // Game: Tomb Raider - 1996 / Shadow of the Tomb Raider - 2018
  164. {
  165. past_game_title: "Tomb Raider - 1996",
  166. past_screenshot: "https://cdn.glitch.global/577f7cfd-04b0-4201-b8cf-5a390d167fdd/tombraider-past.jpg?v=1684604067765",
  167. present_game_title: "Shadow of the Tomb Raider - 2018",
  168. present_screenshot: "https://cdn.glitch.global/577f7cfd-04b0-4201-b8cf-5a390d167fdd/tombraider-present.jpeg?v=1684604068402",
  169.  
  170. },
  171.  
  172.  
  173.  
  174.  
  175.  
  176. // Game: The Sims - 2000 / The Sims 4: High School Years
  177.  
  178. {
  179. past_game_title: "The Sims - 2000",
  180. past_screenshot: "https://cdn.glitch.global/577f7cfd-04b0-4201-b8cf-5a390d167fdd/sims-past.jpg?v=1684604065316",
  181. present_game_title: "The Sims 4: High School Years - 2022",
  182. present_screenshot: "https://cdn.glitch.global/577f7cfd-04b0-4201-b8cf-5a390d167fdd/sims-present.png?v=1684604067025",
  183.  
  184. },
  185.  
  186.  
  187.  
  188.  
  189. // Game: Grand Theft Auto 1 - 1997 / Grand Theft Auto V - 2013
  190.  
  191. {
  192. past_game_title: "Grand Theft Auto 1 - 1997",
  193. past_screenshot: "https://cdn.glitch.global/577f7cfd-04b0-4201-b8cf-5a390d167fdd/gta-past.png?v=1684604071123",
  194. present_game_title: "Grand Theft Auto V - 2013",
  195. present_screenshot: "https://cdn.glitch.global/577f7cfd-04b0-4201-b8cf-5a390d167fdd/gta-present.jpg?v=1684604062887",
  196.  
  197. },
  198.  
  199.  
  200.  
  201.  
  202. // Game: The Need for speed - 1994 / Need for Speed Unbound - 2022
  203.  
  204. {
  205. past_game_title: "The Need for speed - 1994",
  206. past_screenshot: "https://cdn.glitch.global/577f7cfd-04b0-4201-b8cf-5a390d167fdd/nfs-past.jpg?v=1684604063536",
  207. present_game_title: "Need for Speed Unbound - 2022",
  208. present_screenshot: "https://cdn.glitch.global/577f7cfd-04b0-4201-b8cf-5a390d167fdd/nfs-present.jpg?v=1684604064671",
  209.  
  210. },
  211.  
  212.  
  213.  
  214.  
  215.  
  216. //TODO Game: FIFA International Soccer - 1994 / Fifa23 - 2022
  217.  
  218. {
  219. past_game_title: "",
  220. past_screenshot: "",
  221. present_game_title: "",
  222. present_screenshot: "",
  223.  
  224. },
  225.  
  226.  
  227.  
  228.  
  229.  
  230.  
  231.  
  232.  
  233.  
  234.  
  235.  
  236.  
  237. ];
  238.  
  239.  
  240.  
  241.  
  242.  
  243.  
  244. let gamesCounter = 0;
  245. let currentState=0;
  246. const screenshot = document.querySelector("#screenshot");
  247. const gameTitle = document.querySelector("#game-title");
  248. const buttonRotate = document.querySelector("#button-rotate");
  249.  
  250.  
  251.  
  252. function newGame(){
  253. currentState=0
  254. screenshot.src=games[gamesCounter].present_screenshot;
  255. gameTitle.textContent = games[gamesCounter].present_game_title;
  256.  
  257. }
  258.  
  259.  
  260. newGame();
  261.  
  262.  
  263.  
  264. document.querySelector("#button-rotate").addEventListener("click", function () {
  265.  
  266. buttonRotate.style.visibility="hidden";
  267.  
  268.  
  269. /*Editing the screenshot rotation animation*/
  270. screenshot.classList.add("animate__animated", "animate__flipInX");
  271.  
  272. if (currentState==0){
  273. currentState++;
  274. gameTitle.textContent = games[gamesCounter].past_game_title;
  275. screenshot.src=games[gamesCounter].past_screenshot;
  276.  
  277. }
  278. else{
  279. currentState--;
  280. gameTitle.textContent = games[gamesCounter].present_game_title;
  281. screenshot.src=games[gamesCounter].present_screenshot;
  282. }
  283.  
  284.  
  285. });
  286.  
  287.  
  288.  
  289.  
  290. screenshot.addEventListener('animationend', () => {
  291. /*Editing the screenshot rotation animation*/
  292. screenshot.classList.remove("animate__animated", "animate__flipInX");
  293. /*Editing the game transition animation*/
  294. screenshot.classList.remove("animate__animated", "animate__rubberBand");
  295. buttonRotate.style.visibility="visible";
  296.  
  297. });
  298.  
  299.  
  300. document.querySelector("#button-next").addEventListener("click", function () {
  301. gamesCounter++
  302. if (gamesCounter >= games.length){
  303. gamesCounter=0;
  304.  
  305. }
  306. buttonRotate.style.visibility="hidden";
  307. /*Editing the game transition animation*/
  308. screenshot.classList.add("animate__animated", "animate__rubberBand");
  309. setTimeout(newGame,500);
  310.  
  311.  
  312. });
  313.  
  314.  
  315.  
  316.  
  317.  
  318.  
  319.  
  320.  
  321.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement