扩大圈动画

时间:2018-07-15 14:19:07

标签: css css-animations

我正在看这个pen

在我最初点击后,我注意到3动画为1,据我所知。但是,在弹出窗口打开之前,有一个从中心展开的圆形动画。我不知道该动画来自哪里,但想了解更多有关它的信息。

有人能帮我解释一下吗?

html

    <!-- begin page -->
<section class="page">
    <div class="wrapper">
        <input type="checkbox" id="checkbox">
        <label for="checkbox" class="open">
            <div class="lines">
                <div class="line"></div>
                <div class="line"></div>
                <div class="line"></div>
            </div>
        </label>

        <!-- begin content -->
        <section class="content">
            <label for="checkbox" class="close"><span>Close Me!</span></label>

            <div class="logo">
                <div class="logo__line"></div>
                <div class="logo__line"></div>
                <div class="logo__line"></div>
            </div>

            <h1>Three Invites</h1>
            <p>To get one of these invites, just create the best of your shots and post them in yuor dribbble account</p>
        </section>
        <!-- end content -->

    </div>
</section>
<!-- end page -->

css

    *{margin: 0;padding: 0;}
::-moz-selection{
    background: #FF6277;
    color: #fff;
}
::selection{
    background: #FF6277;
    color: #fff;
}
.page{
    position: relative;
    width: 100%;
    height: 100vh;
    background: #FF6277;
}
.wrapper,
.lines,
.line,
.open:after,
.content{
    position: absolute;
    top: 50%;
    left: 50%;
    -webkit-transform: translate(-50%, -50%);
    -ms-transform: translate(-50%, -50%);
    transform: translate(-50%, -50%);
}
input[type="checkbox"]{
    display: none;
}
input[type="checkbox"]:checked ~ label .lines .line:first-child{
    -webkit-transform: translate(-50%, -50%);
    -ms-transform: translate(-50%, -50%);
    transform: translate(-50%, -50%);
    -webkit-transition: -webkit-transform .4s cubic-bezier(0.64, 0.57, 0.67, 1.53);
    transition: -webkit-transform .4s cubic-bezier(0.64, 0.57, 0.67, 1.53);
    -o-transition: transform .4s cubic-bezier(0.64, 0.57, 0.67, 1.53);
    transition: transform .4s cubic-bezier(0.64, 0.57, 0.67, 1.53);
    transition: transform .4s cubic-bezier(0.64, 0.57, 0.67, 1.53), -webkit-transform .4s cubic-bezier(0.64, 0.57, 0.67, 1.53);
}
input[type="checkbox"]:checked ~ label .lines .line:last-child{
    -webkit-transform: translate(-50%, -50%);
    -ms-transform: translate(-50%, -50%);
    transform: translate(-50%, -50%);
    -webkit-transition: -webkit-transform .4s cubic-bezier(0.64, 0.57, 0.67, 1.53);
    transition: -webkit-transform .4s cubic-bezier(0.64, 0.57, 0.67, 1.53);
    -o-transition: transform .4s cubic-bezier(0.64, 0.57, 0.67, 1.53);
    transition: transform .4s cubic-bezier(0.64, 0.57, 0.67, 1.53);
    transition: transform .4s cubic-bezier(0.64, 0.57, 0.67, 1.53), -webkit-transform .4s cubic-bezier(0.64, 0.57, 0.67, 1.53);
}
input[type="checkbox"]:checked ~ label:after{
    opacity: 0;
    -webkit-transform: translate(-50%, -50%) scale3d(1, 1, 1);
    transform: translate(-50%, -50%) scale3d(1, 1, 1);
    -webkit-transition: all .5s cubic-bezier(0.64, 0.57, 0.67, 1.53);
    -o-transition: all .5s cubic-bezier(0.64, 0.57, 0.67, 1.53);
    transition: all .5s cubic-bezier(0.64, 0.57, 0.67, 1.53);
}
input[type="checkbox"]:checked ~ .content{
    -webkit-transform: translate(-50%, -50%) scale3d(1, 1, 1);
    transform: translate(-50%, -50%) scale3d(1, 1, 1);
    -webkit-transition: -webkit-transform .5s .4s cubic-bezier(0.99, 0.04, 0.57, 1.31), -webkit-box-shadow .5s .7s;
    transition: -webkit-transform .5s .4s cubic-bezier(0.99, 0.04, 0.57, 1.31), -webkit-box-shadow .5s .7s;
    -o-transition: transform .5s .4s cubic-bezier(0.99, 0.04, 0.57, 1.31), box-shadow .5s .7s;
    transition: transform .5s .4s cubic-bezier(0.99, 0.04, 0.57, 1.31), box-shadow .5s .7s;
    transition: transform .5s .4s cubic-bezier(0.99, 0.04, 0.57, 1.31), box-shadow .5s .7s, -webkit-transform .5s .4s cubic-bezier(0.99, 0.04, 0.57, 1.31), -webkit-box-shadow .5s .7s;
    -webkit-box-shadow: 0 0 2px rgba(0, 0, 0, .3), 0 20px 10px -15px rgba(0, 0, 0, .3);
    box-shadow: 0 0 2px rgba(0, 0, 0, .3), 0 20px 10px -15px rgba(0, 0, 0, .3);
}
input[type="checkbox"]:checked ~ .content .close{
    -webkit-transform: scale3d(1,1,1);
    transform: scale3d(1,1,1);
    -webkit-transition: opacity .5s .7s, background .3s, -webkit-transform .5s .7s cubic-bezier(0.99, 0.04, 0.57, 1.31);
    transition: opacity .5s .7s, background .3s, -webkit-transform .5s .7s cubic-bezier(0.99, 0.04, 0.57, 1.31);
    -o-transition: transform .5s .7s cubic-bezier(0.99, 0.04, 0.57, 1.31), opacity .5s .7s, background .3s;
    transition: transform .5s .7s cubic-bezier(0.99, 0.04, 0.57, 1.31), opacity .5s .7s, background .3s;
    transition: transform .5s .7s cubic-bezier(0.99, 0.04, 0.57, 1.31), opacity .5s .7s, background .3s, -webkit-transform .5s .7s cubic-bezier(0.99, 0.04, 0.57, 1.31);
    opacity: 1;
}
input[type="checkbox"]:checked ~ .content h1{
    -webkit-transform: translate(0, 0);
    -ms-transform: translate(0, 0);
    transform: translate(0, 0);
    -webkit-transition: opacity .8s .8s, -webkit-transform .5s .6s cubic-bezier(0.99, 0.04, 0.57, 1.31);
    transition: opacity .8s .8s, -webkit-transform .5s .6s cubic-bezier(0.99, 0.04, 0.57, 1.31);
    -o-transition: transform .5s .6s cubic-bezier(0.99, 0.04, 0.57, 1.31), opacity .8s .8s;
    transition: transform .5s .6s cubic-bezier(0.99, 0.04, 0.57, 1.31), opacity .8s .8s;
    transition: transform .5s .6s cubic-bezier(0.99, 0.04, 0.57, 1.31), opacity .8s .8s, -webkit-transform .5s .6s cubic-bezier(0.99, 0.04, 0.57, 1.31);
    opacity: 1
}
input[type="checkbox"]:checked ~ .content p{
    -webkit-transform: translate(0, 0);
    -ms-transform: translate(0, 0);
    transform: translate(0, 0);
    -webkit-transition: opacity .8s .8s, -webkit-transform .5s .62s cubic-bezier(0.99, 0.04, 0.57, 1.31);
    transition: opacity .8s .8s, -webkit-transform .5s .62s cubic-bezier(0.99, 0.04, 0.57, 1.31);
    -o-transition: transform .5s .62s cubic-bezier(0.99, 0.04, 0.57, 1.31), opacity .8s .8s;
    transition: transform .5s .62s cubic-bezier(0.99, 0.04, 0.57, 1.31), opacity .8s .8s;
    transition: transform .5s .62s cubic-bezier(0.99, 0.04, 0.57, 1.31), opacity .8s .8s, -webkit-transform .5s .62s cubic-bezier(0.99, 0.04, 0.57, 1.31);
    opacity: .5
}
input[type="checkbox"]:checked ~ .content .logo .logo__line{
    opacity: 1;
    -webkit-transform: translate(-50%, 0);
    -ms-transform: translate(-50%, 0);
    transform: translate(-50%, 0);
    -webkit-transition: opacity .8s .8s, -webkit-transform .5s .7s cubic-bezier(0.99, 0.04, 0.57, 1.31);
    transition: opacity .8s .8s, -webkit-transform .5s .7s cubic-bezier(0.99, 0.04, 0.57, 1.31);
    -o-transition: transform .5s .7s cubic-bezier(0.99, 0.04, 0.57, 1.31), opacity .8s .8s;
    transition: transform .5s .7s cubic-bezier(0.99, 0.04, 0.57, 1.31), opacity .8s .8s;
    transition: transform .5s .7s cubic-bezier(0.99, 0.04, 0.57, 1.31), opacity .8s .8s, -webkit-transform .5s .7s cubic-bezier(0.99, 0.04, 0.57, 1.31);
}
input[type="checkbox"]:checked ~ .content .logo .logo__line:first-child{
    opacity: 1;
    -webkit-transform: translate(calc(0% - 50% - 10px), 0);
    -ms-transform: translate(calc(0% - 50% - 10px), 0);
    transform: translate(calc(0% - 50% - 10px), 0);
    -webkit-transition: opacity .8s .8s, -webkit-transform .5s .8s cubic-bezier(0.99, 0.04, 0.57, 1.31);
    transition: opacity .8s .8s, -webkit-transform .5s .8s cubic-bezier(0.99, 0.04, 0.57, 1.31);
    -o-transition: transform .5s .8s cubic-bezier(0.99, 0.04, 0.57, 1.31), opacity .8s .8s;
    transition: transform .5s .8s cubic-bezier(0.99, 0.04, 0.57, 1.31), opacity .8s .8s;
    transition: transform .5s .8s cubic-bezier(0.99, 0.04, 0.57, 1.31), opacity .8s .8s, -webkit-transform .5s .8s cubic-bezier(0.99, 0.04, 0.57, 1.31);
}
input[type="checkbox"]:checked ~ .content .logo .logo__line:last-child{
    opacity: 1;
    -webkit-transform: translate(calc(0% - 50% + 10px), 0);
    -ms-transform: translate(calc(0% - 50% + 10px), 0);
    transform: translate(calc(0% - 50% + 10px), 0);
    -webkit-transition: opacity .8s .8s, -webkit-transform .5s .85s cubic-bezier(0.99, 0.04, 0.57, 1.31);
    transition: opacity .8s .8s, -webkit-transform .5s .85s cubic-bezier(0.99, 0.04, 0.57, 1.31);
    -o-transition: transform .5s .85s cubic-bezier(0.99, 0.04, 0.57, 1.31), opacity .8s .8s;
    transition: transform .5s .85s cubic-bezier(0.99, 0.04, 0.57, 1.31), opacity .8s .8s;
    transition: transform .5s .85s cubic-bezier(0.99, 0.04, 0.57, 1.31), opacity .8s .8s, -webkit-transform .5s .85s cubic-bezier(0.99, 0.04, 0.57, 1.31);
}
.open{
    display: block;
    width: 30px;
    height: 20px;
    /*background: rgba(245, 245, 245, .3);*/
    cursor: pointer;
}
.open:after{
    content: '';
    width: 200px;
    height: 200px;
    background-color: rgba(245, 245, 245, .3);
    border-radius: 50%;
    opacity: 1;
    -webkit-transform: translate(-50%, -50%) scale3d(0, 0, 0);
    transform: translate(-50%, -50%) scale3d(0, 0, 0);
    -webkit-transition: none;
    -o-transition: none;
    transition: none;
}
.line{
    width: 4px;
    height: 30px;
    background: rgba(245, 245, 245, 1);
    border-radius: 5px;
    -webkit-transition: -webkit-transform .4s 1s cubic-bezier(0.64, 0.57, 0.67, 1.53);
    transition: -webkit-transform .4s 1s cubic-bezier(0.64, 0.57, 0.67, 1.53);
    -o-transition: transform .4s 1s cubic-bezier(0.64, 0.57, 0.67, 1.53);
    transition: transform .4s 1s cubic-bezier(0.64, 0.57, 0.67, 1.53);
    transition: transform .4s 1s cubic-bezier(0.64, 0.57, 0.67, 1.53), -webkit-transform .4s 1s cubic-bezier(0.64, 0.57, 0.67, 1.53);
}
.line:first-child{
    -webkit-transform: translate(-15px, -50%);
    -ms-transform: translate(-15px, -50%);
    transform: translate(-15px, -50%);
}
.line:last-child{
    -webkit-transform: translate(11px, -50%);
    -ms-transform: translate(11px, -50%);
    transform: translate(11px, -50%);
}
.content{
    width: 200px;
    height: 300px;
    background: rgba(255, 255, 255, 1);
    border-radius: 10px;
    -webkit-transform: translate(-50%, -50%) scale3d(0, 0, 0);
    transform: translate(-50%, -50%) scale3d(0, 0, 0);
    padding: 20px;
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-orient: vertical;
    -webkit-box-direction: normal;
    -ms-flex-direction: column;
    flex-direction: column;
    -webkit-box-pack: center;
    -ms-flex-pack: center;
    justify-content: center;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    color: #384055;
    font: normal 16px/1 sans-serif;
    text-align: center;
    -webkit-transition: -webkit-transform .5s .5s cubic-bezier(0.99, 0.04, 0.57, 1.31), -webkit-box-shadow .5s .5s;
    transition: -webkit-transform .5s .5s cubic-bezier(0.99, 0.04, 0.57, 1.31), -webkit-box-shadow .5s .5s;
    -o-transition: transform .5s .5s cubic-bezier(0.99, 0.04, 0.57, 1.31), box-shadow .5s .5s;
    transition: transform .5s .5s cubic-bezier(0.99, 0.04, 0.57, 1.31), box-shadow .5s .5s;
    transition: transform .5s .5s cubic-bezier(0.99, 0.04, 0.57, 1.31), box-shadow .5s .5s, -webkit-transform .5s .5s cubic-bezier(0.99, 0.04, 0.57, 1.31), -webkit-box-shadow .5s .5s;
}
.content h1{
    padding-bottom: 20px;
    font-size: 20px;
    -webkit-transition: opacity .5s, -webkit-transform .5s .02s cubic-bezier(0.99, 0.04, 0.57, 1.31);
    transition: opacity .5s, -webkit-transform .5s .02s cubic-bezier(0.99, 0.04, 0.57, 1.31);
    -o-transition: transform .5s .02s cubic-bezier(0.99, 0.04, 0.57, 1.31), opacity .5s;
    transition: transform .5s .02s cubic-bezier(0.99, 0.04, 0.57, 1.31), opacity .5s;
    transition: transform .5s .02s cubic-bezier(0.99, 0.04, 0.57, 1.31), opacity .5s, -webkit-transform .5s .02s cubic-bezier(0.99, 0.04, 0.57, 1.31);
}
.content p{
    line-height: 1.2;
    opacity: .5;
    font-size: 13px;
    padding-bottom: 20px;
    -webkit-transition: opacity .5s, -webkit-transform .3s cubic-bezier(0.99, 0.04, 0.57, 1.31);
    transition: opacity .5s, -webkit-transform .3s cubic-bezier(0.99, 0.04, 0.57, 1.31);
    -o-transition: transform .3s cubic-bezier(0.99, 0.04, 0.57, 1.31), opacity .5s;
    transition: transform .3s cubic-bezier(0.99, 0.04, 0.57, 1.31), opacity .5s;
    transition: transform .3s cubic-bezier(0.99, 0.04, 0.57, 1.31), opacity .5s, -webkit-transform .3s cubic-bezier(0.99, 0.04, 0.57, 1.31);
}
.content h1,
.content p{
    -webkit-transform: translate(0, 60px);
    -ms-transform: translate(0, 60px);
    transform: translate(0, 60px);
    opacity: 0;
}
.close{
    position: absolute;
    bottom: 20px;
    background: #FF6277;
    border-radius: 6px;
    color: #fff;
    padding: 15px 20px;
    cursor: pointer;
    font-weight: bolder;
    opacity: 0;
    -webkit-transform: scale3d(0,0,0);
    transform: scale3d(0,0,0);
    -webkit-transition: opacity .5s, -webkit-transform .5s cubic-bezier(0.99, 0.04, 0.57, 1.31);
    transition: opacity .5s, -webkit-transform .5s cubic-bezier(0.99, 0.04, 0.57, 1.31);
    -o-transition: transform .5s cubic-bezier(0.99, 0.04, 0.57, 1.31), opacity .5s;
    transition: transform .5s cubic-bezier(0.99, 0.04, 0.57, 1.31), opacity .5s;
    transition: transform .5s cubic-bezier(0.99, 0.04, 0.57, 1.31), opacity .5s, -webkit-transform .5s cubic-bezier(0.99, 0.04, 0.57, 1.31);
    -webkit-box-shadow: 0 0 2px rgba(0, 0, 0, .3);
    box-shadow: 0 0 2px rgba(0, 0, 0, .3);
}
.close:hover{
    -webkit-animation: bounce .5s;
    animation: bounce .5s
}
.close span{
    display: inline-block;
    position: relative;
}
.close:hover span{
    -webkit-animation: bounce .5s .03s;
    animation: bounce .5s .03s
}
.logo{
    position: absolute;
    top: 20px;
    left: 50%;
    -webkit-transform: translate(-50%, 0);
    -ms-transform: translate(-50%, 0);
    transform: translate(-50%, 0);
}
.logo__line{
    position: absolute;
    top: 15px;
    left: 50%;
    -webkit-transform: translate(-50%, -20px);
    -ms-transform: translate(-50%, -20px);
    transform: translate(-50%, -20px);
    width: 4px;
    height: 22px;
    border-radius: 6px;
    background: #FF6277;
    opacity: 0;
    -webkit-transition: opacity .8s .1s, -webkit-transform .5s .1s cubic-bezier(0.99, 0.04, 0.57, 1.31);
    transition: opacity .8s .1s, -webkit-transform .5s .1s cubic-bezier(0.99, 0.04, 0.57, 1.31);
    -o-transition: transform .5s .1s cubic-bezier(0.99, 0.04, 0.57, 1.31), opacity .8s .1s;
    transition: transform .5s .1s cubic-bezier(0.99, 0.04, 0.57, 1.31), opacity .8s .1s;
    transition: transform .5s .1s cubic-bezier(0.99, 0.04, 0.57, 1.31), opacity .8s .1s, -webkit-transform .5s .1s cubic-bezier(0.99, 0.04, 0.57, 1.31);
}
.logo__line:first-child{
    -webkit-transform: translate(calc(0% - 50% - 10px), -20px);
    -ms-transform: translate(calc(0% - 50% - 10px), -20px);
    transform: translate(calc(0% - 50% - 10px), -20px);
    -webkit-transition: opacity .8s .2s, -webkit-transform .5s .2s cubic-bezier(0.99, 0.04, 0.57, 1.31);
    transition: opacity .8s .2s, -webkit-transform .5s .2s cubic-bezier(0.99, 0.04, 0.57, 1.31);
    -o-transition: transform .5s .2s cubic-bezier(0.99, 0.04, 0.57, 1.31), opacity .8s .2s;
    transition: transform .5s .2s cubic-bezier(0.99, 0.04, 0.57, 1.31), opacity .8s .2s;
    transition: transform .5s .2s cubic-bezier(0.99, 0.04, 0.57, 1.31), opacity .8s .2s, -webkit-transform .5s .2s cubic-bezier(0.99, 0.04, 0.57, 1.31);
}
.logo__line:last-child{
    -webkit-transform: translate(calc(0% - 50% + 10px), -20px);
    -ms-transform: translate(calc(0% - 50% + 10px), -20px);
    transform: translate(calc(0% - 50% + 10px), -20px);
    -webkit-transition: opacity .8s .3s, -webkit-transform .5s .3s cubic-bezier(0.99, 0.04, 0.57, 1.31);
    transition: opacity .8s .3s, -webkit-transform .5s .3s cubic-bezier(0.99, 0.04, 0.57, 1.31);
    -o-transition: transform .5s .3s cubic-bezier(0.99, 0.04, 0.57, 1.31), opacity .8s .3s;
    transition: transform .5s .3s cubic-bezier(0.99, 0.04, 0.57, 1.31), opacity .8s .3s;
    transition: transform .5s .3s cubic-bezier(0.99, 0.04, 0.57, 1.31), opacity .8s .3s, -webkit-transform .5s .3s cubic-bezier(0.99, 0.04, 0.57, 1.31);
}
@-webkit-keyframes bounce {
    0% {
        -webkit-transform: translate(0px, 0px);
        transform: translate(0px, 0px); 
    }
    40% {
        -webkit-transform: translate(0px, -12px);
        transform: translate(0px, -12px);
    }
    80% {
        -webkit-transform: translate(0px, 2px);
        transform: translate(0px, 2px); 
    }
    100% {
        -webkit-transform: translate(0px, 0px);
        transform: translate(0px, 0px); 
    } 
}
@keyframes bounce {
    0% {
        -webkit-transform: translate(0px, 0px);
        transform: translate(0px, 0px); 
    }
    40% {
        -webkit-transform: translate(0px, -12px);
        transform: translate(0px, -12px);
    }
    80% {
        -webkit-transform: translate(0px, 2px);
        transform: translate(0px, 2px); 
    }
    100% {
        -webkit-transform: translate(0px, 0px);
        transform: translate(0px, 0px); 
    } 
}

0 个答案:

没有答案