Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <button class="start">Start</button><div class="border"><div class="color one" data-chain="1"></div><div class="color two" data-chain="2"></div><div class="color three" data-chain="3"></div><div class="color four" data-chain="4"></div><div class="color five" data-chain="5"></div><div class="color six" data-chain="6"></div><div class="container"><div class="ball ball-up"></div></div></div><div class="score"><h1></h1></div><div class="game-over"><h1>Game Over</h1><p></p><button>↺</button></div><div class="control"><button class="left"></button><button class="right"></button></div><style>body{background:#4c010f;overflow:hidden;display:flex;flex-direction:column;margin:0}.border{width:300px;height:300px;margin:auto;position:relative;overflow:hidden;border-radius:100%;transform:rotate(345deg);transition:.1s}.container{width:90%;height:90%;position:absolute;top:5%;left:5%;border-radius:100%;transform:rotate(-345deg);background:#4c010f;transition:.1s}.color{width:100%;height:100%;position:absolute;top:50%;left:50%;transform-origin:0 0;transform:skew(15deg,15deg);transition:1s}.two{background:#fbbc05;transform:rotate(60deg)skew(15deg,15deg)}.three{background:#34a853;transform:rotate(120deg)skew(15deg,15deg)}.four{background:#4285f4;transform:rotate(180deg)skew(15deg,15deg)}.five{background:#fff;transform:rotate(240deg)skew(15deg,15deg)}.six{background:#000;transform:rotate(300deg)skew(15deg,15deg)}.one{background:#ea4335;transform:rotate(0deg)skew(15deg,15deg)}.ball{width:26px;height:26px;background:#fbbc05;position:absolute;left:calc(50% - 13px);border-radius:100%;transition:.0s linear}.ball-up{transition:.0s linear;bottom:calc(50% - 25px)}.ball-down{bottom:0;transition:.65s linear}.score h1{text-align:center;color:#fff;font-family:monospace;font-size:50px}.game-over{position:fixed;top:0;left:0;width:100%;height:100%;background:rgba(0,0,0,0.8);display:none;text-align:center;z-index:4}.game-over h1,.game-over p{color:#fff;text-align:center;font-family:sans-serif}.game-over button{background:0;border:0;outline:0;margin:auto;color:#fff;font-size:50px;cursor:pointer}.start{width:100%;font-size:40px;background:#4285f4;color:#fbbc05;border:0;outline:0;cursor:pointer;position:fixed;top:0;z-index:3}.left{position:fixed;top:0;left:0;width:50%;height:100%;border:0;z-index:1;background:0;outline:0}.right{position:fixed;top:0;right:0;width:50%;height:100%;border:0;z-index:2;background:0;outline:0}</style><script>/*<![CDATA[*/function play(){function angle(elem){var st=window.getComputedStyle(elem,null);var tr=st.getPropertyValue("-webkit-transform")||st.getPropertyValue("-moz-transform")||st.getPropertyValue("-ms-transform")||st.getPropertyValue("-o-transform")||st.getPropertyValue("transform")||"fail";var values=tr.split("(")[1].split(")")[0].split(",");var a=values[0];var b=values[1];var c=values[2];var d=values[3];var angle=Math.round(Math.atan2(b,a)*(180/Math.PI));if(angle<0){angle+=360}return angle}var colors=["#ea4335","#000000","#ffffff","#4285f4","#34a853","#fbbc05"];var _ea4335=7.5,_000000=17.5,_ffffff=27.5,_4285f4=37.5,_34a853=47.5,_fbbc05=57.5;const ball=document.querySelector(".ball");const ballBoard=document.querySelector(".container");const board=document.querySelector(".border");const right=document.querySelector(".right");const left=document.querySelector(".left");const scorepin=document.querySelector(".score h1");const gameOver=document.querySelector(".game-over");gameOver.style.display="none";const feedPlace=document.querySelector(".game-over p");var borderRotate=angle(board);window.addEventListener("keydown",function(e){if(e.keyCode==39){borderRotate+=60;board.style.transform="rotate("+borderRotate+"deg)";ballBoard.style.transform="rotate("+(-borderRotate)+"deg)"}else{if(e.keyCode==37){borderRotate-=60;board.style.transform="rotate("+borderRotate+"deg)";ballBoard.style.transform="rotate("+(-borderRotate)+"deg)"}}});right.addEventListener("click",function(){borderRotate+=60;board.style.transform="rotate("+borderRotate+"deg)";ballBoard.style.transform="rotate("+(-borderRotate)+"deg)"});left.addEventListener("click",function(){borderRotate-=60;board.style.transform="rotate("+borderRotate+"deg)";ballBoard.style.transform="rotate("+(-borderRotate)+"deg)"});function check(){var n=Math.floor(borderRotate/360),downColor=(borderRotate/6)-(60*n),background=window.getComputedStyle(ball,null).getPropertyValue("background-color");bottom=parseInt(window.getComputedStyle(ball,null).getPropertyValue("bottom"));background=background.split("(")[1].split(")")[0].split(", ");var c1=parseInt(background[0]).toString(16),c2=parseInt(background[1]).toString(16),c3=parseInt(background[2]).toString(16);if(c1.length<2){c1="0"+c1}if(c2.length<2){c2="0"+c2}if(c3.length<2){c3="0"+c3}console.log(c1.length,c2.length,c3.length);var color=c1+c2+c3;var value=eval("_"+color);if(bottom==0){if(value!=downColor){clearInterval(3);clearInterval(4);clearInterval(2);clearInterval(1);gameOver.style.display="block";ball.style.bottom="-20px";var feedback,overScore=parseInt(scorepin.innerHTML);if(overScore<=50){feedback="Your score is "+overScore+" this score mean you still student."}else{if(overScore>50||overScore<=150){feedback="Your score is "+overScore+" this score mean you becomes a teacher."}}feedPlace.innerHTML=feedback}}}var score=0;scorepin.innerHTML=score;function addPoint(){score+=1;scorepin.innerHTML=score}function bg(){var rand=Math.floor(Math.random()*6);ball.style.background=colors[rand]}function jump(){ball.classList.toggle("ball-down")}setInterval(check,1);setInterval(bg,1500);setInterval(jump,750);setInterval(addPoint,1500)}const start=document.querySelector(".start");start.addEventListener("click",function(){play();this.style.display="none"});const replay=document.querySelector(".game-over button");replay.addEventListener("click",function(){window.open("https://s.codepen.io/abomostafacobra/debug/oZvZNg/vWMRwnbxovdr","_self")});/*]]>*/</script>
              
            
!

CSS

              
                
              
            
!

JS

              
                
              
            
!
999px

Console