css实现不同角度进入悬浮按钮三维翻转动画效果

代码语言:html

所属分类:悬停

代码描述:css实现不同角度进入悬浮按钮三维翻转动画效果

代码标签: 角度 进入 悬浮 按钮 三维 翻转 动画 效果

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html lang="en">

<head>

    <meta charset="UTF-8">




    <style>
        *, *:before, *:after {
            box-sizing: border-box;
        }

        * {
            -webkit-user-select: none;
            -moz-user-select: none;
            -ms-user-select: none;
            user-select: none;
            -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
            -webkit-transform-style: preserve-3d;
            transform-style: preserve-3d;
        }

        *:focus {
            outline: none !important;
        }

        body, html {
            height: 100%;
        }

        body {
            display: -webkit-box;
            display: flex;
            -webkit-box-align: center;
            align-items: center;
            align-content: center;
            -webkit-box-pack: center;
            justify-content: center;
            padding: 12px;
            background: #84c7a7;
            background: linear-gradient(135deg, #3023ae 0%, #53a0fe 50%, #b4ed50 100%);
            filter: progid: DXImageTransform.Microsoft.gradient( startColorstr='$indigo', endColorstr='$lime',GradientType=1 );
            font-family: "brandon-grotesque", "Brandon Grotesque", "Source Sans Pro", "Segoe UI", Frutiger, "Frutiger Linotype", "Dejavu Sans", "Helvetica Neue", Arial, sans-serif;
            text-rendering: optimizeLegibility;
            -webkit-font-smoothing: antialiased;
        }

        ul {
            -webkit-perspective: 1000px;
            perspective: 1000px;
            -webkit-transform: translateZ(96px);
            transform: translateZ(96px);
            display: -webkit-box;
            display: flex;
            list-style: none;
            margin: 0;
            padding: 12px;
        }
        ul li {
            padding: 12px;
        }

        .clips {
            position: absolute;
            top: 0;
            left: 0;
            width: 0;
            height: 0;
            opacity: 0;
            z-index: -100;
        }

        .link {
            position: relative;
            width: 96px;
            height: 96px;
        }
        .link a {
            -webkit-transform-origin: 48px 48px -48px;
            transform-origin: 48px 48px -48px;
            display: block;
            position: absolute;
            z-index: 1;
            -webkit-transform: translateZ(24px);
            transform: translateZ(24px);
            width: 100%;
            height: 100%;
        }
        .link a:nth-child(1) {
            top: 0;
            left: 0;
            height: 50%;
            -webkit-clip-path: polygon(50% 100%, 0 0, 100% 0);
            clip-path: polygon(50% 100%, 0 0, 100% 0);
        }
@-moz-document url-prefix() {
            .link a:nth-child(1) {
                clip-path: url(#clip-top);
            }
        }
        .link a:nth-child(1):hover ~ .cube, .link a:nth-child(1):focus ~ .cube {
            -webkit-transform: rotateX(-0.5turn);
            transform: rotateX(-0.5turn);
        }
        .link a:nth-child(1):hover ~ .cube div:nth-child(6), .link a:nth-child(1):focus ~ .cube div:nth-child(6) {
            -webkit-transform: rotateY(180deg) rotateZ(180deg) translateZ(96px);
            transform: rotateY(180deg) rotateZ(180deg) translateZ(96px);
        }
        .link a:nth-child(2) {
            top: 0;
            right: 0;
            width: 50%;
            -webkit-clip-path: polygon(100% 100%, 0 50%, 100% 0);
            clip-path: polygon(100% 100%, 0 50%, 100% 0);
        }
@-moz-document url-prefix() {
            .link a:nth-child(2) {
                clip-path: url(#clip-right);
            }
        }
        .link a:nth-child(2):hover ~ .cube, .link a:nth-child(2):focus ~ .cube {
            -webkit-transform: rotateY(-0.5turn);
            transform: rotateY(-0.5turn);
        }
        .link a:nth-child(3) {
            bottom: 0;
            right: 0;
            height: 50%;
            -webkit-clip-path: polygon(0 100%, 50% 0, 100% 100%);
            clip-path: polygon(0 100%, 50% 0, 100% 100%);
        }
@-moz-document url-prefix() {
            .link a:nth-child(3) {
                clip-path: url(#clip-bottom);
            }
        }
        .link a:nth-child(3):hover ~ .cube, .link a:nth-child(3):focus ~ .cube {
            -webkit-transform: rotateX(0.5turn);
            transform: rotateX(0.5turn);
        }
        .link a:nth-child(3):hover ~ .cube div:nth-child(6), .link a:nth-child(3):focus ~ .cube div:nth-child(6) {
            -webkit-transform: rotateY(180deg) rotateZ(180deg) translateZ(96px);
            transform: rotateY(180deg) rotateZ(180deg) translateZ(96px);
        }
        .link a:nth-child(4) {
            bottom: 0;
            left: 0;
            width: 50%;
            -webkit-clip-path: polygon(0 100%, 0 0, 100% 50%);
            clip-path: polygon(0 100%, 0 0, 100% 50%);
        }
@-moz-document url-prefix() {
            .link a:nth-child(4) {
                clip-path: url(#clip-left);
            }
        }
        .link a:nth-child(4):hover ~ .cube, .link a:nth-child(4):focus ~ .cube {
            -webkit-transform: rotateY(0.5turn);
            transform: rotateY(0.5turn);
        }
        .link a:nth-child(1):hover, .link a:nth-child(1):focus, .link a:nth-child(2):hover, .link a:nth-child(2):focus, .link a:nth-child(3):hover, .link a:nth-child(3):focus, .link a:nth-child(4):hover, .link a:nth-child(4):focus {
            z-index: 2;
            -webkit-transform: translateZ(36px);
            transform: translateZ(36px);
            width: 100% !important;
            height: 100% !important;
            -webkit-clip-path: none !important;
            clip-path: none !important;
            -webkit-transition: all 100ms ease 500ms;
            transition: all 100ms ease 500ms;
        }

        .cube {
            -webkit-transform-origin: 48px 48px -48px;
            transform-origin: 48px 48px -48px;
            position: relative;
            z-index: 0;
            display: block;
            width: 100%;
            height: 100%;
            -webkit-transition: all 300ms ease-out;
            transition: all 300ms ease-out;
        }
        .cube div {
            display: -webkit-.........完整代码请登录后点击上方下载按钮下载查看

网友评论0