我是靠谱客的博主 失眠冷风,这篇文章主要介绍css3绘制八卦图及动画效果,现在分享给大家,希望可以做个参考。

原理很简单,就是外面加个盒子box。作为旋转动画的box,然后里面分别利用两个div使用css3的 border-radius绘制半圆,分别定位在上下中间对齐两个位置,里面在放两个小的原点水平和垂直方向对齐即可实现。然后在使用Css3的animation属性制作动画。效果如下图。
这里写图片描述

复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>css3绘制八卦图及动画效果</title> <style> * { padding: 0; margin: 0; } .box { margin: 100px auto; width: 400px; height:400px; border-radius:200px; box-shadow:0 0 10px #999; position:relative; animation:circleRotate 3s linear 2s infinite; } .semi-circle{ height:400px; width:200px; } .box .left{ background:#000; border-top-left-radius:200px; border-bottom-left-radius:200px; } .box .right{ background:#fff; border-top-left-radius:200px; border-bottom-left-radius:200px; } .box .top-circle{ position:absolute; left:100px; top:0; height:200px; width:200px; text-align:center; line-height:200px; border-radius:100px; background:#000; } .box .bottom-circle{ position:absolute; left:100px; bottom:0; height:200px; width:200px; text-align:center; line-height:200px; border-radius:100px; background:#fff; } .box .small-circle{ display:inline-block; height:40px; width:40px; border-radius:20px; background:red; } .box .white{background:#fff;} .box .black{background:#000;} @keyframes circleRotate{ %0{ transform:rotate(0deg); } 100%{ transform:rotate(360deg); } } </style> </head> <body> <div class="box"> <div class="semi-circle left"></div> <div class="semi-circle right"></div> <div class="top-circle"> <span class="small-circle white"></span> </div> <div class="bottom-circle"> <span class="small-circle black"></span> </div> </div> </body> </html>

最后

以上就是失眠冷风最近收集整理的关于css3绘制八卦图及动画效果的全部内容,更多相关css3绘制八卦图及动画效果内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(65)

评论列表共有 0 条评论

立即
投稿
返回
顶部