国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發 > CSS > 正文

用CSS3和table標簽實現一個圓形軌跡的動畫的示例代碼

2024-07-11 08:59:48
字體:
來源:轉載
供稿:網友

html:其實就是根據table標簽把幾個實心圓div進行等邊六角形的排布,并放入一個div容器中,然后利用CSS3的循環旋轉的動畫效果對最外層的div容器進行自轉實現,當然不要忘了把div容器的外邊框設置圓形弧度的。

<div class="animation_div">        <table class="table_class">            <tr>                <td></td>                <td>                    <div class="BMI" ng-click="compriseClicked('BMI')" ng-class="{isSelected:clickUrlKey=='BMI'}">                        <strong>BMI</strong>                    </div>                </td>                <td></td>                <td>                    <div class="color_blind" ng-click="compriseClicked('color_blind')" ng-class="{isSelected:clickUrlKey=='color_blind'}">                        <strong>色盲色弱</strong>                    </div>                </td>                <td></td>            </tr>            <tr>                <td>                    <div class="space_div"></div>                </td>            </tr>            <tr>                <td>                    <div class="HR" ng-click="compriseClicked('HR')" ng-class="{isSelected:clickUrlKey=='HR'}">                        <strong>心率</strong>                    </div>                </td>                <td></td>                <td>                    <a href="#/app/custom_made/counselor/{{clickUrlKey}}" style="text-decoration: none;                        color: black;">                        <div class="start_test">                            <strong>開始測試</strong>                        </div>                    </a>                </td>                <td></td>                <td>                    <div class="fat_content" ng-click="compriseClicked('fat_content')" ng-class="{isSelected:clickUrlKey=='fat_content'}">                        <strong>脂肪含量</strong>                    </div>                </td>            </tr>            <tr>                <td>                    <div class="space_div"></div>                </td>            </tr>            <tr>                <td></td>                <td>                    <div class="WHR" ng-click="compriseClicked('WHR')" ng-class="{isSelected:clickUrlKey=='WHR'}">                        <strong>腰臀比</strong>                    </div>                </td>                <td></td>                <td>                    <div class="safe_period" ng-click="compriseClicked('safe_period')" ng-class="{isSelected:clickUrlKey=='safe_period'}">                        <strong>安全期</strong>                    </div>                </td>                <td></td>            </tr>        </table>    </div>        <h3>clickUrlKey:{{clickUrlKey}}</h3>

css:因為在圓形的軌跡中有6個實心圓,分別設置了不同的類以方便自定義,所以當中實心圓的樣式設置有重復的地方,還可以進行優化,在這就先不處理了

<style>      /*定義動畫*/            @-webkit-keyframes round_animation {          0%{              -webkit-transform:rotate(0deg);              width:260px;              height:260px;          }          100%{              -webkit-transform:rotate(360deg);              width:260px;              height:260px;              left:0px;              top:0px;          }      }            /*定義外框的樣式*/      /*調用動畫并設置動畫的參數*/            .animation_div {          -webkit-transform-origin:center center;                       /*定義旋轉中心點*/          -webkit-animation:round_animation 15s infinite alternate;     /*infinite alternate表示循環播放動畫*/                    margin: 60px auto;          width:260px;          height:260px;          border: 1px solid black;          border-radius: 130px;          left:0px;          top:0px;      }            .animation_div strong {          font-size: 12px;      }            .BMI {          width: 50px;          height: 50px;          background-color: orange;          border-radius: 100px;          text-align: center;                    /*文字垂直居中*/          vertical-align: middle;          line-height: 50px;      }            .color_blind {          width: 50px;          height: 50px;          background-color: green;          border-radius: 100px;          text-align: center;                    /*文字垂直居中*/          vertical-align: middle;          line-height: 50px;      }            .HR{          margin-left: -15px;          width: 50px;          height: 50px;          background-color: blue;          border-radius: 100px;          text-align: center;                    /*文字垂直居中*/          vertical-align: middle;          line-height: 50px;      }            .start_test {          width: 60px;          height: 60px;          background-color: red;          border-radius: 100px;          text-align: center;                    /*文字垂直居中*/          vertical-align: middle;          line-height: 50px;      }            .fat_content {          margin-left: 15px;          width: 50px;          height: 50px;          background-color: gray;          border-radius: 100px;          text-align: center;                    /*文字垂直居中*/          vertical-align: middle;          line-height: 50px;      }            .WHR {          width: 50px;          height: 50px;          background-color: purple;          border-radius: 100px;          text-align: center;                    /*文字垂直居中*/          vertical-align: middle;          line-height: 50px;      }            .safe_period {          width: 50px;          height: 50px;          background-color: yellow;          border-radius: 100px;          text-align: center;                    /*文字垂直居中*/          vertical-align: middle;          line-height: 50px;      }            .space_div {          width: 50px;          height: 50px;          background-color: clear;          border-radius: 100px;      }            .rightmenu_btn {          height: 60px;          float: none;      }            .rightmenu_btn button {          margin-top: 50px;          width: 20px;          height: 60px;          border: 1px solid rgb(221, 221, 221);          border-right: 0px;          float: right;      }            .isSelected {          border: 1px solid red;      }  </style>

JS:這里的代碼可以不實現,因為這跟動畫的效果無關,是一個點擊的響應事件

angular.module('starter.controllers', [])    .controller('healthCtrl', function($scope, $location) {        $scope.clickUrlKey = "BMI";        $scope.compriseClicked = function(clickUrlKey) {            $scope.clickUrlKey = clickUrlKey;        };    })

效果圖如下:

以上就是本文的全部內容,希望對大家的學習有所幫助,也希望大家多多支持武林網。

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 犍为县| 武山县| 台山市| 邯郸市| 永平县| 彩票| 黄梅县| 冀州市| 阜南县| 洪雅县| 汨罗市| 东安县| 夏邑县| 泗洪县| 大城县| 遂溪县| 瑞昌市| 鄂托克前旗| 高台县| 邛崃市| 逊克县| 高邮市| 巴楚县| 龙海市| 正定县| 南宁市| 体育| 青冈县| 菏泽市| 南江县| 延边| 永吉县| 玉林市| 雷山县| 双城市| 怀宁县| 正定县| 珠海市| 沭阳县| 犍为县| 藁城市|