logo

Box

Modal Animations

 

Lien d’origine: https://codepen.io/designcouch/pen/obvKxm

HTML:

<section class="modal1"> 
<div id="modal-container" class="one out">
<div class="modal-background">
<div class="modal">
<h2>I'm a Modal</h2>
<p>Hear me roar.</p>
<svg class="modal-svg" xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" preserveAspectRatio="none">
<rect x="0" y="0" fill="none" width="226" height="162" rx="3" ry="3"></rect>
</svg>
</div>
</div>
</div>
<div class="content">
<h1>Modal Animations</h1>
<div class="buttons">
<div id="one" class="button">Unfolding</div>
<div id="two" class="button">Revealing</div>
<div id="three" class="button">Uncovering</div>
<div id="four" class="button">Blow Up</div><br>
<div id="five" class="button">Meep Meep</div>
<div id="six" class="button">Sketch</div>
<div id="seven" class="button">Bond</div>
</div>
</div>
<script src="https://cpwebassets.codepen.io/assets/common/stopExecutionOnTimeout-1b93190375e9ccc259df3a57c1abc0e64599724ae30d7ea4c6877eb615f89387.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script src="http://localhost/wordpress/wp-content/themes/theme-bulma-v4.1.2/js/modal_animation.js"></script>
</section>

CSS:

