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.
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 500 500">
<path id="bg" fill="#CAE0D3" d="M0 0h500v500H0z"/>
<g id="house">
<path id="livingroom" fill="#FBE5A6" d="M150.5 203.2h169.4v98H150.5z"/>
<path id="dressingroom" fill="#FBE5A6" d="M81 201.6l-20.9 15.6-1.8 84h92.2v-99.6z"/>
<path id="kitchen" fill="#FBE5A6" d="M319.9 200.6H450v100.6H319.9z"/>
<path id="bedroom" fill="#FBE5A6" d="M101.1 106.9h158v94.8h-158z"/>
<path id="bathroom" fill="#FBE5A6" d="M357.7 132.5v-25.6h-98.6v90h186v-13.7z"/>
<path id="cabinet" fill="#FBE5A6" d="M106.1 80.6v26.3h251.6V80.6L231.9 13.2z"/>
<path id="ground" fill="#4F695A" d="M466.8 320.9H37.5c-3.8 0-7-3.1-7-7v-.9c0-3.9 3.2-7 7-7h429.3c3.9 0 7 3.1 7 7v.9c0 3.8-3.2 7-7 7z"/>
<g fill="#FFF3DB">
<path class="place place-livingroom-table" d="M248.2 284.3v12.1h5.4v-12.1h40.3v12.1h5.4v-16h-51.1z"/>
<path class="place place-tv" d="M248.9 272.1c0 .6.5 1.2 1.2 1.2h47.3c.6 0 1.2-.5 1.2-1.2V247c0-.6-.5-1.2-1.2-1.2h-47.3c-.6 0-1.2.5-1.2 1.2v25.1z"/>
<path class="place place-bookcase" d="M251.3 102.1h4.9v-3.4h15.7v3.4h5v-3.4h1.5V44.6h-28.6V98.7h1.5z"/>
<path class="place place-bedroom-lamp" d="M179 141.1c2.4 0 4.5-1 5.2-2.5h8.8c0-3.2-2.1-5.9-4.7-5.9h-6.1v-2.5h-2.4v-18.5h-1.7v18.5h-2.4v2.5h-6.1c-2.6 0-4.7 2.6-4.7 5.9h8.8c.8 1.4 2.8 2.5 5.3 2.5z"/>
<path class="place place-cabinet-chair" d="M168.9 94.3h13v7.8h2.9V87.8c0-2.1-1.7-3.7-3.7-3.7h-9.9V66.5c0-1-.8-1.9-1.9-1.9H168c-1 0-1.9.8-1.9 1.9V102h2.9v-7.7zm13-4v2.9h-13v-2.9h13z"/>
<path class="place place-kitchen-chair-2" d="M438.6 258.4h-1.4c-1 0-1.9.8-1.9 1.9v17.8h-10c-2.1 0-3.8 1.7-3.8 3.8v14.5h2.9v-7.9h13.2v7.9h2.9v-36.2c-.1-1-.9-1.8-1.9-1.8zm-1.1 28.9h-13.2v-3h13.2v3z"/>
<path class="place place-kitchen-chair-1" d="M346.3 278.1h-10v-17.8c0-1-.8-1.9-1.9-1.9H333c-1 0-1.9.8-1.9 1.9v36.2h2.9v-7.9h13.2v7.9h2.9V282c0-2.2-1.7-3.9-3.8-3.9zm.9 9.2H334v-3h13.2v3z"/>
<path class="place place-kitchen-table" d="M394.3 261.3c0-1.6-1.3-3-3-3h-11c-1.6 0-3 1.3-3 3v7.8h-23.6v9.3c0 1.9 1.4 3.4 3.1 3.4.5 0 1-.1 1.4-.4v14.9h5.1V281l.2-.2c.6.6 1.4 1 2.2 1 .9 0 1.7-.4 2.2-1 .6.6 1.4 1 2.2 1 .9 0 1.7-.4 2.2-1 .5.6 1.2.9 2 1V296.4h2.9v-12h16.9v12h2.9V281.8c.8-.1 1.5-.4 2-1 .6.6 1.4 1 2.2 1 .9 0 1.7-.4 2.2-1 .6.6 1.4 1 2.2 1 .9 0 1.7-.4 2.2-1l.2.2v15.4h5.1v-14.9c.4.2.9.4 1.4.4 1.7 0 3.1-1.5 3.1-3.4V269.2H394v-7.9z"/>
<path class="place place-locker" d="M123.8 228.5h-17.5v65.3h1.6v2.6h6.2v-2.6h19.5v2.6h6.2v-2.6h1.6v-65.3h-17.6z"/>
<path class="place place-bedroom-table-1" d="M112.5 186.2h3.5v10.7h2.8v-10.7h10.4v10.7h2.8v-10.7h3.5v-4.7h3.5V180h-30v1.5h3.5z"/>
<path class="place place-bedroom-table-2" d="M248.9 180h-30v1.5h3.5v4.7h3.5v10.7h2.8v-10.7h10.4v10.7h2.8v-10.7h3.5v-4.7h3.5z"/>
<g class="place place-bed">
<path d="M207.8 193.3v3.6h6.3v-18.1H143.8v18.1h6.3v-3.6z"/>
<path d="M214.1 177.1c0-1.1-.9-2-2-2h-2.8v-9.5c0-2-1.7-3.7-3.7-3.7h-53.2c-2 0-3.7 1.7-3.7 3.7v9.5h-2.8c-1.1 0-2 .9-2 2v1.7h70.3v-1.7z"/>
</g>
<g class="place place-laptop">
<path d="M203.7 74.3h10.2l-2.1 3.7h10l-2.1-3.7h10.2c.6 0 1.1-.5 1.1-1.1V54.4c0-.6-.5-1.1-1.1-1.1h-26.2c-.6 0-1.1.5-1.1 1.1v18.8c0 .6.5 1.1 1.1 1.1z"/>
<path d="M193.4 102.1h16.7V83.9h25.7v18.2h4.3V78h-46.7v24.1z"/>
</g>
<path class="place place-kitchen-lamp" d="M380.9 236.6c.4 2 2.4 3.5 4.9 3.5 2.5 0 4.5-1.5 4.9-3.5 2.8.2 5.3.5 7.6 1 .3-.6.4-1.2.4-1.9 0-3.5-3.9-6.4-9.3-7.3v-1.7h-2.6v-20.2h-1.9v20.2h-2.6v1.7c-5.4.9-9.3 3.8-9.3 7.3 0 .6.1 1.3.4 1.9 2.1-.5 4.7-.8 7.5-1z"/>
<path class="place place-bath" d="M325.1 177.6h-40.4v-26.9c0-3.2 2.6-5.9 5.9-5.9 2.9 0 5.3 2.1 5.8 4.8-2.5.8-4.2 3-4.2 5.7h-.2c-.4 0-.8.3-.8.8v.3c0 .4.3.8.8.8h12.9c.4 0 .8-.3.8-.8v-.3c0-.4-.3-.8-.8-.8h-.2c0-2.6-1.8-4.9-4.2-5.7-.5-5-4.7-8.9-9.8-8.9-5.5 0-9.9 4.4-9.9 9.9v26.9h-4.4c-.9 0-1.7.7-1.7 1.7v.7c0 .9.7 1.7 1.7 1.7h.2v6.6c0 4.4 3.6 8.1 8.1 8.1H317c4.4 0 8.1-3.6 8.1-8.1v-6.6h.2c.9 0 1.7-.7 1.7-1.7v-.7c-.3-.9-1-1.6-1.9-1.6z"/>
<path class="place place-toilet" d="M374.3 177.6h-.2c.6 4.3 3.7 7.7 7.9 8.9v.9c0 4.2 2.8 7.7 6.5 9h9.9c.2-.1.4-.3.5-.5.4-.5.5-1.3.1-1.9-1.1-1.5-1.7-3.3-1.7-5.3 0-2.2.8-4.3 2.1-5.9v-16.4c0-.9-.7-1.6-1.6-1.6h-4.3c-.9 0-1.6.7-1.6 1.6v11.3h-1.1c.5 0 .9-.5.9-1.2s-.4-1.2-.9-1.2h-16.6c-.5 0-.9.6-.9 1.2s.5 1.1 1 1.1z"/>
<path class="place place-bathroom-table" d="M361.5 169.5h-2.7c.8 0 1.5-.7 1.5-1.5v-1.6c0-.8-.7-1.5-1.5-1.5h-.9c.8 0 1.4-.7 1.4-1.5v-1.6c0-.8-.6-1.5-1.4-1.5.8 0 1.4-.7 1.4-1.5v-1.6c0-.8-.6-1.5-1.4-1.5H341c-.8 0-1.4.7-1.4 1.5v1.6c0 .8.6 1.5 1.4 1.5-.8 0-1.4.7-1.4 1.5v1.6c0 .8.6 1.5 1.4 1.5h-1c-.8 0-1.5.7-1.5 1.5v1.6c0 .8.7 1.5 1.5 1.5h-3v26.8h24.5v-26.8z"/>
<path class="place place-sofa" d="M236.1 274H232v-8.8c0-1.8-1.4-3.2-3.2-3.2h-54.1c-1.8 0-3.2 1.4-3.2 3.2v8.8h-4.2c-1.4 0-2.6 1.2-2.6 2.6v15.5h2.9v4.2h6.7v-2.7h54.9v2.7h6.7v-4.2h2.9v-15.5c0-1.4-1.2-2.6-2.7-2.6z"/>
<path class="place place-painting" d="M182.7 224.6v24.3c0 1.2 1 2.1 2.1 2.1h33.9c1.2 0 2.1-1 2.1-2.1v-24.3c0-1.2-1-2.1-2.1-2.1h-33.9c-1.2-.1-2.1.9-2.1 2.1z"/>
<path class="place place-dressingroom-table" d="M64.9 276.3h4.5v6.1H74v14h3.7v-14h13.6v14H95v-14h4.5v-6.1h4.6v-2H64.9z"/>
<path class="place place-mirror" d="M78.9 265.7h11.2c2.4 0 4.3-1.9 4.3-4.3v-17.2c0-2.4-1.9-4.3-4.3-4.3H78.9c-2.4 0-4.3 1.9-4.3 4.3v17.2c0 2.4 1.9 4.3 4.3 4.3z"/>
</g>
</g>
<g class="item item-kitchen-chair-2" data-item="kitchen-chair-2" data-room='kitchen'>
<path fill="#817356" d="M424.2 367.8h-1.4c-1.1 0-2 .9-2 2v19.9c0 1.1.9 2 2 2h1.4c1.1 0 2-.9 2-2v-19.9c0-1.1-.9-2-2-2z"/>
<g fill="#817356">
<path d="M406.4 394.2h3v13.4h-3z"/>
<path d="M423.2 394.2h3v13.4h-3z"/>
</g>
<path fill="#AAA08D" d="M410.3 388.4c-2.2 0-4 1.8-4 4v2.6h19.8v-6.6h-15.8z"/>
<path fill="#817356" d="M406.6 398.1h17.7v1.2h-17.7z"/>
</g>
<g class="item item-kitchen-chair-1" data-item="kitchen-chair-1" data-room='kitchen'>
<path fill="#817356" d="M314 367.8h1.4c1.1 0 2 .9 2 2v19.9c0 1.1-.9 2-2 2H314c-1.1 0-2-.9-2-2v-19.9c0-1.1.9-2 2-2z"/>
<g fill="#817356">
<path d="M328.8 394.2h3v13.4h-3z"/>
<path d="M312 394.2h3v13.4h-3z"/>
</g>
<path fill="#AAA08D" d="M327.9 388.4c2.2 0 4 1.8 4 4v2.6H312v-6.6h15.9z"/>
<path fill="#817356" d="M313.9 398.1h17.7v1.2h-17.7z"/>
</g>
<g class="item item-kitchen-table" data-item="kitchen-table" data-room='kitchen'>
<path fill="#817356" d="M374.8 367.8h-11.5c-1.7 0-3.1 1.4-3.1 3.1v17.7c0 1.7 1.4 3.1 3.1 3.1h11.5c1.7 0 3.1-1.4 3.1-3.1v-17.7c.1-1.7-1.3-3.1-3.1-3.1z"/>
<g fill="#817356">
<path d="M357.2 394.2h3v13.4h-3z"/>
<path d="M377.9 394.2h3v13.4h-3z"/>
</g>
<path fill="#AAA08D" d="M378.4 388.4h-18.6c-1.4 0-2.5 1.1-2.5 2.5v4.1H381v-4.1c0-1.4-1.2-2.5-2.6-2.5z"/>
<path opacity=".2" fill="#1E0F00" d="M378.4 388.4h-.4v-17.5c0-1.7-1.4-3.1-3.1-3.1h-5.7V395h8.8v12.5h3V391c0-1.5-1.2-2.6-2.6-2.6z"/>
<g>
<path fill="#AAA08D" d="M335.6 379.1h66.9v7h-66.9z"/>
<g fill="#817356">
<path d="M340.4 386.1h5.3v21.5h-5.3z"/>
<path d="M392.5 386.1h5.3v21.5h-5.3z"/>
</g>
<path opacity=".5" fill="#CB7861" d="M335.6 379.3v9.5c0 2 1.5 3.5 3.3 3.5.9 0 1.7-.4 2.3-1.1.6.6 1.4 1.1 2.3 1.1.9 0 1.7-.4 2.3-1.1.6.6 1.4 1.1 2.3 1.1.9 0 1.7-.4 2.3-1.1.6.6 1.4 1.1 2.3 1.1.9 0 1.7-.4 2.3-1.1.6.6 1.4 1.1 2.3 1.1.9 0 1.7-.4 2.3-1.1.6.6 1.4 1.1 2.3 1.1s1.7-.4 2.3-1.1c.6.6 1.4 1.1 2.3 1.1.9 0 1.7-.4 2.3-1.1.6.6 1.4 1.1 2.3 1.1s1.7-.4 2.3-1.1c.6.6 1.4 1.1 2.3 1.1s1.7-.4 2.3-1.1c.6.6 1.4 1.1 2.3 1.1.9 0 1.7-.4 2.3-1.1.6.6 1.4 1.1 2.3 1.1.9 0 1.7-.4 2.3-1.1.6.6 1.4 1.1 2.3 1.1.9 0 1.7-.4 2.3-1.1.6.6 1.4 1.1 2.3 1.1.9 0 1.7-.4 2.3-1.1.6.6 1.4 1.1 2.3 1.1 1.8 0 3.3-1.6 3.3-3.5v-9.5h-66.4z"/>
<path opacity=".2" fill="#1E0F00" d="M369.1 391.3c.6.6 1.4 1.1 2.3 1.1s1.7-.4 2.3-1.1c.6.6 1.4 1.1 2.3 1.1s1.7-.4 2.3-1.1c.6.6 1.4 1.1 2.3 1.1.9 0 1.7-.4 2.3-1.1.6.6 1.4 1.1 2.3 1.1.9 0 1.7-.4 2.3-1.1.6.6 1.4 1.1 2.3 1.1.9 0 1.7-.4 2.3-1.1l.2.2v16.1h5.3V392c.4.2.9.4 1.5.4 1.8 0 3.3-1.6 3.3-3.5v-9.7h-33.5v12.1z"/>
</g>
</g>
<g class="item item-kitchen-lamp" data-item="kitchen-lamp" data-room='kitchen'>
<path fill="#817356" d="M335.9 338.7h1.7v19.1h-1.7z"/>
<ellipse fill="#EBB177" cx="336.7" cy="365.3" rx="4.5" ry="3.7"/>
<path fill="#AA5541" d="M333.6 356.9h6.4v2.5h-6.4z"/>
<path fill="#CB7861" d="M336.7 365.7c4.2 0 8 .4 11.2 1 .2-.5.3-1.1.3-1.7 0-3.8-5.2-6.9-11.6-6.9-6.4 0-11.6 3.1-11.6 6.9 0 .6.1 1.1.3 1.7 3.4-.6 7.3-1 11.4-1z"/>
<path opacity=".2" fill="#1E0F00" d="M339.9 358.5V357h-2.3v-18.2h-.8V369c2.2 0 4.1-1.4 4.4-3.1 2.5.2 4.8.5 6.8.9.2-.5.3-1.1.3-1.7 0-3.2-3.6-5.8-8.4-6.6z"/>
</g>
<g class="item item-bedroom-table-2" data-item="bedroom-table-2" data-room='bedroom'>
<path fill="#AAA08D" d="M57.4 455.3h20.7v4.2H57.4z"/>
<g fill="#817356">
<path d="M60.5 459.5H63v9.6h-2.5z"/>
<path d="M72.4 459.5h2.5v9.6h-2.5z"/>
</g>
<path fill="#817356" d="M54.3 454h27v1.3h-27z"/>
<path fill="#513C2E" d="M63.8 456.9h8v.9h-8z"/>
<path opacity=".2" fill="#1E0F00" d="M67.8 459.5h4.6v9.7H75v-9.7h3.1v-4.2h3.1V454H67.8z"/>
</g>
<g class="item item-bedroom-table-1" data-item="bedroom-table-1" data-room='bedroom'>
<path fill="#AAA08D" d="M156.4 455.3h20.7v4.2h-20.7z"/>
<g fill="#817356">
<path d="M159.5 459.5h2.5v9.6h-2.5z"/>
<path d="M171.4 459.5h2.5v9.6h-2.5z"/>
</g>
<path fill="#817356" d="M153.2 454h27v1.3h-27z"/>
<path fill="#513C2E" d="M162.7 456.9h8v.9h-8z"/>
<path opacity=".2" fill="#1E0F00" d="M166.7 459.5h4.7v9.7h2.6v-9.7h3.1v-4.2h3.1V454h-13.5z"/>
</g>
<g class="item item-bed" data-item="bed" data-room='bedroom'>
<path fill="#AAA08D" d="M90 452.8h54.5v13.1H90z"/>
<path fill="#817356" d="M143.3 452.8h5.6v16.3h-5.6z"/>
<path fill="#817356" d="M85.6 452.8h5.6v16.3h-5.6z"/>
<path fill="#AAA08D" d="M141.2 437.5H93.3c-1.8 0-3.3 1.5-3.3 3.3v8.6h54.5v-8.6c0-1.8-1.5-3.3-3.3-3.3z"/>
<path fill="#EBB177" d="M147.1 449.5H87.4c-1 0-1.8.8-1.8 1.8v1.5h63.3v-1.5c0-1-.8-1.8-1.8-1.8z"/>
<g fill="#8BB29E">
<path d="M111 445.2H97.1c-1.5 0-2.7 1.2-2.7 2.7v1.6h19.2v-1.6c.1-1.5-1.1-2.7-2.6-2.7z"/>
<path d="M137.4 445.2h-13.9c-1.5 0-2.7 1.2-2.7 2.7v1.6H140v-1.6c0-1.5-1.2-2.7-2.6-2.7z"/>
</g>
<path opacity=".2" fill="#1E0F00" d="M147.1 449.5h-2.6v-8.6c0-1.8-1.5-3.3-3.3-3.3h-23.9V466h26v3.3h5.6v-17.8c0-1.2-.8-2-1.8-2z"/>
</g>
<g class="item item-bedroom-lamp" data-item="bedroom-lamp" data-room='bedroom'>
<path fill="#817356" d="M166.3 413.2h1.5v17.4h-1.5z"/>
<ellipse fill="#EBB177" cx="167" cy="436.4" rx="5" ry="3.3"/>
<path fill="#0F626D" d="M164.1 429.9h5.8v2.3h-5.8z"/>
<path fill="#6F8282" d="M175.4 432.1h-16.8c-2.3 0-4.2 2.4-4.2 5.3h25.2c0-2.9-1.9-5.3-4.2-5.3z"/>
<path opacity=".2" fill="#1E0F00" d="M175.4 432.1h-5.5v-2.3h-2.1v-16.6h-.8v26.5c2.2 0 4-.9 4.7-2.2h7.9c0-3-1.9-5.4-4.2-5.4z"/>
</g>
<g>
<g class="item item-bookcase" data-item="bookcase" data-room='cabinet'>
<path fill="#FFF3DB" d="M277.4 418.4h25.8v48.7h-25.8z"/>
<path fill="#AAA08D" d="M277.4 430.9h25.8v2.8h-25.8z"/>
<path fill="#AAA08D" d="M277.4 441.5h25.8v2.8h-25.8z"/>
<path fill="#AAA08D" d="M277.4 452.1h25.8v2.8h-25.8z"/>
<path fill="#AAA08D" d="M300.3 421.3v43.1h-20.1v-43.1h20.1zm2.8-2.9h-25.8v48.7h25.8v-48.7z"/>
<path fill="#AAA08D" d="M277.4 418.4h25.8v5.3h-25.8z"/>
<path fill="#AAA08D" d="M277.4 461.8h25.8v5.3h-25.8z"/>
<g fill="#817356">
<path d="M297.3 467.2h4.5v3.1h-4.5z"/>
<path d="M278.7 467.2h4.5v3.1h-4.5z"/>
</g>
<path fill="#CB7861" d="M292.9 424.6h2v6.3h-2z"/>
<path fill="#6F8282" d="M294.9 424.6h2v6.3h-2z"/>
<path fill="#4F695A" d="M297 424.6h2v6.3h-2z"/>
<path fill="#4F695A" d="M297 426.5h2v1.5h-2z"/>
<path fill="#0F626D" d="M294.9 425.1h2v.4h-2z"/>
<path fill="#0F626D" d="M294.9 425.7h2v.4h-2z"/>
<path fill="#4F695A" d="M292.9 425.5h2v.4h-2z"/>
<g>
<path fill="#6F8282" d="M289.6 445.8h2v6.3h-2z"/>
<path fill="#0F626D" d="M289.6 447.7h2v2.5h-2z"/>
<path fill="#CB7861" d="M287.902 445.62l1.716 1.027-3.24 5.404-1.714-1.027z"/>
<path fill="#4F695A" d="M288.917 447.838l-1.716-1.028.207-.343 1.715 1.028z"/>
</g>
<g>
<path fill="#4F695A" d="M293.3 445.8h2v6.3h-2z"/>
<path fill="#0F626D" d="M295.4 445.8h2v6.3h-2z"/>
<path fill="#CB7861" d="M297.4 445.8h2v6.3h-2z"/>
<path fill="#4F695A" d="M297.4 447.7h2v1.5h-2z"/>
<path fill="#6F8282" d="M295.4 446.4h2v.4h-2z"/>
<path fill="#6F8282" d="M295.4 447.9h2v.4h-2z"/>
<path fill="#CB7861" d="M293.3 446.7h2v.4h-2z"/>
</g>
<g>
<path fill="#4F695A" d="M285.9 455.5h2v6.3h-2z"/>
<path fill="#CB7861" d="M289 455.5h2v6.3h-2z"/>
<path fill="#4F695A" d="M289 457.4h2v1.5h-2z"/>
<path fill="#0F626D" d="M285.9 456.5h2v.4h-2z"/>
</g>
<g>
<path fill="#4F695A" d="M283.5 435.2h2v6.3h-2z"/>
<path fill="#0F626D" d="M285.544 436.098l1.758-.954 3.005 5.538-1.758.954z"/>
<path fill="#4F695A" d="M288.954 438.083l-1.758.954-.716-1.32 1.758-.952z"/>
<path fill="#4F695A" d="M283.5 436.1h2v.4h-2z"/>
<path fill="#4F695A" d="M283.5 437h2v.4h-2z"/>
</g>
<path opacity=".2" fill="#1E0F00" d="M289.6 467.2h7.7v3h4.5v-3h1.3V418.4h-13.5z"/>
</g>
<g class="item item-cabinet-chair" data-item="cabinet-chair" data-room='cabinet'>
<path fill="#817356" d="M203.7 436.5h1.2c.9 0 1.7.8 1.7 1.7v16.9c0 .9-.8 1.7-1.7 1.7h-1.2c-.9 0-1.7-.8-1.7-1.7v-16.9c0-1 .7-1.7 1.7-1.7z"/>
<g fill="#817356">
<path d="M216.3 458.9h2.6v11.4h-2.6z"/>
<path d="M202 458.9h2.6v11.4H202z"/>
</g>
<path fill="#AAA08D" d="M215.5 454c1.9 0 3.4 1.5 3.4 3.4v2.2H202V454h13.5z"/>
<path fill="#817356" d="M203.6 462.2h15v1.1h-15z"/>
</g>
<g class="item item-laptop" data-item="laptop" data-room='cabinet'>
<path fill="#656466" d="M243.2 448.5l4.4-8 4.5 8z"/>
<path fill="#6F8282" d="M259.5 426.3h-23.6c-.5 0-1 .4-1 1v16.9c0 .5.4 1 1 1h23.6c.5 0 1-.4 1-1v-16.9c-.1-.5-.5-1-1-1z"/>
<path fill="#4F695A" d="M236.1 428.1v14.5h23.1v-14.5z"/>
<path d="M258.7 428.7v13.2h-22.1v-13.2h22.1zm.5-.6h-23v14.5h23v-14.5z" opacity=".15"/>
<path opacity=".2" fill="#1E0F00" d="M259.6 426.3h-12v22.1h4.5l-1.9-3.3h9.4c.4 0 .8-.4.8-.8v-17.2c0-.4-.3-.8-.8-.8z"/>
<g>
<path fill="#AAA08D" d="M226.6 448.5h42.1v5.3h-42.1z"/>
<g fill="#817356">
<path d="M226.6 453.9h3.9v16.4h-3.9z"/>
<path d="M264.8 453.9h3.9v16.4h-3.9z"/>
</g>
<g>
<path fill="#817356" d="M226.6 453.9h15v16.4h-15z"/>
<path fill="#AAA08D" d="M228.3 455H240v4h-11.7z"/>
<path fill="#AAA08D" d="M228.3 460H240v4h-11.7z"/>
<path fill="#AAA08D" d="M228.3 465.1H240v4h-11.7z"/>
<path fill="#513C2E" d="M232.3 455.6h3.5v.7h-3.5z"/>
<path fill="#513C2E" d="M232.3 460.6h3.5v.7h-3.5z"/>
<path fill="#513C2E" d="M232.3 465.6h3.5v.7h-3.5z"/>
</g>
</g>
<path opacity=".2" fill="#1E0F00" d="M247.6 453.9h17.2v16.3h3.9V448.5h-21.1z"/>
</g>
</g>
<g>
<g class="item item-locker" data-item="locker" data-room='dressingroom'>
<g fill="#513C2E">
<path d="M276.8 405.2h5.6v2.3h-5.6z"/>
<path d="M253.6 405.2h5.6v2.3h-5.6z"/>
</g>
<path fill="#817356" d="M252.2 346.4h31.6v58.9h-31.6z"/>
<path fill="#AAA08D" d="M254.5 346.4h26.9v58.8h-26.9z"/>
<path fill="#817356" d="M267.4 346.4h.6v58.9h-.6z"/>
<path fill="#513C2E" d="M263.3 369.7h1.9V382h-1.9z"/>
<path fill="#513C2E" d="M270.7 369.7h1.9V382h-1.9z"/>
<path opacity=".2" fill="#1E0F00" d="M268 346.4v58.8h8.8v2.3h5.6v-2.3h1.4v-58.8h-15.5z"/>
</g>
<g class="item item-dressingroom-table" data-item="dressingroom-table" data-room='dressingroom'>
<path fill="#AAA08D" d="M209.8 389.4h27.1v5.5h-27.1z"/>
<g fill="#817356">
<path d="M213.8 394.9h3.3v12.6h-3.3z"/>
<path d="M229.4 394.9h3.3v12.6h-3.3z"/>
</g>
<path fill="#817356" d="M205.6 387.7h35.3v1.8h-35.3z"/>
<path fill="#513C2E" d="M218.1 391.5h10.4v1.2h-10.4z"/>
<path opacity=".2" fill="#1E0F00" d="M223.3 394.9h6.1v12.6h3.4v-12.6h4v-5.5h4.2v-1.7h-17.7z"/>
</g>
<g class="item item-mirror" data-item="mirror" data-room='dressingroom'>
<path fill="#8BB29E" d="M228.3 356.7h-10c-2.1 0-3.9 1.7-3.9 3.9v15.5c0 2.1 1.7 3.9 3.9 3.9h10c2.1 0 3.9-1.7 3.9-3.9v-15.5c0-2.1-1.8-3.9-3.9-3.9z"/>
<path fill="#FFF3DB" d="M218.3 377.1c-.5 0-1-.4-1-1v-15.5c0-.5.4-1 1-1h10c.5 0 1 .4 1 1v15.5c0 .5-.4 1-1 1h-10z"/>
<path opacity=".2" fill="#1E0F00" d="M228.3 356.7h-5V380h5c2.1 0 3.9-1.7 3.9-3.9v-15.5c0-2.1-1.8-3.9-3.9-3.9z"/>
</g>
</g>
<g>
<g class="item item-livingroom-table" data-item="livingroom-table" data-room='livingroom'>
<path fill="#AAA08D" d="M134.9 393.2h46v3.5h-46z"/>
<g fill="#817356">
<path d="M134.9 396.7h4.9v10.8h-4.9z"/>
<path d="M176 396.7h4.9v10.8H176z"/>
</g>
<path opacity=".2" fill="#1E0F00" d="M157.9 396.7H176v10.8h4.9v-14.3h-23z"/>
</g>
<g class="item item-tv" data-item="tv" data-room='livingroom'>
<path fill="#6F8282" d="M179.2 362.1h-42.6c-.6 0-1.1.5-1.1 1.1v22.6c0 .6.5 1.1 1.1 1.1h42.6c.6 0 1.1-.5 1.1-1.1v-22.6c0-.7-.5-1.1-1.1-1.1z"/>
<path fill="#4F695A" d="M137.7 364.4V383.3h40.4v-18.9z"/>
<path fill="#595653" d="M156.1 384.5h3.6v1h-3.6z"/>
<path d="M177.3 365.2v17.3h-38.7v-17.3h38.7zm.8-.8h-40.3V383.3h40.3v-18.9z" opacity=".15"/>
<path opacity=".2" fill="#1E0F00" d="M179.2 362.1h-21.3v24.7h21.3c.6 0 1.1-.5 1.1-1.1v-22.6c0-.6-.5-1-1.1-1z"/>
</g>
<g class="item item-sofa" data-item="sofa" data-room='livingroom'>
<path fill="#817356" d="M62.3 403.4h61.5v1.7H62.3z"/>
<path fill="#EBB177" d="M117.4 376.7H68.7c-1.6 0-2.9 1.3-2.9 2.9v13.9c0 1.6 1.3 2.9 2.9 2.9h48.7c1.6 0 2.9-1.3 2.9-2.9v-13.9c0-1.7-1.3-2.9-2.9-2.9z"/>
<path fill="#AA5541" d="M70.5 393.1h45.1v2.7H70.5z"/>
<g fill="#CB7861">
<path d="M59.7 395.8h66.6v7.9H59.7z"/>
<path d="M68.3 387.4h-6.2c-1.3 0-2.4 1.1-2.4 2.4v6.5h10.9v-6.5c.1-1.3-1-2.4-2.3-2.4z"/>
<path d="M124 387.4h-6.2c-1.3 0-2.4 1.1-2.4 2.4v6.5h10.9v-6.5c.1-1.3-1-2.4-2.3-2.4z"/>
</g>
<g fill="#817356">
<path d="M117.8 405.1h6v2.4h-6z"/>
<path d="M62.3 405.1h6v2.4h-6z"/>
</g>
<g fill="#FFF3DB">
<path d="M109 393.1h-7.4c-1.4 0-2.5-1.1-2.5-2.5v-.3c0-1.4 1.1-2.5 2.5-2.5h7.4c1.4 0 2.5 1.1 2.5 2.5v.3c0 1.4-1.1 2.5-2.5 2.5z"/>
<path d="M84.5 393.1h-7.4c-1.4 0-2.5-1.1-2.5-2.5v-.3c0-1.4 1.1-2.5 2.5-2.5h7.4c1.4 0 2.5 1.1 2.5 2.5v.3c0 1.4-1.1 2.5-2.5 2.5z"/>
</g>
<path opacity=".2" fill="#1E0F00" d="M124 387.4h-3.7v-7.9c0-1.6-1.3-2.9-2.9-2.9H93.1V405h24.7v2.4h6v-3.8h2.6v-14c0-1.1-1.1-2.2-2.4-2.2z"/>
</g>
<g class="item item-painting" data-item="painting" data-room='livingroom'>
<path fill="#FFF3DB" d="M77.3 342.4h31.5v22.9H77.3z"/>
<path fill="#7EA58E" d="M90.2 346c0 4.3 5.2 7.9 11.6 7.9 2.7 0 5.1-.6 7.1-1.7v-9.8H91.4c-.8 1.1-1.2 2.3-1.2 3.6z"/>
<path fill="#8BB29E" d="M92.4 355.2c-6.8 0-12.3 3.2-12.3 7.1 0 1.1.5 2.1 1.2 3h22.2c.8-.9 1.2-1.9 1.2-3 0-3.9-5.5-7.1-12.3-7.1z"/>
<path fill="#6F8282" d="M77.3 357h.7c5.7 0 10.3-4.2 10.3-9.5 0-1.9-.6-3.7-1.7-5.2h-9.3V357z"/>
<path fill="#7D5438" d="M75.9 364.8v-21.9c0-1.1.9-1.9 1.9-1.9h30.5c1.1 0 1.9.9 1.9 1.9v21.9c0 1.1-.9 1.9-1.9 1.9H77.8c-1.1 0-1.9-.8-1.9-1.9zm2.8-19.1v16.2c0 1.1.9 1.9 1.9 1.9h24.8c1.1 0 1.9-.9 1.9-1.9v-16.2c0-1.1-.9-1.9-1.9-1.9H80.7c-1.1 0-2 .9-2 1.9z"/>
<path opacity=".2" fill="#1E0F00" d="M108.3 341H92.4v25.8h15.9c1.1 0 1.9-.9 1.9-1.9V343c0-1.2-.9-2-1.9-2z"/>
</g>
</g>
<g>
<g class="item item-bath" data-item="bath" data-room='bathroom'>
<path fill="#8BB29E" d="M329.7 423.1c-2.9 0-5.3 2.4-5.3 5.3v25h-3.6v-25c0-4.9 4-8.9 8.9-8.9s8.9 4 8.9 8.9H335c0-2.9-2.4-5.3-5.3-5.3z"/>
<path fill="#8BB29E" d="M336.7 427.2c3.1 0 5.6 2.4 5.6 5.4H331c.1-3 2.6-5.4 5.7-5.4z"/>
<path fill="#6F8282" d="M317.1 456.3h43.4c1 0 1.7-.8 1.7-1.7v-.1c0-1-.8-1.7-1.7-1.7h-43.4c-1 0-1.7.8-1.7 1.7v.1c0 .9.7 1.7 1.7 1.7z"/>
<path fill="#6F8282" d="M331 434.3h11.4c.4 0 .8-.4.8-.8v-.1c0-.4-.4-.8-.8-.8H331c-.4 0-.8.4-.8.8v.1c0 .4.4.8.8.8z"/>
<path fill="#8BB29E" d="M317 456.3v5.9c0 4 3.3 7.3 7.3 7.3h29c4 0 7.3-3.3 7.3-7.3v-5.9H317z"/>
<path opacity=".2" fill="#1E0F00" d="M360.4 452.6h-21.8v16.8h14.7c4 0 7.3-3.3 7.3-7.3v-5.9h-.2c1 0 1.8-.8 1.8-1.8 0-.9-.8-1.8-1.8-1.8z"/>
</g>
<g class="item item-toilet" data-item="toilet" data-room='bathroom'>
<path fill="#8BB29E" d="M426.2 457h-3.9c-.8 0-1.4-.6-1.4-1.4v-13.2c0-.8.6-1.4 1.4-1.4h3.9c.8 0 1.4.6 1.4 1.4v13.2c0 .8-.6 1.4-1.4 1.4z"/>
<path fill="#8BB29E" d="M404.9 452.6c.7 4.7 4.8 8.4 9.9 8.4 5 0 9.2-3.7 9.9-8.4h-19.8z"/>
<path fill="#6F8282" d="M420.8 451.5c0 .6-.3 1.1-.8 1.1h-14.9c-.4 0-.8-.5-.8-1.1 0-.6.3-1.1.8-1.1H420c.4 0 .8.5.8 1.1z"/>
<path fill="#8BB29E" d="M416.5 456.4v-2.7h11.1v3.6c-1.2 1.4-1.9 3.3-1.9 5.3 0 1.8.6 3.4 1.5 4.8.4.5.4 1.2 0 1.7-.1.2-.3.3-.4.4h-8.9c-3.4-1.1-5.9-4.3-5.9-8.1v-5.3c1.4.3 3 .4 4.5.3z"/>
</g>
<g class="item item-bathroom-table" data-item="bathroom-table" data-room='bathroom'>
<path fill="#817356" d="M371.5 445.4h22.1v24.1h-22.1z"/>
<path fill="#AAA08D" d="M373.9 447h17.2v5.8h-17.2z"/>
<path fill="#AAA08D" d="M373.9 454.4h17.2v5.8h-17.2z"/>
<path fill="#AAA08D" d="M373.9 461.9h17.2v5.8h-17.2z"/>
<path fill="#513C2E" d="M379.9 447.9h5.2v1h-5.2z"/>
<path fill="#513C2E" d="M379.9 455.3h5.2v1h-5.2z"/>
<path fill="#513C2E" d="M379.9 462.6h5.2v1h-5.2z"/>
<g>
<path fill="#EBB177" d="M392.5 444c0 .8-.6 1.4-1.4 1.4h-17c-.8 0-1.4-.6-1.4-1.4v-1.4c0-.8.6-1.4 1.4-1.4h17c.8 0 1.4.6 1.4 1.4v1.4z"/>
<path fill="#CB7861" d="M391.5 439.8c0 .8-.6 1.4-1.2 1.4H375c-.7 0-1.2-.6-1.2-1.4v-1.4c0-.8.6-1.4 1.2-1.4h15.3c.7 0 1.2.6 1.2 1.4v1.4z"/>
<path fill="#8BB29E" d="M391.5 435.6c0 .8-.6 1.4-1.2 1.4H375c-.7 0-1.2-.6-1.2-1.4v-1.4c0-.8.6-1.4 1.2-1.4h15.3c.7 0 1.2.6 1.2 1.4v1.4z"/>
</g>
<path opacity=".2" fill="#1E0F00" d="M392.5 444v-1.4c0-.8-.6-1.4-1.4-1.4h-.9c.7 0 1.2-.6 1.2-1.4v-1.4c0-.8-.6-1.4-1.2-1.4.7 0 1.2-.6 1.2-1.4v-1.4c0-.8-.6-1.4-1.2-1.4h-7.7v36.6h11v-24.1H391c.8.1 1.5-.5 1.5-1.3z"/>
</g>
</g>
<path id="smile" fill="#4F695A" d="M189.3,345.3c0-11.2,9.1-20.3,20.3-20.3c11.2,0,20.3,9.1,20.3,20.3
c0,11.2-9.1,20.3-20.3,20.3C198.4,365.6,189.3,356.5,189.3,345.3z M281.4,345.3c0-11.2,9.1-20.3,20.3-20.3
c11.2,0,20.3,9.1,20.3,20.3c0,11.2-9.1,20.3-20.3,20.3C290.5,365.6,281.4,356.5,281.4,345.3z M329.4,428.5
c-12.6,29.1-42,47.9-75.1,47.9c-33.7,0-63.4-18.9-75.5-48.1c-2.1-5,0.3-10.8,5.3-12.8c1.2-0.5,2.5-0.7,3.8-0.7
c3.9,0,7.5,2.3,9.1,6.1c9.1,21.9,31.6,36,57.4,36c25.2,0,47.6-14.2,57-36.1c2.2-5,7.9-7.3,12.9-5.1
C329.2,417.7,331.5,423.5,329.4,428.5z"/>
<g id='beams'>
<path fill="#D39564" d="M90.2 100.1l-5.1-8.2L231.9 5.2l5 8.2z"/>
<path fill="#D39564" d="M373.6 100.1l5.1-8.2L231.9 5.2l-5 8.2z"/>
<path fill="#D39564" d="M96.4 85.2h9.8v121.2h-9.8z"/>
<path fill="#D39564" d="M52.2 215.8H62v85.4h-9.8z"/>
<path fill="#D39564" d="M357.7 88.2h9.8v41h-9.8z"/>
<path fill="#D39564" d="M315 197.6h9.8v103.6H315z"/>
<path fill="#D39564" d="M146.1 197.6h9.8v103.6h-9.8z"/>
<path fill="#D39564" d="M254.2 102.1h9.8v101.1h-9.8z"/>
<path fill="#D39564" d="M445.1 180.5h9.8V306h-9.8z"/>
<path fill="#D39564" d="M103.2 196.9H450v9.5H103.2z"/>
<path fill="#D39564" d="M52.2 296.4h402.7v9.5H52.2z"/>
<path fill="#D39564" d="M103.2 102.1h257.4v9.5H103.2z"/>
<path fill="#D39564" d="M467.2 186l-99.7-58.9v11.1l94.6 56z"/>
<path fill="#D39564" d="M43.6 219.9l5.1 8.2 47.7-28.2v-11.1z"/>
<path fill="#D39564" d="M96.4 188.8v11.1l9.7-5.8V183z"/>
<path fill="#D39564" d="M357.7 121.3v11.2l9.8 5.7v-11.1z"/>
<path fill="#D39564" d="M96.4 206.4H84.8l11.6-6.5z"/>
</g>
</svg>
html,
body {
height: 100%;
}
body {
background-color: #cae0d3;;
}
svg {
width: 100%;
height: 100%;
display: block;
&.no-cursor,
&.no-cursor .item {
cursor: none !important;
}
}
#smile,
.item {
visibility: hidden;
}
// Vars
function Room(fill, viewBox, items) {
this.value = 0;
this.items = items || 4;
this.fill = fill;
this.viewBox = viewBox;
}
var rooms = {
dressingroom: new Room('#cd5c5c', '30 202 150 100', 3),
livingroom: new Room('#66cdaa', '153 198 165 105'),
kitchen: new Room('#f0e68c', '305 202 150 100'),
bedroom: new Room('#ffe4c4', '103 104 155 98'),
bathroom: new Room('#ffffe0', '259 104 165 100', 3),
cabinet: new Room('#d8Bfd8', '105 -20 255 150', 3),
totalItems: 0
}
var tlThrowItems = new TimelineMax();
var tlEnd = new TimelineMax({paused: true});
// Set
TweenMax.set(['.item', '.place', '#ground', '#smile'], {
transformOrigin: 'center'
})
TweenMax.set('.item', {
autoAlpha: 1
})
// Timelines
tlThrowItems
.staggerFrom('.item', .35, {
y: 300,
ease: Elastic.easeOut.config(.3)
}, .1);
tlEnd
.to('#ground', .55, {
morphSVG: '#smile',
delay: 1.05
});
// Draggable
var s = 4;
Draggable.create('.item', {
bounds: window,
throwProps: true,
snap: {
x: function(endValue) {
return Math.round(endValue / s) * s;
},
y: function(endValue) {
return Math.round((endValue) / s) * s;
}
},
onDrag: onDrag,
onDragEnd: onDragEnd
});
function onDragEnd() {
cursorShow();
zoomOut();
var hitTarget = this.target.getAttribute('data-item');
var room = this.target.getAttribute('data-room');
var dirty = +this.target.getAttribute('data-dirty');
if (this.hitTest('#' + room, '70 %') && !dirty) {
rooms[room].value++;
rooms.totalItems++;
this.target.setAttribute('data-dirty', 1);
} else if (!this.hitTest('#' + room, '70 %') && dirty) {
rooms[room].value--;
rooms.totalItems--;
this.target.setAttribute('data-dirty', 0);
}
if (rooms[room].value >= rooms[room].items) {
TweenMax.to('#' + room, .85, {
fill: rooms[room].fill,
ease: Back.easeOut
})
}
if (rooms.totalItems >= 21) {
tlEnd.play();
}
}
function onDrag() {
var hitTarget = this.target.getAttribute('data-item');
var room = this.target.getAttribute('data-room');
if (this.hitTest('#' + room, '85 %')) {
TweenMax.to('.item-' + hitTarget, .6, {
scale: 1.05,
ease: Bounce.easeOut
})
TweenMax.to('.place-' + hitTarget, .35, {
scale: 0
})
} else {
TweenMax.to('.item-' + hitTarget, .4, {
scale: 1,
ease: Bounce.easeOut
})
TweenMax.to('.place-' + hitTarget, .3, {
scale: 1
})
}
if (this.hitTest('#' + room, '50%')) {
cursorHide();
zoomIn(rooms[room].viewBox);
} else {
cursorShow();
zoomOut();
}
}
// Helpers
function cursorHide() {
TweenMax.set('svg', {
className: 'no-cursor',
})
}
function cursorShow() {
TweenMax.set('svg', {
className: ''
})
}
function zoomIn(viewBox) {
TweenMax.to('svg', .95, {
attr: {
viewBox: viewBox
},
ease: Power3.easeOut
})
}
function zoomOut() {
TweenMax.to('svg', 1.15, {
attr: {
viewBox: '0 0 500 500'
},
ease: Power3.easeOut
})
}
Also see: Tab Triggers