<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
        主站蜘蛛池模板: 成人精品视频99在线观看免费| 亚洲中文字幕无码中文| 羞羞视频在线观看免费| 亚洲一区二区三区深夜天堂| 3d动漫精品啪啪一区二区免费| 亚洲人成伊人成综合网久久| 最近最好的中文字幕2019免费| 亚洲一区爱区精品无码| 成人妇女免费播放久久久| 亚洲AV无码一区二区三区DV| 特级毛片A级毛片免费播放| 又黄又爽一线毛片免费观看| 国产成人精品日本亚洲网址| 日本免费污片中国特一级| 亚洲色婷婷综合开心网| 永久免费无码日韩视频| 亚洲AV天天做在线观看| 国产精品免费久久久久影院| 亚洲VA中文字幕无码一二三区| 99在线视频免费| 久久青青成人亚洲精品| 天天影视色香欲综合免费| 久久精品亚洲中文字幕无码麻豆| 日本zzzzwww大片免费| 亚洲精品无码成人片久久不卡| 亚洲av区一区二区三| 亚洲av色香蕉一区二区三区| 亚洲日韩人妻第一页| 最近中文字幕免费2019| 亚洲美国产亚洲AV| 亚洲女人被黑人巨大进入| 1a级毛片免费观看| 黄页免费视频播放在线播放| 久久精品国产亚洲香蕉| 毛片免费观看的视频| 精品乱子伦一区二区三区高清免费播放 | 亚洲美女视频免费| 特黄aa级毛片免费视频播放| 亚洲国产精品久久久久网站| 欧洲人成在线免费| 精品久久久久亚洲|