.modal1 {
box-sizing: border-box;
}
.modal1 {
min-height: 100%;
height: 100%;
background-image: url(http://theartmad.com/wp-content/uploads/Dark-Grey-Texture-Wallpaper-5.jpg);
background-size: cover;
background-position: top center;
font-family: helvetica neue, helvetica, arial, sans-serif;
font-weight: 200;
}/* 
html.modal-active, body.modal-active {
overflow: hidden;
} */
.modal1 #modal-container .modal{
/* margin-top: 200px; */
margin-top: 500px;
}
.modal1 #modal-container {
/* margin-top:100px; */
position: fixed;
/* position: static; */
display: table;
height: 100%;
width: 100%;
top: 0;
left: 0;
transform: scale(0);
z-index: 1;
}
.modal1 #modal-container.one {
transform: scaleY(0.01) scaleX(0);
animation: unfoldIn 1s cubic-bezier(0.165, 0.84, 0.44, 1) forwards;
}
.modal1 #modal-container.one .modal-background .modal {
transform: scale(0);
animation: zoomIn 0.5s 0.8s cubic-bezier(0.165, 0.84, 0.44, 1) forwards;
}
.modal1 #modal-container.one.out {
transform: scale(1);
animation: unfoldOut 1s 0.3s cubic-bezier(0.165, 0.84, 0.44, 1) forwards;
}
.modal1 #modal-container.one.out .modal-background .modal {
animation: zoomOut 0.5s cubic-bezier(0.165, 0.84, 0.44, 1) forwards;
}
.modal1 #modal-container.two {
transform: scale(1);
}
.modal1 #modal-container.two .modal-background {
background: rgba(0, 0, 0, 0);
animation: fadeIn 0.5s cubic-bezier(0.165, 0.84, 0.44, 1) forwards;
}
.modal1 #modal-container.two .modal-background .modal {
opacity: 0;
animation: scaleUp 0.5s cubic-bezier(0.165, 0.84, 0.44, 1) forwards;
}
.modal1 #modal-container.two + .content {
animation: scaleBack 0.5s cubic-bezier(0.165, 0.84, 0.44, 1) forwards;
}
.modal1 #modal-container.two.out {
animation: quickScaleDown 0s 0.5s linear forwards;
}
.modal1 #modal-container.two.out .modal-background {
animation: fadeOut 0.5s cubic-bezier(0.165, 0.84, 0.44, 1) forwards;
}
.modal1 #modal-container.two.out .modal-background .modal {
animation: scaleDown 0.5s cubic-bezier(0.165, 0.84, 0.44, 1) forwards;
}
.modal1 #modal-container.two.out + .content {
animation: scaleForward 0.5s cubic-bezier(0.165, 0.84, 0.44, 1) forwards;
} 
.modal1 #modal-container.three {
/* z-index: 0; */
transform: scale(1);
}
.modal1 #modal-container.three .modal-background {
background: rgba(0, 0, 0, 0.6);
}
.modal1 #modal-container.three .modal-background .modal {
animation: moveUp 0.5s cubic-bezier(0.165, 0.84, 0.44, 1) forwards;
}
.modal1 #modal-container.three + .content {
z-index: 1;
animation: slideUpLarge 0.5s cubic-bezier(0.165, 0.84, 0.44, 1) forwards;
}
/* .modal1 #modal-container.three.out .modal-background .modal {
animation: moveDown 0.5s cubic-bezier(0.165, 0.84, 0.44, 1) forwards;
} */
.modal1 #modal-container.three.out .modal-background {
animation: fadeOut 0.5s cubic-bezier(0.165, 0.84, 0.44, 1) forwards;
}
.modal1 #modal-container.three.out .modal-background .modal {
animation: scaleDown 0.5s cubic-bezier(0.165, 0.84, 0.44, 1) forwards;
}
.modal1 #modal-container.three.out + .content {
animation: slideDownLarge 0.5s cubic-bezier(0.165, 0.84, 0.44, 1) forwards;
}
.modal1 #modal-container.four {
/* z-index: 0; */
transform: scale(1);
}
.modal1 #modal-container.four .modal-background {
background: rgba(0, 0, 0, 0.7);
}
.modal1 #modal-container.four .modal-background .modal {
animation: blowUpModal 0.5s cubic-bezier(0.165, 0.84, 0.44, 1) forwards;
}
.modal1 #modal-container.four + .content {
z-index: 1;
animation: blowUpContent 0.5s cubic-bezier(0.165, 0.84, 0.44, 1) forwards;
}
.modal1 #modal-container.four.out .modal-background .modal {
animation: blowUpModalTwo 0.5s cubic-bezier(0.165, 0.84, 0.44, 1) forwards;
}
.modal1 #modal-container.four.out .modal-background {
animation: fadeOut 0.5s cubic-bezier(0.165, 0.84, 0.44, 1) forwards;
}
.modal1 #modal-container.four.out + .content {
animation: blowUpContentTwo 0.5s cubic-bezier(0.165, 0.84, 0.44, 1) forwards;
}
.modal1 #modal-container.five {
transform: scale(1);
}
.modal1 #modal-container.five .modal-background {
background: rgba(0, 0, 0, 0);
animation: fadeIn 0.5s cubic-bezier(0.165, 0.84, 0.44, 1) forwards;
}
.modal1 #modal-container.five .modal-background .modal {
transform: translateX(-1500px);
animation: roadRunnerIn 0.3s cubic-bezier(0.165, 0.84, 0.44, 1) forwards;
}
.modal1 #modal-container.five.out {
animation: quickScaleDown 0s 0.5s linear forwards;
}
.modal1 #modal-container.five.out .modal-background {
animation: fadeOut 0.5s cubic-bezier(0.165, 0.84, 0.44, 1) forwards;
}
.modal1 #modal-container.five.out .modal-background .modal {
animation: roadRunnerOut 0.5s cubic-bezier(0.165, 0.84, 0.44, 1) forwards;
}
.modal1 #modal-container.six {
transform: scale(1);
}
.modal1 #modal-container.six .modal-background {
background: rgba(0, 0, 0, 0);
animation: fadeIn 0.5s cubic-bezier(0.165, 0.84, 0.44, 1) forwards;
}
.modal1 #modal-container.six .modal-background .modal {
background-color: transparent;
animation: modalFadeIn 0.5s 0.8s cubic-bezier(0.165, 0.84, 0.44, 1) forwards;
}
.modal1 #modal-container.six .modal-background .modal h2, #modal-container.six .modal-background .modal p {
opacity: 0;
position: relative;
animation: modalContentFadeIn 0.5s 1s cubic-bezier(0.165, 0.84, 0.44, 1) forwards;
}
.modal1 #modal-container.six .modal-background .modal .modal-svg rect {
animation: sketchIn 0.5s 0.3s cubic-bezier(0.165, 0.84, 0.44, 1) forwards;
}
.modal1 #modal-container.six.out {
animation: quickScaleDown 0s 0.5s linear forwards;
}
.modal1 #modal-container.six.out .modal-background {
animation: fadeOut 0.5s cubic-bezier(0.165, 0.84, 0.44, 1) forwards;
}
.modal1 #modal-container.six.out .modal-background .modal {
animation: modalFadeOut 0.5s cubic-bezier(0.165, 0.84, 0.44, 1) forwards;
}
.modal1 #modal-container.six.out .modal-background .modal h2, #modal-container.six.out .modal-background .modal p {
animation: modalContentFadeOut 0.5s cubic-bezier(0.165, 0.84, 0.44, 1) forwards;
}
.modal1 #modal-container.six.out .modal-background .modal .modal-svg rect {
animation: sketchOut 0.5s cubic-bezier(0.165, 0.84, 0.44, 1) forwards;
}
.modal1 #modal-container.seven {
transform: scale(1);
}
.modal1 #modal-container.seven .modal-background {
background: rgba(0, 0, 0, 0);
animation: fadeIn 0.5s cubic-bezier(0.165, 0.84, 0.44, 1) forwards;
}
.modal1 #modal-container.seven .modal-background .modal {
height: 75px;
width: 75px;
border-radius: 75px;
overflow: hidden;
animation: bondJamesBond 1.5s cubic-bezier(0.165, 0.84, 0.44, 1) forwards;
}
.modal1 #modal-container.seven .modal-background .modal h2, #modal-container.seven .modal-background .modal p {
opacity: 0;
position: relative;
animation: modalContentFadeIn 0.5s 1.4s linear forwards;
}
.modal1 #modal-container.seven.out {
animation: slowFade 0.5s 1.5s linear forwards;
}
.modal1 #modal-container.seven.out .modal-background {
background-color: rgba(0, 0, 0, 0.7);
animation: fadeToRed 2s cubic-bezier(0.165, 0.84, 0.44, 1) forwards;
}
.modal1 #modal-container.seven.out .modal-background .modal {
border-radius: 3px;
height: 162px;
width: 227px;
animation: killShot 1s cubic-bezier(0.165, 0.84, 0.44, 1) forwards;
}
.modal1 #modal-container.seven.out .modal-background .modal h2, #modal-container.seven.out .modal-background .modal p {
animation: modalContentFadeOut 0.5s 0.5 cubic-bezier(0.165, 0.84, 0.44, 1) forwards;
}
.modal1 #modal-container .modal-background {
display: table-cell;
background: rgba(0, 0, 0, 0.8);
text-align: center;
vertical-align: middle;
}
.modal1 #modal-container .modal-background .modal {
background: white;
padding: 50px;
display: inline-block;
border-radius: 3px;
font-weight: 300;
position: relative;
}
.modal1 #modal-container .modal-background .modal h2 {
font-size: 25px;
line-height: 25px;
margin-bottom: 15px;
}
.modal1 #modal-container .modal-background .modal p {
font-size: 18px;
line-height: 22px;
}
.modal1 #modal-container .modal-background .modal .modal-svg {
position: absolute;
top: 0;
left: 0;
height: 100%;
width: 100%;
border-radius: 3px;
}
.modal1 #modal-container .modal-background .modal .modal-svg rect {
stroke: #fff;
stroke-width: 2px;
stroke-dasharray: 778;
stroke-dashoffset: 778;
}
.modal1 .content {
min-height: 100%;
height: 100%;
background: white;
position: relative;
z-index: 0;
}
.modal1 .content h1 {
padding: 75px 0 30px 0;
text-align: center;
font-size: 30px;
line-height: 30px;
}
.modal1 .content .buttons {
max-width: 800px;
margin: 0 auto;
padding: 0;
text-align: center;
}
.modal1 .content .buttons .button {
display: inline-block;
text-align: center;
padding: 10px 15px;
margin: 10px;
background: red;
font-size: 18px;
background-color: #efefef;
border-radius: 3px;
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
cursor: pointer;
}
.modal1 .content .buttons .button:hover {
color: white;
background: #009bd5;
}
@keyframes unfoldIn {
0% {
transform: scaleY(0.005) scaleX(0);
}
50% {
transform: scaleY(0.005) scaleX(1);
}
100% {
transform: scaleY(1) scaleX(1);
}
}
@keyframes unfoldOut {
0% {
transform: scaleY(1) scaleX(1);
}
50% {
transform: scaleY(0.005) scaleX(1);
}
100% {
transform: scaleY(0.005) scaleX(0);
}
}
@keyframes zoomIn {
0% {
transform: scale(0);
}
100% {
transform: scale(1);
}
}
@keyframes zoomOut {
0% {
transform: scale(1);
}
100% {
transform: scale(0);
}
}
@keyframes fadeIn {
0% {
background: rgba(0, 0, 0, 0);
}
100% {
background: rgba(0, 0, 0, 0.7);
}
}
@keyframes fadeOut {
0% {
background: rgba(0, 0, 0, 0.7);
}
100% {
background: rgba(0, 0, 0, 0);
}
}
@keyframes scaleUp {
0% {
transform: scale(0.8) translateY(1000px);
opacity: 0;
}
100% {
transform: scale(1) translateY(0px);
opacity: 1;
}
}
@keyframes scaleDown {
0% {
transform: scale(1) translateY(0px);
opacity: 1;
}
100% {
transform: scale(0.8) translateY(1000px);
opacity: 0;
}
}
@keyframes scaleBack {
0% {
transform: scale(1);
}
100% {
transform: scale(0.85);
}
}
@keyframes scaleForward {
0% {
transform: scale(0.85);
}
100% {
transform: scale(1);
}
}
@keyframes quickScaleDown {
0% {
transform: scale(1);
}
99.9% {
transform: scale(1);
}
100% {
transform: scale(0);
}
}
@keyframes slideUpLarge {
0% {
transform: translateY(0%);
}
100% {
transform: translateY(-100%);
}
}
@keyframes slideDownLarge {
0% {
transform: translateY(-100%);
}
100% {
transform: translateY(0%);
}
}
@keyframes moveUp {
0% {
transform: translateY(150px);
}
100% {
transform: translateY(0);
}
}
@keyframes moveDown {
0% {
transform: translateY(0px);
}
100% {
transform: translateY(150px);
}
}
@keyframes blowUpContent {
0% {
transform: scale(1);
opacity: 1;
}
99.9% {
transform: scale(2);
opacity: 0;
}
100% {
transform: scale(0);
}
}
@keyframes blowUpContentTwo {
0% {
transform: scale(2);
opacity: 0;
}
100% {
transform: scale(1);
opacity: 1;
}
}
@keyframes blowUpModal {
0% {
transform: scale(0);
}
100% {
transform: scale(1);
}
}
@keyframes blowUpModalTwo {
0% {
transform: scale(1);
opacity: 1;
}
100% {
transform: scale(0);
opacity: 0;
}
}
@keyframes roadRunnerIn {
0% {
transform: translateX(-1500px) skewX(30deg) scaleX(1.3);
}
70% {
transform: translateX(30px) skewX(0deg) scaleX(0.9);
}
100% {
transform: translateX(0px) skewX(0deg) scaleX(1);
}
}
@keyframes roadRunnerOut {
0% {
transform: translateX(0px) skewX(0deg) scaleX(1);
}
30% {
transform: translateX(-30px) skewX(-5deg) scaleX(0.9);
}
100% {
transform: translateX(1500px) skewX(30deg) scaleX(1.3);
}
}
@keyframes sketchIn {
0% {
stroke-dashoffset: 778;
}
100% {
stroke-dashoffset: 0;
}
}
@keyframes sketchOut {
0% {
stroke-dashoffset: 0;
}
100% {
stroke-dashoffset: 778;
}
}
@keyframes modalFadeIn {
0% {
background-color: transparent;
}
100% {
background-color: white;
}
}
@keyframes modalFadeOut {
0% {
background-color: white;
}
100% {
background-color: transparent;
}
}
@keyframes modalContentFadeIn {
0% {
opacity: 0;
top: -20px;
}
100% {
opacity: 1;
top: 0;
}
}
@keyframes modalContentFadeOut {
0% {
opacity: 1;
top: 0px;
}
100% {
opacity: 0;
top: -20px;
}
}
@keyframes bondJamesBond {
0% {
transform: translateX(1000px);
}
80% {
transform: translateX(0px);
border-radius: 75px;
height: 75px;
width: 75px;
}
90% {
border-radius: 3px;
height: 182px;
width: 247px;
}
100% {
border-radius: 3px;
height: 162px;
width: 227px;
}
}
@keyframes killShot {
0% {
transform: translateY(0) rotate(0deg);
opacity: 1;
}
100% {
transform: translateY(300px) rotate(45deg);
opacity: 0;
}
}
@keyframes fadeToRed {
0% {
background-color: rgba(0, 0, 0, 0.6);
}
100% {
background-color: rgba(255, 0, 0, 0.8);
}
}
@keyframes slowFade {
0% {
opacity: 1;
}
99.9% {
opacity: 0;
transform: scale(1);
}
100% {
transform: scale(0);
}
}

