HTML preprocessors can make writing HTML more powerful or convenient. For instance, Markdown is designed to be easier to write and read for text documents and you could write a loop in Pug.
In CodePen, whatever you write in the HTML editor is what goes within the <body>
tags in a basic HTML5 template. So you don't have access to higher-up elements like the <html>
tag. If you want to add classes there that can affect the whole document, this is the place to do it.
In CodePen, whatever you write in the HTML editor is what goes within the <body>
tags in a basic HTML5 template. If you need things in the <head>
of the document, put that code here.
The resource you are linking to is using the 'http' protocol, which may not work when the browser is using https.
CSS preprocessors help make authoring CSS easier. All of them offer things like variables and mixins to provide convenient abstractions.
It's a common practice to apply CSS to a page that styles elements such that they are consistent across all browsers. We offer two of the most popular choices: normalize.css and a reset. Or, choose Neither and nothing will be applied.
To get the best cross-browser support, it is a common practice to apply vendor prefixes to CSS properties and values that require them to work. For instance -webkit-
or -moz-
.
We offer two popular choices: Autoprefixer (which processes your CSS server-side) and -prefix-free (which applies prefixes via a script, client-side).
Any URLs added here will be added as <link>
s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.
You can apply CSS to your Pen from any stylesheet on the web. Just put a URL to it here and we'll apply it, in the order you have them, before the CSS in the Pen itself.
You can also link to another Pen here (use the .css
URL Extension) and we'll pull the CSS from that Pen and include it. If it's using a matching preprocessor, use the appropriate URL Extension and we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
JavaScript preprocessors can help make authoring JavaScript easier and more convenient.
Babel includes JSX processing.
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.
You can apply a script from anywhere on the web to your Pen. Just put a URL to it here and we'll add it, in the order you have them, before the JavaScript in the Pen itself.
If the script you link to has the file extension of a preprocessor, we'll attempt to process it before applying.
You can also link to another Pen here, and we'll pull the JavaScript from that Pen and include it. If it's using a matching preprocessor, we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
Search for and use JavaScript packages from npm here. By selecting a package, an import
statement will be added to the top of the JavaScript editor for this package.
Using packages here is powered by esm.sh, which makes packages from npm not only available on a CDN, but prepares them for native JavaScript ESM usage.
All packages are different, so refer to their docs for how they work.
If you're using React / ReactDOM, make sure to turn on Babel for the JSX processing.
If active, Pens will autosave every 30 seconds after being saved once.
If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.
If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.
Visit your global Editor Settings.
<div id="pacman-container">
<div id="ready">
Get ready ?
</div>
<div id="gameover">
<p>Game over</p>
Play again ?<br>
<span>Yes</span> - <span>No</span>
</div>
<div id="pacman">
<div id="pacman-top"></div>
<div id="pacman-bottom"></div>
</div>
<svg version="1.0" id="ghost-red" class="ghost" viewBox="0 0 60 65">
<path class="body" fill="#F3E600" d="M18.075,53.866c0,0-9.127,11.12-14.567,10.123c-5.441-0.997-2.823-33.036-3.21-31.497c-0.388,1.54,0.884-31.488,29.516-32.47c28.632-0.983,26.982,30.38,28.931,34.185c1.947,3.806,1.842,29.151-2.056,29.846s-12.472-9.676-12.472-9.676s-7.361,8.265-12.979,9.317C25.622,64.747,18.075,53.866,18.075,53.866z"/>
<g class="eye-right_1_">
<circle class="eye-right-bck" fill="#FFFFFF" cx="40.463" cy="21.651" r="9.305"/>
<circle class="eye-right-pupil" fill="#010202" cx="41.209" cy="21.651" r="3.919"/>
</g>
<g class="eye-left_1_">
<circle class="eye-left-bck" fill="#FFFFFF" cx="17.943" cy="21.03" r="9.304"/>
<circle class="eye-left-pupil" fill="#010202" cx="17.943" cy="21.03" r="3.919"/>
</g>
</svg>
<svg version="1.0" id="ghost-blue" class="ghost" viewBox="0 0 60 65">
<path class="body" fill="#F3E600" d="M18.075,53.866c0,0-9.127,11.12-14.567,10.123c-5.441-0.997-2.823-33.036-3.21-31.497c-0.388,1.54,0.884-31.488,29.516-32.47c28.632-0.983,26.982,30.38,28.931,34.185c1.947,3.806,1.842,29.151-2.056,29.846s-12.472-9.676-12.472-9.676s-7.361,8.265-12.979,9.317C25.622,64.747,18.075,53.866,18.075,53.866z"/>
<g class="eye-right_1_">
<circle class="eye-right-bck" fill="#FFFFFF" cx="40.463" cy="21.651" r="9.305"/>
<circle class="eye-right-pupil" fill="#010202" cx="41.209" cy="21.651" r="3.919"/>
</g>
<g class="eye-left_1_">
<circle class="eye-left-bck" fill="#FFFFFF" cx="17.943" cy="21.03" r="9.304"/>
<circle class="eye-left-pupil" fill="#010202" cx="17.943" cy="21.03" r="3.919"/>
</g>
</svg>
<svg version="1.0" id="ghost-orange" class="ghost" viewBox="0 0 60 65">
<path class="body" fill="#F3E600" d="M18.075,53.866c0,0-9.127,11.12-14.567,10.123c-5.441-0.997-2.823-33.036-3.21-31.497c-0.388,1.54,0.884-31.488,29.516-32.47c28.632-0.983,26.982,30.38,28.931,34.185c1.947,3.806,1.842,29.151-2.056,29.846s-12.472-9.676-12.472-9.676s-7.361,8.265-12.979,9.317C25.622,64.747,18.075,53.866,18.075,53.866z"/>
<g class="eye-right_1_">
<circle class="eye-right-bck" fill="#FFFFFF" cx="40.463" cy="21.651" r="9.305"/>
<circle class="eye-right-pupil" fill="#010202" cx="41.209" cy="21.651" r="3.919"/>
</g>
<g class="eye-left_1_">
<circle class="eye-left-bck" fill="#FFFFFF" cx="17.943" cy="21.03" r="9.304"/>
<circle class="eye-left-pupil" fill="#010202" cx="17.943" cy="21.03" r="3.919"/>
</g>
</svg>
<svg version="1.0" id="ghost-green" class="ghost" viewBox="0 0 60 65">
<path class="body" fill="#F3E600" d="M18.075,53.866c0,0-9.127,11.12-14.567,10.123c-5.441-0.997-2.823-33.036-3.21-31.497c-0.388,1.54,0.884-31.488,29.516-32.47c28.632-0.983,26.982,30.38,28.931,34.185c1.947,3.806,1.842,29.151-2.056,29.846s-12.472-9.676-12.472-9.676s-7.361,8.265-12.979,9.317C25.622,64.747,18.075,53.866,18.075,53.866z"/>
<g class="eye-right_1_">
<circle class="eye-right-bck" fill="#FFFFFF" cx="40.463" cy="21.651" r="9.305"/>
<circle class="eye-right-pupil" fill="#010202" cx="41.209" cy="21.651" r="3.919"/>
</g>
<g class="eye-left_1_">
<circle class="eye-left-bck" fill="#FFFFFF" cx="17.943" cy="21.03" r="9.304"/>
<circle class="eye-left-pupil" fill="#010202" cx="17.943" cy="21.03" r="3.919"/>
</g>
</svg>
<div id="doors">
<div id="door-left"></div>
<div id="door-right"></div>
</div>
<svg version="1.0" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 1000">
<g id="grid">
<rect id="background" width="1000" height="1000"/>
<g id="balls">
<g id="row-r">
<circle id="r1-big" fill="#FFFFFF" cx="75" cy="925" r="15"/>
<circle id="r2" fill="#F2E002" cx="125" cy="925" r="7.5"/>
<circle id="r3" fill="#F2E002" cx="175" cy="925" r="7.5"/>
<circle id="r4" fill="#F2E002" cx="225" cy="925" r="7.5"/>
<circle id="r5" fill="#F2E002" cx="275" cy="925" r="7.5"/>
<circle id="r6" fill="#F2E002" cx="325" cy="925" r="7.5"/>
<circle id="r7" fill="#F2E002" cx="375" cy="925" r="7.5"/>
<circle id="r8" fill="#F2E002" cx="425" cy="925" r="7.5"/>
<circle id="r11" fill="#F2E002" cx="575" cy="925" r="7.5"/>
<circle id="r12" fill="#F2E002" cx="625" cy="925" r="7.5"/>
<circle id="r13" fill="#F2E002" cx="675" cy="925" r="7.5"/>
<circle id="r14" fill="#F2E002" cx="725" cy="925" r="7.5"/>
<circle id="r15" fill="#F2E002" cx="775" cy="925" r="7.5"/>
<circle id="r16" fill="#F2E002" cx="825" cy="925" r="7.5"/>
<circle id="r17" fill="#F2E002" cx="875" cy="925" r="7.5"/>
<circle id="r18-big" fill="#FFFFFF" cx="925" cy="925" r="15"/>
</g>
<g id="row-q">
<circle id="q1" fill="#F2E002" cx="75" cy="875" r="7.5"/>
<circle id="q8" fill="#F2E002" cx="425" cy="875" r="7.5"/>
<circle id="q11" fill="#F2E002" cx="575" cy="875" r="7.5"/>
<circle id="q18" fill="#F2E002" cx="925" cy="875" r="7.5"/>
</g>
<g id="row-p">
<circle id="p1" fill="#F2E002" cx="75" cy="825" r="7.5"/>
<circle id="p8" fill="#F2E002" cx="425" cy="825" r="7.5"/>
<circle id="p11" fill="#F2E002" cx="575" cy="825" r="7.5"/>
<circle id="p18" fill="#F2E002" cx="925" cy="825" r="7.5"/>
</g>
<g id="row-o">
<circle id="o1" fill="#F2E002" cx="75" cy="775" r="7.5"/>
<circle id="o2" fill="#F2E002" cx="125" cy="775" r="7.5"/>
<circle id="o3" fill="#F2E002" cx="175" cy="775" r="7.5"/>
<circle id="o4" fill="#F2E002" cx="225" cy="775" r="7.5"/>
<circle id="o5" fill="#F2E002" cx="275" cy="775" r="7.5"/>
<circle id="o6" fill="#F2E002" cx="325" cy="775" r="7.5"/>
<circle id="o7" fill="#F2E002" cx="375" cy="775" r="7.5"/>
<circle id="o8" fill="#F2E002" cx="425" cy="775" r="7.5"/>
<circle id="o11" fill="#F2E002" cx="575" cy="775" r="7.5"/>
<circle id="o12" fill="#F2E002" cx="625" cy="775" r="7.5"/>
<circle id="o13" fill="#F2E002" cx="675" cy="775" r="7.5"/>
<circle id="o14" fill="#F2E002" cx="725" cy="775" r="7.5"/>
<circle id="o15" fill="#F2E002" cx="775" cy="775" r="7.5"/>
<circle id="o16" fill="#F2E002" cx="825" cy="775" r="7.5"/>
<circle id="o17" fill="#F2E002" cx="875" cy="775" r="7.5"/>
<circle id="o18" fill="#F2E002" cx="925" cy="775" r="7.5"/>
</g>
<g id="row-n">
<circle id="n5" fill="#F2E002" cx="275" cy="725" r="7.5"/>
<circle id="n8" fill="#F2E002" cx="425" cy="725" r="7.5"/>
<circle id="n11" fill="#F2E002" cx="575" cy="725" r="7.5"/>
<circle id="n14" fill="#F2E002" cx="725" cy="725" r="7.5"/>
</g>
<g id="row-m">
<circle id="m5" fill="#F2E002" cx="275" cy="675" r="7.5"/>
<circle id="m8" fill="#F2E002" cx="425" cy="675" r="7.5"/>
<circle id="m11" fill="#F2E002" cx="575" cy="675" r="7.5"/>
<circle id="m14" fill="#F2E002" cx="725" cy="675" r="7.5"/>
</g>
<g id="row-l">
<circle id="l2" fill="#F2E002" cx="125" cy="625" r="7.5"/>
<circle id="l3" fill="#F2E002" cx="175" cy="625" r="7.5"/>
<circle id="l4" fill="#F2E002" cx="225" cy="625" r="7.5"/>
<circle id="l5" fill="#F2E002" cx="275" cy="625" r="7.5"/>
<circle id="l6" fill="#F2E002" cx="325" cy="625" r="7.5"/>
<circle id="l7" fill="#F2E002" cx="375" cy="625" r="7.5"/>
<circle id="l8" fill="#F2E002" cx="425" cy="625" r="7.5"/>
<circle id="l9" fill="#F2E002" cx="475" cy="625" r="7.5"/>
<circle id="l10" fill="#F2E002" cx="525" cy="625" r="7.5"/>
<circle id="l11" fill="#F2E002" cx="575" cy="625" r="7.5"/>
<circle id="l12" fill="#F2E002" cx="625" cy="625" r="7.5"/>
<circle id="l13" fill="#F2E002" cx="675" cy="625" r="7.5"/>
<circle id="l14" fill="#F2E002" cx="725" cy="625" r="7.5"/>
<circle id="l15" fill="#F2E002" cx="775" cy="625" r="7.5"/>
<circle id="l16" fill="#F2E002" cx="825" cy="625" r="7.5"/>
<circle id="l17" fill="#F2E002" cx="875" cy="625" r="7.5"/>
<circle id="l18" fill="#F2E002" cx="925" cy="625" r="7.5"/>
</g>
<g id="row-k">
<circle id="k1" fill="#F2E002" cx="75" cy="575" r="7.5"/>
<circle id="k5" fill="#F2E002" cx="275" cy="575" r="7.5"/>
<circle id="k14" fill="#F2E002" cx="725" cy="575" r="7.5"/>
<circle id="k18" fill="#F2E002" cx="925" cy="575" r="7.5"/>
</g>
<g id="row-j">
<circle id="j1" fill="#F2E002" cx="75" cy="525" r="7.5"/>
<circle id="j5" fill="#F2E002" cx="275" cy="525" r="7.5"/>
<circle id="j14" fill="#F2E002" cx="725" cy="525" r="7.5"/>
<circle id="j18" fill="#F2E002" cx="925" cy="525" r="7.5"/>
</g>
<g id="row-i">
<circle id="i1" fill="#F2E002" cx="75" cy="475" r="7.5"/>
<circle id="i2" fill="#F2E002" cx="125" cy="475" r="7.5"/>
<circle id="i3" fill="#F2E002" cx="175" cy="475" r="7.5"/>
<circle id="i4" fill="#F2E002" cx="225" cy="475" r="7.5"/>
<circle id="i5" fill="#F2E002" cx="275" cy="475" r="7.5"/>
<circle id="i14" fill="#F2E002" cx="725" cy="475" r="7.5"/>
<circle id="i15" fill="#F2E002" cx="775" cy="475" r="7.5"/>
<circle id="i16" fill="#F2E002" cx="825" cy="475" r="7.5"/>
<circle id="i17" fill="#F2E002" cx="875" cy="475" r="7.5"/>
<circle id="i18" fill="#F2E002" cx="925" cy="475" r="7.5"/>
</g>
<g id="row-h">
<circle id="h1" fill="#F2E002" cx="75" cy="425" r="7.5"/>
<circle id="h5" fill="#F2E002" cx="275" cy="425" r="7.5"/>
<circle id="h14" fill="#F2E002" cx="725" cy="425" r="7.5"/>
<circle id="h18" fill="#F2E002" cx="925" cy="425" r="7.5"/>
</g>
<g id="row-g">
<circle id="g1" fill="#F2E002" cx="75" cy="375" r="7.5"/>
<circle id="g5" fill="#F2E002" cx="275" cy="375" r="7.5"/>
<circle id="g6" fill="#F2E002" cx="325" cy="375" r="7.5"/>
<circle id="g7" fill="#F2E002" cx="375" cy="375" r="7.5"/>
<circle id="g8" fill="#F2E002" cx="425" cy="375" r="7.5"/>
<circle id="g9" fill="#F2E002" cx="475" cy="375" r="7.5"/>
<circle id="g10" fill="#F2E002" cx="525" cy="375" r="7.5"/>
<circle id="g11" fill="#F2E002" cx="575" cy="375" r="7.5"/>
<circle id="g12" fill="#F2E002" cx="625" cy="375" r="7.5"/>
<circle id="g13" fill="#F2E002" cx="675" cy="375" r="7.5"/>
<circle id="g14" fill="#F2E002" cx="725" cy="375" r="7.5"/>
<circle id="g18" fill="#F2E002" cx="925" cy="375" r="7.5"/>
</g>
<g id="row-f">
<circle id="f1" fill="#F2E002" cx="75" cy="325" r="7.5"/>
<circle id="f8" fill="#F2E002" cx="425" cy="325" r="7.5"/>
<circle id="f11" fill="#F2E002" cx="575" cy="325" r="7.5"/>
<circle id="f18" fill="#F2E002" cx="925" cy="325" r="7.5"/>
</g>
<g id="row-e">
<circle id="e1" fill="#F2E002" cx="75" cy="275" r="7.5"/>
<circle id="e8" fill="#F2E002" cx="425" cy="275" r="7.5"/>
<circle id="e11" fill="#F2E002" cx="575" cy="275" r="7.5"/>
<circle id="e18" fill="#F2E002" cx="925" cy="275" r="7.5"/>
</g>
<g id="row-d">
<circle id="d1" fill="#F2E002" cx="75" cy="225" r="7.5"/>
<circle id="d4" fill="#F2E002" cx="225" cy="225" r="7.5"/>
<circle id="d5" fill="#F2E002" cx="275" cy="225" r="7.5"/>
<circle id="d6" fill="#F2E002" cx="325" cy="225" r="7.5"/>
<circle id="d7" fill="#F2E002" cx="375" cy="225" r="7.5"/>
<circle id="d8" fill="#F2E002" cx="425" cy="225" r="7.5"/>
<circle id="d11" fill="#F2E002" cx="575" cy="225" r="7.5"/>
<circle id="d12" fill="#F2E002" cx="625" cy="225" r="7.5"/>
<circle id="d13" fill="#F2E002" cx="675" cy="225" r="7.5"/>
<circle id="d14" fill="#F2E002" cx="725" cy="225" r="7.5"/>
<circle id="d15" fill="#F2E002" cx="775" cy="225" r="7.5"/>
<circle id="d18" fill="#F2E002" cx="925" cy="225" r="7.5"/>
</g>
<g id="row-c">
<circle id="c1-big" fill="#FFFFFF" cx="75" cy="175" r="15"/>
<circle id="c4" fill="#F2E002" cx="225" cy="175" r="7.5"/>
<circle id="c8" fill="#F2E002" cx="425" cy="175" r="7.5"/>
<circle id="c11" fill="#F2E002" cx="575" cy="175" r="7.5"/>
<circle id="c15" fill="#F2E002" cx="775" cy="175" r="7.5"/>
<circle id="c18-big" fill="#FFFFFF" cx="925" cy="175" r="15"/>
</g>
<g id="row-b">
<circle id="b1" fill="#F2E002" cx="75" cy="125" r="7.5"/>
<circle id="b4" fill="#F2E002" cx="225" cy="125" r="7.5"/>
<circle id="b8" fill="#F2E002" cx="425" cy="125" r="7.5"/>
<circle id="b11" fill="#F2E002" cx="575" cy="125" r="7.5"/>
<circle id="b15" fill="#F2E002" cx="775" cy="125" r="7.5"/>
<circle id="b18" fill="#F2E002" cx="925" cy="125" r="7.5"/>
</g>
<g id="row-a">
<circle id="a1" fill="#F2E002" cx="75" cy="75" r="7.5"/>
<circle id="a2" fill="#F2E002" cx="125" cy="75" r="7.5"/>
<circle id="a3" fill="#F2E002" cx="175" cy="75" r="7.5"/>
<circle id="a4" fill="#F2E002" cx="225" cy="75" r="7.5"/>
<circle id="a5" fill="#F2E002" cx="275" cy="75" r="7.5"/>
<circle id="a6" fill="#F2E002" cx="325" cy="75" r="7.5"/>
<circle id="a7" fill="#F2E002" cx="375" cy="75" r="7.5"/>
<circle id="a8" fill="#F2E002" cx="425" cy="75" r="7.5"/>
<circle id="a11" fill="#F2E002" cx="575" cy="75" r="7.5"/>
<circle id="a12" fill="#F2E002" cx="625" cy="75" r="7.5"/>
<circle id="a13" fill="#F2E002" cx="675" cy="75" r="7.5"/>
<circle id="a14" fill="#F2E002" cx="725" cy="75" r="7.5"/>
<circle id="a15" fill="#F2E002" cx="775" cy="75" r="7.5"/>
<circle id="a16" fill="#F2E002" cx="825" cy="75" r="7.5"/>
<circle id="a17" fill="#F2E002" cx="875" cy="75" r="7.5"/>
<circle id="a18" fill="#F2E002" cx="925" cy="75" r="7.5"/>
</g>
</g>
<g id="borders">
<path fill="none" stroke="#009FE3" stroke-width="10" stroke-miterlimit="10" d="M130,875c-2.762,0-5-0.598-5-1.334v-47.333
c0-0.736,2.238-1.333,5-1.333H370c2.761,0,5,0.597,5,1.333v47.333c0,0.736-2.239,1.334-5,1.334H130z"/>
<path fill="none" stroke="#009FE3" stroke-width="10" stroke-miterlimit="10" d="M629.999,875c-2.761,0-4.999-0.598-4.999-1.334
v-47.333c0-0.736,2.238-1.333,4.999-1.333h240.002c2.76,0,4.999,0.597,4.999,1.333v47.333c0,0.736-2.239,1.334-4.999,1.334
H629.999z"/>
<path fill="none" stroke="#009FE3" stroke-width="10" stroke-miterlimit="10" d="M373.021,125.862
c1.1,0.009,1.986,0.605,1.979,1.329l-0.421,46.517c-0.006,0.724-0.903,1.302-2.003,1.293l-95.597-0.862
c-1.099-0.009-1.986-0.604-1.979-1.328l0.42-46.517c0.006-0.724,0.903-1.303,2.003-1.294L373.021,125.862z"/>
<path fill="none" stroke="#009FE3" stroke-width="10" stroke-miterlimit="10" d="M326,725c-0.553,0-1-0.598-1-1.334v-47.333
c0-0.736,0.447-1.333,1-1.333h48.001c0.552,0,0.999,0.597,0.999,1.333v47.333c0,0.736-0.447,1.334-0.999,1.334H326z"/>
<path fill="none" stroke="#009FE3" stroke-width="10" stroke-miterlimit="10" d="M626,725c-0.553,0-1-0.598-1-1.334v-47.333
c0-0.736,0.447-1.333,1-1.333h48.001c0.552,0,0.999,0.597,0.999,1.333v47.333c0,0.736-0.447,1.334-0.999,1.334H626z"/>
<path fill="none" stroke="#009FE3" stroke-width="10" stroke-miterlimit="10" d="M127,575c-1.105,0-2-0.598-2-1.334v-47.333
c0-0.736,0.895-1.333,2-1.333h96.001c1.104,0,1.999,0.597,1.999,1.333v47.333c0,0.736-0.895,1.334-1.999,1.334H127z"/>
<polygon fill="none" stroke="#009FE3" stroke-width="10" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" points="
125,125 175,125 175,275 375,275 375,325 225,325 225,425 125,425 "/>
<polygon fill="none" stroke="#009FE3" stroke-width="10" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" points="
875,125 825,125 825,275 625,275 625,325 775,325 775,425 875,425 "/>
<path fill="none" stroke="#009FE3" stroke-width="10" stroke-miterlimit="10" d="M777,575c-1.105,0-2-0.598-2-1.334v-47.333
c0-0.736,0.895-1.333,2-1.333h96.002c1.104,0,1.998,0.597,1.998,1.333v47.333c0,0.736-0.894,1.334-1.998,1.334H777z"/>
<path fill="none" stroke="#009FE3" stroke-width="10" stroke-miterlimit="10" d="M723.021,125.861
c1.101,0.01,1.985,0.605,1.979,1.329l-0.421,46.517c-0.007,0.724-0.903,1.303-2.003,1.293l-95.598-0.861
c-1.099-0.01-1.985-0.604-1.979-1.328l0.42-46.517c0.007-0.724,0.904-1.304,2.004-1.294L723.021,125.861z"/>
<polygon id="grid-border" fill="none" stroke="#009FE3" stroke-width="10" stroke-linejoin="round" stroke-miterlimit="10" points="
25,28.801 476.333,25 475,325 525,325 523.666,25 971.2,25 975,675 775,675 775,725 975,723.666 975,975 523.666,975 525,675
475,675 476.333,975 25,975 25,723.666 225,725 225,675 25,676.333 "/>
<polyline id="jail" fill="none" stroke="#009FE3" stroke-width="10" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" points="
425,425 325,425 325,575 675,575 675,425 575,425 "/>
</g>
</g>
</svg>
</div>
$dimpac: 500px;
body {
background-color: #000; }
#pacman-container {
position: relative;
width: $dimpac;
margin: auto;
height: $dimpac;
font-family: 'Press Start 2P', cursive;
font-size: 8px;
cursor: pointer;
overflow: hidden; }
/* TEXTES */
#ready {
font-size: 1rem;
position: absolute;
color: yellow;
top: 50%;
width: 100%;
text-align: center;
animation: ready 2s linear forwards;
z-index: 10; }
#gameover {
font-size: 1rem;
position: absolute;
color: yellow;
top: 45%;
opacity: 0;
width: 100%;
text-align: center;
animation: gameover 10s linear forwards;
z-index: 10; }
#gameover p {
color: red; }
#gameover span:hover {
border-bottom: 2px solid yellow; }
@keyframes ready {
0% , 90% { opacity: 1; }
100% { opacity: 0; }
}
@keyframes gameover {
0% , 97% { opacity: 0; }
100% { opacity: 1; }
}
/* GHOSTS */
.ghost {
width: 5%;
height: 5%;
position: absolute; }
#ghost-blue {
top: 45%;
left: 50%;
animation: ghost-blue 10s 2s linear forwards; }
#ghost-blue .body {
fill: #00aaff; }
#ghost-red {
top: 45%;
left: 45%;
animation: ghost-red 10s 2s linear forwards; }
#ghost-red .body {
fill: #ee0000; }
#ghost-green {
top: 45%;
left: 35%; }
#ghost-green .body {
fill: #00ff00; }
#ghost-orange {
top: 45%;
left: 40%; }
#ghost-orange .body {
fill: #ff6600; }
@keyframes ghost-red {
0% { left: 45%; top: 45%; }
11% { left: 45%; top: 45%; }
15% { left: 45%; top: 35%; }
23% { left: 25%; top: 35%; }
27% { left: 25%; top: 45%; }
35% { left: 5%; top: 45%; }
41% { left: 5%; top: 60%; }
67% { left: 70%; top: 60%; }
77% { left: 70%; top: 35%; }
100% { left: 70%; top: 35%; }
}
@keyframes ghost-blue {
67.5% { left: 50%; top: 45%; }
71.5% { left: 50%; top: 35%; }
74.5% { left: 60%; top: 35%; }
100% { left: 60%; top: 35%; }
}
/* PACMAN */
#pacman {
width: 5%;
height: 5%;
position: absolute;
top: 60%;
left: 5%;
animation: pacman 10s 2s linear;
animation-fill-mode: forwards;
z-index: 3; }
#pacman-top,
#pacman-bottom {
background-color: yellow;
height: 50%;
border-radius: 1000px 1000px 0 0;
animation: pacman-top 0.5s infinite linear; }
#pacman-bottom {
border-radius: 0 0 1000px 1000px;
animation: pacman-bottom 0.5s infinite linear; }
@keyframes pacman-top {
0% { transform: rotate(0deg); }
50% { transform: rotate(-35deg); }
}
@keyframes pacman-bottom {
0% { transform: rotate(0deg); }
50% { transform: rotate(35deg); }
}
@keyframes pacman {
0% {
left: 5%;
top: 60%;
transform: rotate(0deg); }
20% {
left: 55%;
top: 60%;
transform: rotate(0deg); }
20.0001% {
left: 55%;
top: 60%;
transform: rotate(90deg); }
26% {
left: 55%;
top: 75%;
transform: rotate(90deg); }
26.0001% {
left: 55%;
top: 75%;
transform: rotate(0deg); }
32% {
left: 70%;
top: 75%;
transform: rotate(0deg); }
32.0001% {
left: 70%;
top: 75%;
transform: rotate(-90deg); }
38% {
left: 70%;
top: 60%;
transform: rotate(-90deg); }
38.0001% {
left: 70%;
top: 60%;
transform: rotate(-180deg); }
42% {
left: 60%;
top: 60%;
transform: rotate(-180deg); }
42.0001% {
left: 60%;
top: 60%;
transform: rotate(0deg); }
54% {
left: 90%;
top: 60%;
transform: rotate(0deg); }
54.0001% {
left: 90%;
top: 60%;
transform: rotate(-90deg); }
60% {
left: 90%;
top: 45%;
transform: rotate(-90deg); }
60.0001% {
left: 90%;
top: 45%;
transform: rotate(-180deg); }
68% {
left: 70%;
top: 45%;
transform: rotate(-180deg); }
68.0001% {
left: 70%;
top: 45%;
transform: rotate(-90deg); }
72% {
left: 70%;
top: 35%;
transform: rotate(-90deg); }
72.0001% {
left: 70%;
top: 35%;
transform: rotate(-180deg); }
76% {
left: 60%;
top: 35%;
transform: rotate(-180deg); }
82% {
left: 60%;
top: 35%;
width: 5%;
height: 5%; }
88% {
left: 62.5%;
top: 37.5%;
width: 0px;
height: 0px; }
100% {
width: 0px;
height: 0px;
transform: rotate(-180deg); }
}
/* DOORS */
#doors {
width: 16%;
height: 2%;
position: absolute;
top: 41.5%;
left: 42%; }
#door-left {
position: absolute;
top: 0;
left: 0;
height: 100%;
width: 50%;
background-color: red;
animation: door-open-left 10s 2s linear forwards; }
#door-right {
position: absolute;
top: 0;
right: 0;
height: 100%;
width: 50%;
background-color: red;
animation: door-open-right 10s 2s linear forwards; }
@keyframes door-open-left {
0% { transform: translateX(0); }
10% { transform: translateX(0); }
10.5% { transform: translateX(-80%); }
20% { transform: translateX(-80%); }
20.5% { transform: translateX(0); }
66.5% { transform: translateX(0); }
67% { transform: translateX(-80%); }
77% { transform: translateX(-80%); }
77.5% { transform: translateX(0); }
100% { transform: translateX(0); }
}
@keyframes door-open-right {
0% { transform: translateX(0); }
10% { transform: translateX(0); }
10.5% { transform: translateX(80%); }
20% { transform: translateX(80%); }
20.5% { transform: translateX(0); }
66.5% { transform: translateX(0); }
67% { transform: translateX(80%); }
77% { transform: translateX(80%); }
77.5% { transform: translateX(0); }
100% { transform: translateX(0); }
}
/* BALLS */
$balls: #l2 #l3 #l4 #l5 #l6 #l7 #l8 #l9 #l10 #l11 #m11 #n11 #o11 #o12 #o13 #o14 #n14 #m14 #l14 #l13 #l12 #aa #bb #l15 #l16 #l17 #l18 #k18 #j18 #i18 #i17 #i16 #i15 #i14 #h14 #g14 #g13;
$i: 2;
@each $ball in $balls {
#{$ball} {
animation: ball 5ms $i+0.2s forwards; }
$i: $i+0.2;
}
@-webkit-keyframes ball {
100% {
opacity: 0; }
}
@keyframes ball {
0% { }
100% { opacity: 0;}
}
/* UNIQUEMENT POUR RELANCER L'ANIM EN CLIQUANT */
$(document).ready(function() {
$("#pacman-container").click(function() {
newone = $(this).html();
$(this).html(newone);
});
});
Also see: Tab Triggers