TweenMax+AnticipateEase实现果冻胶囊红绿开关checkbox效果代码

代码语言:html

所属分类:表单美化

代码描述:TweenMax+AnticipateEase实现果冻胶囊红绿开关checkbox效果代码

代码标签: 胶囊 红绿 开关 checkbox 效果

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

<html>
<head>
    <meta charset="UTF-8">
    <style>
        body {
            background-color: #FFF;
            overflow: hidden;
        }
        body,
        html {
            height: 100%;
            width: 100%;
            margin: 0;
            padding: 0;
        }
        svg {
            width: 100%;
            height: 100%;
            visibility: hidden;
        }
        #hitArea {
            cursor: pointer;
        }
        #base {
            stroke: #263238;
        }
        #lineSelector {
            stroke: #F44336;
        }
    </style>

</head>
<body>

    <svg viewBox="0 0 800 600" xmlns="https://www.w3.org/2000/svg" style="visibility: visible;">
        <defs>
        </defs>
        <line id="base" fill="none" stroke="#BBBABB" stroke-width="100" stroke-linecap="round" stroke-miterlimit="10" x1="350" y1="300" x2="450" y2="300" style="stroke-width: 100px;"></line>
        <line id="lineSelector" fill="none" stroke="#224687" stroke-width="60" stroke-linecap="round" stroke-miterlimit="10" x1="350" y1="300" x2="350" y2="300" style="stroke-width: 60px; stroke: rgb(244, 67, 54);"></line>
        <circle id="hitL" cx="350" cy="300" r="40" fill="#EEE" opacity="0" style="opacity: 0;"></circle>
        <circle id="hitR" cx="450" cy="300" r="40" fill="#EEE" opacity="0" style="opacity: 0;"></circle>
        <line id="hitArea" fill="none" stroke="transparent" stroke-width="100" stroke-linecap="round" stroke-miterlimit="10" x1="350" y1="300" x2="450" y2="300"></line>
    </svg>

    <script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/TweenMax.min.js"></script>
    <script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/AnticipateEase.min.js"></script>
    <script>
        var xmlns = "http://www.w3.org/2000/svg",
        xlinkns = "http://www.w3.org/1999/xlink",
        select = function(s) {
            return document.querySelector(s);
        },
        selectAll = function(s) {
            return document.querySelectorAll(s);
        },
        lineSelector = select('#lineSelector'),
        hitArea = select('#hitArea'),
        hitL = select('#hitL'),
        hitR = select('#hitR'),
        base = select('#base'),
        selectorColorArray = ['#4CAF50', '#F44336']


        TweenMax.set('svg', {
            visibility: 'visible'
        })

        var introTl = new TimelineMax({
            paused: false,
            onComplete: createInt.........完整代码请登录后点击上方下载按钮下载查看

网友评论0