JS:

$('.button').click(function () {
var buttonId = $(this).attr('id');
$('#modal-container').removeAttr('class').addClass(buttonId);
$('body').addClass('modal-active');
});

$('#modal-container').click(function () {
$(this).addClass('out');
$('body').removeClass('modal-active');
});

Tree view from unordered list

Lien d’origine: https://codepen.io/ross-angus/pen/jwxMjL

HTML:

<section class="treeView">
<figure>
<figcaption>Example DOM structure diagram</figcaption>
<ul class="tree">
<li><code>html</code>
<ul>
<li><code>head</code>
<ul>
<li><code>title</code></li>
</ul>
</li>
<li><code>body</code>
<ul>
<li><code>header</code>
<ul>
<li><code>h1</code></li>
<li><code>p</code></li>
</ul>
</li>
<li><code>nav</code>
<ul>
<li><code>a</code></li>
<li><code>a</code></li>
<li><code>a</code></li>
<li><code>a</code></li>
</ul>
</li>
<li><code>main</code>
<ul>
<li><code>h1</code></li>
<li><code>article</code>
<ul>
<li><code>h2</code></li>
<li><code>p</code></li>
<li><code>p</code></li>
</ul>
</li>
</ul>
</li>
<li><code>aside</code>
<ul>
<li><code>h2</code></li>
<li><code>p</code></li>
<li><code>p</code>
<ul>
<li><code>a</code></li>
</ul>
</li>
</ul>
</li>
<li><code>footer</code>
<ul>
<li><code>nav</code>
<ul>
<li><code>a</code></li>
<li><code>a</code></li>
<li><code>a</code></li>
<li><code>a</code></li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</figure>
<figure> 
<figcaption>Example sitemap</figcaption>
<ul class="tree">
<li><span>Home</span>
<ul>
<li><span>About us</span>
<ul>
<li><span>Our history</span>
<ul>
<li><span>Founder</span></li>
</ul>
</li>
<li><span>Our board</span>
<ul>
<li><span>Brad Whiteman</span></li>
<li><span>Cynthia Tolken</span></li>
<li><span>Bobby Founderson</span></li>
</ul>
</li>
</ul>
</li>
<li><span>Our products</span>
<ul>
<li><span>The Widget 2000™</span>
<ul>
<li><span>Order form</span></li>
</ul>
</li>
<li><span>The McGuffin V2</span>
<ul>
<li><span>Order form</span></li>
</ul>
</li>
</ul>
</li>
<li><span>Contact us</span>
<ul>
<li><span>Social media</span>
<ul>
<li><span>Facebook</span></li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</figure>
</section>

