<span id="mktg5"></span>

<i id="mktg5"><meter id="mktg5"></meter></i>

        <label id="mktg5"><meter id="mktg5"></meter></label>
        最新文章專題視頻專題問答1問答10問答100問答1000問答2000關鍵字專題1關鍵字專題50關鍵字專題500關鍵字專題1500TAG最新視頻文章推薦1 推薦3 推薦5 推薦7 推薦9 推薦11 推薦13 推薦15 推薦17 推薦19 推薦21 推薦23 推薦25 推薦27 推薦29 推薦31 推薦33 推薦35 推薦37視頻文章20視頻文章30視頻文章40視頻文章50視頻文章60 視頻文章70視頻文章80視頻文章90視頻文章100視頻文章120視頻文章140 視頻2關鍵字專題關鍵字專題tag2tag3文章專題文章專題2文章索引1文章索引2文章索引3文章索引4文章索引5123456789101112131415文章專題3
        問答文章1 問答文章501 問答文章1001 問答文章1501 問答文章2001 問答文章2501 問答文章3001 問答文章3501 問答文章4001 問答文章4501 問答文章5001 問答文章5501 問答文章6001 問答文章6501 問答文章7001 問答文章7501 問答文章8001 問答文章8501 問答文章9001 問答文章9501
        當前位置: 首頁 - 科技 - 知識百科 - 正文

        JQuery自定義CircleAnimation,Animate方法學習筆記_jquery

        來源:懂視網 責編:小采 時間:2020-11-27 20:59:42
        文檔

        JQuery自定義CircleAnimation,Animate方法學習筆記_jquery

        JQuery自定義CircleAnimation,Animate方法學習筆記_jquery:在此貼出一些學習成果,希望能對學習JQuery的其他同學有所幫助,同時也記錄下自己的學習情況。 看了一些JQuery的官方教程,已經有點心潮澎湃了,就決定自己嘗試著寫一些東西出來。我看到了很多很絢的動畫效果,然后決定自己也嘗試一下,我決定要寫一個圓周運
        推薦度:
        導讀JQuery自定義CircleAnimation,Animate方法學習筆記_jquery:在此貼出一些學習成果,希望能對學習JQuery的其他同學有所幫助,同時也記錄下自己的學習情況。 看了一些JQuery的官方教程,已經有點心潮澎湃了,就決定自己嘗試著寫一些東西出來。我看到了很多很絢的動畫效果,然后決定自己也嘗試一下,我決定要寫一個圓周運

        在此貼出一些學習成果,希望能對學習JQuery的其他同學有所幫助,同時也記錄下自己的學習情況。
        看了一些JQuery的官方教程,已經有點心潮澎湃了,就決定自己嘗試著寫一些東西出來。我看到了很多很絢的動畫效果,然后決定自己也嘗試一下,我決定要寫一個圓周運動的動畫效果,下面貼出js代碼
        代碼如下:
        var CircleAnimation = function (center_left, center_top, id, clockwise, duration) {
        return new CircleAnimation.fn.init(center_left, center_top, id, clockwise, duration);
        };
        CircleAnimation.fn = CircleAnimation.prototype = {
        item: {},
        init:
        function (center_left, center_top, id, clockwise, duration) {
        this.item = $("#" + id + "");
        if (!this.item[0])
        return;
        currentPoint = {
        x: this.item.css("left") == "auto" ? 0 : String(this.item.css("left")).replace("px", "") - center_left,
        y: this.item.css("top") == "auto" ? 0 : String(this.item.css("top")).replace("px", "") - center_top
        };
        center_left = center_left;
        center_top = center_top;
        if (currentPoint.x == 0 && currentPoint.y == 0)
        return;
        r = Math.pow(Math.pow(currentPoint.x, 2) + Math.pow(currentPoint.y, 2), 0.5);
        var flag = false;
        var caculateMiniAngle = function (angle) {
        //caculate the minimum angle diff, if the distance between 2 points less than 1px, we think this 2 ponits angle should be the minimum angle diff
        if (Math.sin(angle / 2) * 2 * r > 1) {
        return caculateMiniAngle(angle / 2);
        }
        else {
        return angle;
        }
        }
        miniAngle = caculateMiniAngle(Math.PI / 4);
        //store data to dom element
        this.item.data("currentPoint", currentPoint);
        this.item.data("center_left", center_left);
        this.item.data("center_top", center_top);
        this.item.data("r", r);
        this.item.data("clockwise", clockwise);
        this.item.data("miniAngle", miniAngle);
        this.item.data("duration", duration);
        //this.item.data("startX", this.startX);
        },
        start:
        function () {
        var element;
        if (this.id)
        element = $("#" + this.id.toString());
        else
        element = this.item;
        element.animate({ left: 1, top: 1 }, {
        duration: element.data(
        "duration"),
        step: CircleAnimation.fn.caculateNextPoint
        });
        },
        caculateNextPoint:
        function () {
        var el;
        el = $(
        "#" + this.id.toString());
        var sin = el.data("currentPoint").y / el.data("r");
        var angle = Math.asin(sin);
        if (el.data("currentPoint").x < 0)
        angle = Math.PI - angle;
        //caculate the angle diff between current point angle and next point angle
        var anglediff = el.data("miniAngle");
        if (el.data("duration") != undefined)
        anglediff = 2 * Math.PI * 13 / el.data(
        "duration");
        if (el.data("clockwise"))
        angle = angle - anglediff;
        else
        angle = angle + anglediff;
        var y = el.data("r") * Math.sin(angle);
        var x = el.data("r") * Math.cos(angle);
        var fx = arguments[1];
        //set duration big enough then circle animation never stop
        fx.options.duration = (
        new Date).getTime() - fx.startTime + 10000;
        if (fx.prop == "top")
        fx.now = y + el.data(
        "center_top");
        if (fx.prop == "left")
        fx.now = x + el.data(
        "center_left");
        el.data(
        "currentPoint", { x: x, y: y });
        },
        stop:
        function () {
        this.item.queue("fx", []);
        this.item.stop();
        }
        };
        CircleAnimation.fn.init.prototype = CircleAnimation.fn;

        聲明:本網頁內容旨在傳播知識,若有侵權等問題請及時與本網聯系,我們將在第一時間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com

        文檔

        JQuery自定義CircleAnimation,Animate方法學習筆記_jquery

        JQuery自定義CircleAnimation,Animate方法學習筆記_jquery:在此貼出一些學習成果,希望能對學習JQuery的其他同學有所幫助,同時也記錄下自己的學習情況。 看了一些JQuery的官方教程,已經有點心潮澎湃了,就決定自己嘗試著寫一些東西出來。我看到了很多很絢的動畫效果,然后決定自己也嘗試一下,我決定要寫一個圓周運
        推薦度:
        • 熱門焦點

        最新推薦

        猜你喜歡

        熱門推薦

        專題
        Top
        主站蜘蛛池模板: 亚洲人成免费网站| 国产aⅴ无码专区亚洲av| 搡女人真爽免费视频大全| 女人张腿给男人桶视频免费版 | 亚洲永久无码3D动漫一区| 久久久久无码专区亚洲av| 亚洲成色在线影院| 亚洲日韩乱码中文字幕| 免费人成大片在线观看播放电影| 久久精品成人免费观看97| 两个人的视频高清在线观看免费| 亚洲视频在线一区二区| 亚洲人成网站日本片| 91免费精品国自产拍在线不卡| 亚洲综合色区在线观看| 国产亚洲精品免费视频播放| 欧美日韩国产免费一区二区三区 | 亚洲尹人九九大色香蕉网站| 日韩国产精品亚洲а∨天堂免| 99re在线免费视频| 亚洲国产综合精品中文字幕| 亚洲一区二区三区久久| 国产精品免费高清在线观看| 亚洲伊人成无码综合网| 久久久久久成人毛片免费看| 亚洲区小说区图片区| 九九精品成人免费国产片| 国产做床爱无遮挡免费视频| 亚洲乱人伦精品图片| 日本人的色道www免费一区| 亚洲中文字幕无码爆乳app| 日本免费一区二区在线观看| 亚洲色WWW成人永久网址| 无码国产精品一区二区免费式影视 | 亚洲精品mv在线观看| 免费一级毛片在线播放视频| 亚洲sss综合天堂久久久| 台湾一级毛片永久免费| 看Aⅴ免费毛片手机播放| 国产亚洲精品免费| 日本免费人成网ww555在线 |