gsap实现照明开关动画切换效果

代码语言:html

所属分类:表单美化

代码描述:gsap实现照明开关动画切换效果

代码标签: 开关 动画 切换 效果

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

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

<head>

    <meta charset="UTF-8">




    <link rel='stylesheet' href='https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,300;0,700;1,400&amp;display=swap'>

    <style>
        /* ***** Colors - Start ***** */
        /* ***** Colors - End ***** */
        /* ***** Global Styles - Start ***** */
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            font-family: "Poppins", sans-serif;
        }

        body {
            background-color: #fdb813;
        }

        .container {
            display: flex;
            justify-content: center;
            align-items: center;
        }

        /* ***** Global Styles - End ***** */
        /* ***** Specific Styles - Start ***** */
        .container {
            height: 100vh;
        }

        .switch {
            width: 60px;
            height: 110px;
            padding-top: 2px;
            background-color: #514e4b;
            border-radius: 40px;
            cursor: pointer;
            outline: none;
            overflow: hidden;
            box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
        }

        .toggle-button {
            transform: scale(0.8);
            transform-origin: center center;
        }

        .toggle {
            position: relative;
            width: 35px;
            height: 35px;
            margin: 12px;
            margin-top: 12px;
            background-color: #fdb813;
            border-radius: 50%;
        }

        .moon-mask {
            position: absolute;
            width: 35px;
            height: 35px;
            margin: -74px 0 0 34px;
            background-color: #514e4b;
            border-radius: 50%;
        }

        .circles-wrapper .circle {
            position: absolute;
            width: 4px;
            height: 8px;
            background-color: #fff;
            border-radius: 10px;
        }
        .circles-wrapper .circle:first-child {
            margin: -57px 0 0 27px;
       .........完整代码请登录后点击上方下载按钮下载查看

网友评论0