CSS:

.treeView .tree, .treeView .tree ul, .treeView .tree li {
list-style: none;
margin: 0;
padding: 0;
position: relative;
}
.treeView .tree {
margin: 0 0 1em;
text-align: center;
}
.treeView .tree, .treeView .tree ul {
display: table;
}
.treeView .tree ul {
width: 100%;
}
.treeView .tree li {
display: table-cell;
padding: .5em 0;
vertical-align: top;
}
.treeView .tree li:before {
outline: solid 1px #666;
content: "";
left: 0;
position: absolute;
right: 0;
top: 0;
}
.treeView .tree li:first-child:before {left: 50%;}
.treeView .tree li:last-child:before {right: 50%;}

.treeView .tree code, .treeView .tree span {
border: solid .1em #666;
border-radius: .2em;
display: inline-block;
margin: 0 .2em .5em;
padding: .2em .5em;
position: relative;
}
.treeView .tree code {
font-family: monaco, Consolas, 'Lucida Console', monospace;
color:black;
}
.treeView .tree ul:before,
.treeView .tree code:before,
.treeView .tree span:before {
outline: solid 1px #666;
content: "";
height: .5em;
left: 50%;
position: absolute;
}
.treeView .tree ul:before {
top: -.5em;
}
.treeView .tree code:before,
.treeView .tree span:before {
top: -.55em;
}
.treeView .tree > .treeView li {margin-top: 0;}
.treeView .tree > .treeView li:before,
.treeView .tree > .treeView li:after,
.treeView .tree > .treeView li > code:before,
.treeView .tree > .treeView li > .treeView span:before {
outline: none;
}

