{"__browser":{"device":"unknown_device","mobile":false,"name":"unknown browser","platform":"unknown_platform","version":"0"},"__constants":{},"__CPDATA":{"domain_iframe":"https://cdpn.io","environment":"production","host":"codepen.io","iframe_allow":"accelerometer; ambient-light-sensor; camera; display-capture; encrypted-media; geolocation; gyroscope; microphone; midi; payment; web-share; vr","iframe_sandbox":"allow-forms allow-modals allow-pointer-lock allow-popups allow-same-origin allow-scripts allow-top-navigation-by-user-activation allow-downloads allow-presentation"},"__graphql":{"data":{"data":{"sessionUser":{"id":"VoDkNZ","name":"Captain Anonymous","title":"Captain Anonymous","avatar":"https://assets.codepen.io/t-1/user-default-avatar.jpg?format=auto&version=0","currentContext":{"id":"VoDkNZ","title":"Captain Anonymous","name":"Captain Anonymous","avatar":"https://assets.codepen.io/t-1/user-default-avatar.jpg?format=auto&version=0","username":"anon","__typename":"User"},"currentTeamId":null,"username":"anon","admin":false,"anon":true,"pro":false,"verified":false,"teams":[],"__typename":"User"}}},"url":"https://codepen.io/graphql","api":"cprails","cpedata":{"action":"show","controller":"live_fullpage"}},"__user":{"anon":true,"base_url":"/anon/","current_team_id":0,"current_team_hashid":null,"hashid":"VoDkNZ","id":1,"itemType":"user","name":"Captain Anonymous","paid":false,"tier":0,"username":"anon","created_at":null,"email_verified":null,"collections_count":0,"collections_private_count":0,"followers_count":0,"followings_count":0,"pens_count":0,"pens_private_count":0,"projects_count":0,"projects_private_count":0},"__firebase":{"config":{"apiKey":"AIzaSyBgLAe7N_MdFpuVofMkcQLGwwhUu5tuxls","authDomain":"codepen-store-production.firebaseapp.com","databaseURL":"https://codepen-store-production.firebaseio.com","disabled":false,"projectId":"codepen-store-production"},"token":"eyJhbGciOiJSUzI1NiJ9.eyJhdWQiOiJodHRwczovL2lkZW50aXR5dG9vbGtpdC5nb29nbGVhcGlzLmNvbS9nb29nbGUuaWRlbnRpdHkuaWRlbnRpdHl0b29sa2l0LnYxLklkZW50aXR5VG9vbGtpdCIsImNsYWltcyI6eyJvd25lcklkIjoiVm9Ea05aIiwiYWRtaW4iOmZhbHNlfSwiZXhwIjoxNjc1NzE0MDYwLCJpYXQiOjE2NzU3MTA0NjAsImlzcyI6ImZpcmViYXNlLWFkbWluc2RrLThva3lsQGNvZGVwZW4tc3RvcmUtcHJvZHVjdGlvbi5pYW0uZ3NlcnZpY2VhY2NvdW50LmNvbSIsInN1YiI6ImZpcmViYXNlLWFkbWluc2RrLThva3lsQGNvZGVwZW4tc3RvcmUtcHJvZHVjdGlvbi5pYW0uZ3NlcnZpY2VhY2NvdW50LmNvbSIsInVpZCI6IlZvRGtOWiJ9.GQLDs-vG8yESpOgoPYB4eFUwqrUYKhBMFy6omJsPCzbcFF-iwcPeSYqSI51bMuNCJLQph8YaIChybFKIjB5npBOSrYaFCuBAQm0utogX6w6hQFII5_SWHECIElAHijsl3YPsn6ZasN8lkh9Esxv7TOf36mkCPqfMUz2ckZ55shH_7taWQgarBFBh5QlkJrX5RDX2KpILqBwT0sCfcaAdzdEdY5gfSLp2oMw6PSbLrKuPyEElTOB8WgPmgjRPfvchdDoHxhFxsVAaIUbJGpvyyT765EDkDgFRdTqylVYZVZn4vE1QiovyxDasS78_jn85XtBMJiB7UH16ZLhKgwsquA"},"__pay_stripe_public_key":"pk_live_2GndomDfiklqpSNQn8FrGuwZSMIMzha7DkLJqlYe7IR0ihKAlKdiHg68JJc5eVPt68rzAjzAAVXcUwjySHRCsgjQQ00gtRBUFNH","__pay_braintree_env":"production","__item":"{\"id\":59041158,\"user_id\":265602,\"html\":\"<!--\\nressource sprite sheet : https:\\/\\/luizmelo.itch.io\\/martial-hero-2\\n-->\\n\\n<div id=\\\"container\\\">\\n\\n\\t<div id=\\\"sprite-image\\\"><\\/div>\\n\\t<div id=\\\"sol\\\"><\\/div>\\n\\t\\n<\\/div>\\n\\n\\n\\n\\n\",\"css\":\"body {\\n\\tmargin:0;\\n\\tbackground: #fac78e;\\/*la couleur de la page*\\/\\n}\\n\\n\\/*la grille. Elle se divise en 2 lignes et une seule colonne à 100% de la largeur de la page (1fr).*\\/\\n#container {\\n height: 100vh;\\n display: grid;\\n grid-template-columns: 1fr;\\n grid-template-rows: 1fr 1fr;\\n}\\n\\n\\/*le lien de l'image est ici dans l'url du background. Ici il faut préciser la hauteur et la largeur d'une seule image dans l'animation.*\\/\\n#sprite-image {\\n height: 50px;\\n width: 200px;\\n background: url(\\\"https:\\/\\/assets.codepen.io\\/265602\\/sprites.png\\\")\\n 0px 0px;\\n\\tjustify-self: center;\\/*aligne l'image au centre de la cellule*\\/\\n\\talign-self: end;\\/*aligne l'image au bord bas de la cellule*\\/\\n}\\n\\n\\/*la couleur de la 2e ligne qui représente le sol*\\/\\n#sol {\\n\\tbackground:#949392;\\n}\\n\",\"js\":\"var animationInterval;\\nvar spriteSheet = document.getElementById(\\\"sprite-image\\\");\\nvar widthOfSpriteSheet = 1600;\\/\\/la largeur de l'image totale\\nvar widthOfEachSprite = 200;\\/\\/la largeur d'une seule image (1600 divisé par 8)\\n\\nfunction stopAnimation() {\\n clearInterval(animationInterval);\\n}\\n\\nfunction startAnimation() {\\n var position = widthOfEachSprite;\\n const speed = 60;\\/\\/100 \\n const diff = widthOfEachSprite;\\n\\n animationInterval = setInterval(() => {\\n spriteSheet.style.backgroundPosition = `-${position}px 0px`;\\n\\n if (position < widthOfSpriteSheet) {\\n position = position + diff;\\n } else {\\n position = widthOfEachSprite;\\n }\\n }, speed);\\n}\\n\\n\\nstartAnimation();\",\"html_pre_processor\":\"none\",\"css_pre_processor\":\"none\",\"js_pre_processor\":\"none\",\"html_classes\":\"\",\"css_starter\":\"neither\",\"js_library\":null,\"created_at\":\"2022-03-02T08:26:35.887Z\",\"updated_at\":\"2022-03-02T15:04:17.303Z\",\"title\":\"Sprite animation\",\"description\":\"\",\"slug_hash\":\"bGYQJPb\",\"head\":\"\",\"private\":false,\"slug_hash_private\":\"27bc96ccb64d81730675f800ae731cbf\",\"has_animation\":true,\"team_id\":0,\"css_prefix\":\"neither\",\"template\":false,\"parent_id\":0,\"comments_count\":0,\"custom_screenshot_filename\":null,\"loves_count\":0,\"pick\":false,\"popularity_score\":0,\"views_count\":0,\"pick_visible_at\":\"2022-11-08T22:42:55.128Z\",\"pen_hash\":null,\"hashid\":\"bGYQJPb\"}"}