3d粒子按钮特效

代码语言:html

所属分类:粒子

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

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">

    <title>Emoji Particle Physics with JavaScript | @keyframers 2.21.0</title>

    <style>
@import url("https://fonts.googleapis.com/css?family=Fascinate+Inline&display=swap");
        html, body {
            height: 100%;
            width: 100%;
            padding: 0;
            margin: 0;
            overflow: hidden;
        }

        * {
            box-sizing: border-box;
            position: relative;
        }

        body {
            display: flex;
            justify-content: center;
            align-items: center;
            background: #14192C;
        }

        .treat-button {
            font-family: 'Fascinate Inline', cursive;
            font-size: 4vmin;
            -webkit-appearance: none;
            -moz-appearance: none;
            appearance: none;
            background: linear-gradient(tobottom, #F46001, #E14802);
            border: none;
            color: #FFF;
            border-radius: 2em;
            padding: .6em 1.5em;
            overflow: hidden;
            -webkit-user-select: none;
            -moz-user-select: none;
            -ms-user-select: none;
            user-select: none;
            cursor: pointer;
            z-index: 1;
            box-shadow: 0 0 1em rgba(255, 255, 255, 0.2);
            transition: box-shadow 0.2s, -webkit-transform 0.1s cubic-bezier(0.5, 0, 0.5, 1);
            transition: transform 0.1s cubic-bezier(0.5, 0, 0.5, 1), box-shadow 0.2s;
            transition: transform 0.1s cubic-bezier(0.5, 0, 0.5, 1), box-shadow 0.2s, -webkit-transform 0.1s cubic-bezier(0.5, 0, 0.5, 1);
            outline: none;
        }
        .treat-button:hover {
            box-shadow: 0 0 2em rgba(255, 255, 255, 0.3);
        }
        .treat-button:active {
            -webkit-transform: scale(0.8) translateY(10%);
            transform: scale(0.8) translateY(10%);
            transition-timing-function: cubic-bezier(0.5, 0, 0.5, 1);
        }

        .treat {
            --scale-x: 0;
            --scale-y: 0;
            pointer-events: none;
            display: block;
            position: absolute;
            top: 0;
            left: calc(50% - .5rem);
            border-radius: 50%;
            width: 1em;
            height: 1em;
            display: flex;
            justify-content: center;
            align-items: center;
            font-size: 5vmin;
            -webkit-transform: translate(calc( var(--x) *1px ), calc( var(--y) * 1px )) translate(-50%, -50%);
            transform: translate(calc( var(--x) *1px ), calc( var(--y) * 1px )) translate(-50%, -50%);
            pointer-events: none;
            -webkit-animation: treat-enter 0.1s ease-in backwards, treat-exit 300ms linear calc( (var(--lifetime, 3000) * 1ms) - 300ms) forwards;
            animation: treat-enter 0.1s ease-in backwards, treat-exit 300ms linear calc( (var(--lifetime, 3000) * 1ms) - 300ms) forwards;
        }
@-webkit-keyframes treat-enter {
            from {
                opacity: 0;
            }
        }
@keyframes treat-enter {
            from {
                opacity: 0;
            }
        }
@-webkit-keyframes treat-exit {
            to {
                opacity: 0;
            }
        }
@keyframes treat-exit {
            to {
                opacity: 0;
            }
        }
      .........完整代码请登录后点击上方下载按钮下载查看

网友评论0