Four image hover effect

Lien d’origine: https://codepen.io/knyttneve/pen/YgZbLO

HTML:

<section class="fourImageHoverEffect">
<div class="container">
<div class="box">
<img src="https://source.unsplash.com/1000x800">
<span>CSS</span>
</div>
<div class="box">
<img src="https://source.unsplash.com/1000x802">
<span>Image</span>
</div>
<div class="box">
<img src="https://source.unsplash.com/1000x804">
<span>Hover</span>
</div>
<div class="box">
<img src="https://source.unsplash.com/1000x806">
<span>Effect</span>
</div>
</div>
</section>

CSS:

.fourImageHoverEffect .container {
display: flex;
width: 100%;
padding: 4% 2%;
box-sizing: border-box;
height: 100vh;
}
.fourImageHoverEffect .box {
flex: 1;
overflow: hidden;
transition: 0.5s;
margin: 0 2%;
box-shadow: 0 20px 30px rgba(0, 0, 0, 0.1);
line-height: 0;
}
.fourImageHoverEffect .box > img {
width: 200%;
height: calc(100% - 10vh);
-o-object-fit: cover;
object-fit: cover;
transition: 0.5s;
}
.fourImageHoverEffect .box > span {
font-size: 3.8vh;
display: block;
text-align: center;
height: 10vh;
line-height: 2.6;
}
.fourImageHoverEffect .box:hover {
flex: 1 1 50%;
}
.fourImageHoverEffect .box:hover > img {
width: 100%;
height: 100%;
}