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 URL's 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 it's URL and the proper URL extention.
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 Skypack, which makes packages from npm not only available on a CDN, but prepares them for native JavaScript ES6 import
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.
<main>
<div class="frontFace">
<div class="frontFace-container">
<div class="frontContent">
<div class="frontContent-sentence">
<div class="frontContent-title">
<p class="frontContent-title-main">Salvador<br>Dalí</p>
<p class="frontContent-text">
Lorem ipsum dolor sit amet consectetur adipisicing elit. Illo, at, culpa ipsa beatae alias possimus veniam dolor pariatur repellat, accusantium quaerat minima. Expedita commodi dolore sint ut rerum dignissimos corporis.Lorem ipsum dolor sit amet consectetur adipisicing elit.Lorem ipsum dolor sit amet consectetur adipisicing elit. Illo, at, culpa ipsa beatae alias possimus veniam dolor pariatur repellat, accusantium quaerat minima
</p>
</div>
<div class="frontContent-img">
<img src="https://drive.google.com/uc?export=view&id=1jCQgj9gOKgCdGc8u8mSPa7kXCDwalXVH" alt="" class="img">
</div>
</div>
<div class="buttonFrame">
<button class="button-menu">
<div class="button-open">
<p class="click">Visit the Work</p>
</div>
</button>
</div>
</div>
</div>
</div>
<div class="backFace">
<div class="backFace-container">
<div class="backFace-area">
<p class="backFace-text">
Lorem ipsum dolor sit amet consectetur adipisicing elit. Illo, at, culpa ipsa beatae alias possimus veniam dolor pariatur repellat, accusantium quaerat minima. Expedita commodi dolore sint ut rerum dignissimos corporis.Lorem ipsum dolor sit amet consectetur adipisicing elit. Illo, at, culpa ipsa beatae alias possimus veniam dolor pariatur repellat, accusantium quaerat minima. Expedita commodi dolore sint ut rerum dignissimos corporis.Lorem ipsum dolor sit amet consectetur adipisicing elit. Illo, at, culpa ipsa beatae alias possimus veniam dolor pariatur repellat, accusantium quaerat minima. Expedita commodi dolore sint ut rerum dignissimos corporis.Lorem ipsum dolor sit amet consectetur adipisicing elit. Illo, at, culpa ipsa beatae alias possimus veniam dolor pariatur repellat, accusantium quaerat minima. Expedita commodi dolore sint ut rerum dignissimos corporis.
</p>
<div class="buttonFrame close">
<button class="button-menu">
<div class="button-close">
<p class="click">Leave the Work</p>
</div>
</button>
</div>
</div>
<div class="clock-container" id="container">
<div class="image-container">
<div class="c1">
<img class="clock img01" src="https://drive.google.com/uc?export=view&id=1WWozan_0IPGIIQAomC9cko4UO40wGQrD" alt="">
</div>
<div class="c2">
<img class="clock img02" src="https://drive.google.com/uc?export=view&id=1XjZCcdCkm1TwKzw7Mc02nYH2rwiBGFuS" alt="">
</div>
<div class="c3">
<img class="clock img03" src="https://drive.google.com/uc?export=view&id=19Re2CmsxZUUztZeGlKCaPQCLI4-cVDed" alt="">
</div>
</div>
<div class="c4">
<img class="typo img04" src="https://drive.google.com/uc?export=view&id=1kNaJI8nWnKpZSRa86YA6BzokGMrZYTPn" alt="">
</div>
<div class="c5">
<img class="typo img05" src="https://drive.google.com/uc?export=view&id=1kNaJI8nWnKpZSRa86YA6BzokGMrZYTPn" alt="">
</div>
</div>
</div>
</div>
<svg class="overlay" width="100%" height="100%" viewBox="0 0 100 100" preserveAspectRatio="none">
<path class="overlay-path" vector-effect="non-scaling-stroke" d="M 0 100 V 100 Q 50 100 100 100 V 100 z" />
</svg>
</main>
<svg xmlns="http://www.w3.org/2000/svg" version="1.1">
<defs>
<filter id="noise">
<feTurbulence type="fractalNoise" id="turbulence" baseFrequency="0.002" numOctaves="3" result="noise" seed="0"/>
<feDisplacementMap id="displacement" in="SourceGraphic" in2="noise" scale="400" />
</filter>
<filter id="contrast">
<feColorMatrix in="SourceGraphic" mode="matrix" values="1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 30 -10" result="matrix" />
<feComposite in="SourceGraphic" in2="matrix" operator="atop"/>
</filter>
</defs>
</svg>
@import url(https://fonts.googleapis.com/css2?family=Shippori+Mincho:wght@400;500;600;700;800&display=swap);
html {
filter: url('#contrast');
height: 100%;
}
::-webkit-scrollbar {
width: 0;
height: 0;
}
body {
margin: 0;
color: #000;
font-family: 'Shippori Mincho', serif;
overflow: hidden;
}
p {
margin: 0;
}
.frontFace {
position: relative;
height: 100vh;
background-color: #f3f3f3;
display: flex;
justify-content: center;
align-items: center;
}
.frontFace-container::before {
content: "The\APersistence of\AMemory";
white-space: pre;
position: absolute;
top: 50%;
left: 0;
transform: translateY(-50%);
font-size: 13.375vw;
letter-spacing: 0.05em;
color: #edebeb;
line-height: 1.4;
}
.frontContent-sentence {
display: flex;
align-items: center;
justify-content: space-between;
width: 85vw;
margin: 0 auto;
position: relative;
z-index: 0;
}
.frontContent-title {
width: 47.8125vw;
}
.frontContent-title-main {
font-weight: 400;
font-size: 8.75vw;
letter-spacing: 0.017em;
line-height: 1;
margin: 5.125vw auto 3vw;
}
.frontContent-text {
margin-top: 2vw;
font-weight: 400;
text-align: justify;
font-size: 1.125vw;
letter-spacing: 0.05em;
line-height: 2;
}
.frontContent-img {
width: 34.9375vw;
margin-top: 6vw;
}
img {
width: 100%;
height: auto;
}
.backFace {
position: relative;
background: #fff;
opacity: 0;
height: 100vh;
margin-top: -100vh;
}
.backFace-area {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
z-index: 1;
}
.backFace-text {
font-weight: 400;
text-align: justify;
font-size: 1vw;
letter-spacing: 0.1em;
width: 60vw;
line-height: 2.5;
}
.clock-container {
filter:url('#noise') blur(7px);
position: absolute;
width: 100%;
height: 100%;
overflow-y: hidden;
}
.image-container {
display: flex;
justify-content: center;
}
.c1 {
animation: clock-1 15s infinite;
}
.c2 {
animation: clock-2 17s infinite;
margin-left: 5vw;
}
.c3 {
animation: clock-3 20s infinite;
margin-left: 5vw;
}
.c4 {
animation: typo-1 20s infinite;
}
.c5 {
animation: typo-2 30s infinite;
}
.clock {
width: 31.875vw;
height: 29.375vw;
}
img {
width: 100%;
height: auto;
}
@keyframes clock-1 {
0% {
transform: translateY(200%);
}
100% {
transform: translateY(-100%);
}
}
@keyframes clock-2 {
0% {
transform: translateY(300%);
}
100% {
transform: translateY(-100%);
}
}
@keyframes clock-3 {
0% {
transform: translateY(400%);
}
100% {
transform: translateY(-100%);
}
}
@keyframes typo-1 {
0% {
transform: translateY(200%);
}
100% {
transform: translateY(-200%);
}
}
@keyframes typo-2 {
0% {
transform: translateY(300%);
}
100% {
transform: translateY(-300%);
}
}
.frontFace--menu-open .button-menu {
opacity: 0;
pointer-events: none;
}
.backFace.backFace--open {
opacity: 1;
pointer-events: auto;
}
.overlay {
position: absolute;
top: 0;
left: 0;
z-index: 1000;
width: 100%;
height: 100%;
pointer-events: none;
}
.buttonFrame {
position: relative;
z-index: 1;
margin-top: 1vw;
}
.buttonFrame.close {
margin-top: 5vw;
}
.button-menu {
background-color: transparent;
border: none;
cursor: pointer;
outline: none;
padding: 0;
appearance: none;
margin: 0 auto;
display: block;
justify-content: center;
font-family: 'Shippori Mincho', serif;
height: 5.625vw;
width: 25vw;
}
.button-open .click,
.button-close .click {
position: relative;
line-height: 1;
font-size: 1.125vw;
font-weight: 400;
letter-spacing: 0.4em;
transition: letter-spacing 0.2s ease-out;
height: 5.625vw;
display: flex;
justify-content: center;
align-items: center;
white-space: nowrap;
}
.button-open::before,
.button-close::before {
content: '';
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 5.625vw;
height: 5.625vw;
border-radius: 50%;
transition: width 0.2s ease-out, height 0.2s ease-out;
}
.button-open::before {
background-color: #fff;
z-index: -1;
}
.button-close::before {
background-color: #f3f3f3;
}
.button-menu:hover .button-open .click,
.button-menu:hover .button-close .click {
letter-spacing: 0.2em;
}
.button-menu:hover .button-open::before,
.button-menu:hover .button-close::before {
width: 0;
height: 0;
}
@media screen and (min-width:1600px) {
.frontFace {
height: 100vh;
}
.frontFace-container::before {
font-size: 230px;
}
.frontContent-sentence {
width: 1360px;
}
.frontContent-title {
width: 680px;
}
.frontContent-title-main {
font-size: 140px;
margin: 82px auto 48px;
}
.frontContent-text {
margin-top: 32px;
font-size: 18px;
}
.frontContent-img {
width: 559px;
margin-top: 96px;
}
.backFace-text {
font-size: 16px;
width: 960px;
}
.buttonFrame {
bottom: 48px;
}
.button-menu {
height: 90px;
width: 400px;
}
.button-open .click,
.button-close .click {
font-size: 20px;
height: 90px;
}
.button-open::before,
.button-close::before {
width: 90px;
height: 90px;
}
}
@media screen and (max-width: 1600px) and (max-height: 800px) {
.buttonFrame {
margin-top: -4vw;
}
}
const frame = document.querySelector(".buttonFrame");
const overlayPath = document.querySelector(".overlay-path");
const menuWrap = document.querySelector(".backFace");
const openMenuCtrl = document.querySelector(".button-menu");
const closeMenuCtrl = document.querySelector(".button-close");
// ボタンをクリックした後に走らせるDOM
const hide = {
main: document.querySelector(".frontContent-title"),
content: document.querySelector(".frontContent-img"),
leave: document.querySelector(".backFace-text"),
clock: document.querySelector(".clock-container"),
};
// ボタンを連打しても違和感がないようにフラグを設ける。
// openMenuまたはcloseMenuが発火し終わったら発火するようにする。
let isAnimating = false;
// OPENさせた時
const openMenu = () => {
if (isAnimating) return;
isAnimating = true;
gsap
.timeline({
onComplete: () => (isAnimating = false),
})
// 初めにアニメーションするパス
// 透明なパス
.set(overlayPath, {
attr: { d: "M 0 100 V 100 Q 50 100 100 100 V 100 z" },
})
// 扇型を黒く塗りつぶしたパス
.to(
overlayPath,
{
duration: 0.5,
ease: "power4.in",
attr: { d: "M 0 100 V 50 Q 50 0 100 50 V 100 z" },
},
0
)
// 真っ黒なパス
.to(overlayPath, {
duration: 0.3,
ease: "power2",
attr: { d: "M 0 100 V 0 Q 50 0 100 0 V 100 z" },
onComplete: () => {
frame.classList.add("frontFace--menu-open");
menuWrap.classList.add("backFace--open");
},
})
// 前面の画像やテキストを上に移動させる。
.to(
[hide.main, hide.content, openMenuCtrl],
{
duration: 0.5,
ease: "power3.in",
y: -200,
opacity: 0,
stagger: 0.05,
},
0.2
)
// 後にアニメーションするパス
// 真っ黒なパス
.set(overlayPath, {
attr: { d: "M 0 0 V 100 Q 50 100 100 100 V 0 z" },
})
// 扇型の余白部分を黒く塗りつぶしたパス
.to(overlayPath, {
duration: 0.3,
ease: "power2.in",
attr: { d: "M 0 0 V 50 Q 50 0 100 50 V 0 z" },
})
// 透明なパス
.to(overlayPath, {
duration: 0.5,
ease: "power4",
attr: { d: "M 0 0 V 0 Q 50 0 100 0 V 0 z" },
})
// 後面のテキストと時計を移動させながら表示させる。
.to(
[hide.leave, hide.clock],
{
duration: 1.1,
ease: "power4",
startAt: { y: 150 },
y: 0,
opacity: 1,
stagger: 0.05,
},
">-=1.1"
);
};
// CLOSEさせた時
const closeMenu = () => {
if (isAnimating) return;
isAnimating = true;
gsap
.timeline({
onComplete: () => (isAnimating = false),
})
// 初めにアニメーションするパス
// 透明なパス
.set(overlayPath, {
attr: { d: "M 0 0 V 0 Q 50 0 100 0 V 0 z" },
})
// 扇型を黒く塗りつぶして反転させたパス
.to(
overlayPath,
{
duration: 0.5,
ease: "power4.in",
attr: { d: "M 0 0 V 50 Q 50 100 100 50 V 0 z" },
},
0
)
// 真っ黒なパス
.to(overlayPath, {
duration: 0.3,
ease: "power2",
attr: { d: "M 0 0 V 100 Q 50 100 100 100 V 0 z" },
onComplete: () => {
frame.classList.remove("frontFace--menu-open");
menuWrap.classList.remove("backFace--open");
},
})
// 後にアニメーションするパス
// 真っ黒なパス
.set(overlayPath, {
attr: { d: "M 0 100 V 0 Q 50 0 100 0 V 100 z" },
})
// 扇型の余白部分を黒く塗りつぶして反転させたパス
.to(overlayPath, {
duration: 0.3,
ease: "power2.in",
attr: { d: "M 0 100 V 50 Q 50 100 100 50 V 100 z" },
})
// 透明なパス
.to(overlayPath, {
duration: 0.5,
ease: "power4",
attr: { d: "M 0 100 V 100 Q 50 100 100 100 V 100 z" },
})
// 前面の画像やテキストを上に移動させる。
.to(
[hide.main, hide.content, openMenuCtrl],
{
duration: 1.1,
ease: "power4",
y: 0,
opacity: 1,
stagger: -0.05,
},
">-=1.1"
)
// 後面のテキストと時計を移動させながら表示させる。
.to(
[hide.leave, hide.clock],
{
duration: 0.8,
ease: "power2.in",
y: 100,
opacity: 0,
stagger: -0.05,
},
0
);
};
openMenuCtrl.addEventListener("click", openMenu);
closeMenuCtrl.addEventListener("click", closeMenu);
Also see: Tab Triggers