hooyantsing's Blog

P183_32_校正旋转菜单子元素角度

字数统计: 572阅读时长: 3 min
2020/04/23

P183 32 校正旋转菜单子元素角度

实战案例

效果:

29e9e849ccfd56b9d3d59c5c0fa84898.png

源码:

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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        * {
            padding: 0;
            margin: 0;
            box-sizing: border-box;
        }

        body {
            height: 100vh;
            width: 100vw;
            display: flex;
            justify-content: center;
            align-items: center;
            background: #2c3e50;
        }

        nav {
            display: flex;
            justify-content: center;
            align-items: center;
            height: 400px;
            width: 400px;
            border-radius: 50%;
            /*cursor: pointer;*/
        }

        nav::after {
            content: '后盾人';
            border-radius: 50%;
            background: #e74c3c;
            width: 200px;
            height: 200px;
            position: absolute;
            display: flex;
            justify-content: center;
            align-items: center;
            font-size: 3em;
            color: white;
        }

        nav::before {
            content: '';
            border-radius: 50%;
            background: #e74c3c;
            width: 200px;
            height: 200px;
            position: absolute;
        }

        nav:hover ul {
            transform: scale(1);
        }

        ul {
            width: 300px;
            height: 300px;
            /*background: black;*/
            list-style-type: none;
            position: relative;
            transform: scale(0);
            transition: .5s;
        }

        li {
            width: 80px;
            height: 80px;
            background: #e74c3c;
            display: flex;
            justify-content: center;
            align-items: center;
            font-size: 3em;
            color: white;
            border-radius: 50%;
            position: absolute;
            transform-origin: 150px 150px;
            transition: 2s;
        }

        ul li span {
            transition: 1s;
        }

        nav:hover li:nth-child(1) {
            transform: rotateZ(40deg);
        }

        nav:hover li:nth-child(1) span {
            transform: rotateZ(320deg);
        }

        nav:hover li:nth-child(2) {
            transform: rotateZ(80deg);
        }

        nav:hover li:nth-child(2) span {
            transform: rotateZ(640deg);
        }

        nav:hover li:nth-child(3) {
            transform: rotateZ(120deg);
        }

        nav:hover li:nth-child(3) span {
            transform: rotateZ(960deg);
        }

        nav:hover li:nth-child(4) {
            transform: rotateZ(160deg);
        }

        nav:hover li:nth-child(4) span {
            transform: rotateZ(1280deg);
        }

        nav:hover li:nth-child(5) {
            transform: rotateZ(200deg);
        }

        nav:hover li:nth-child(5) span {
            transform: rotateZ(1600deg);
        }

        nav:hover li:nth-child(6) {
            transform: rotateZ(240deg);
        }

        nav:hover li:nth-child(6) span {
            transform: rotateZ(1920deg);
        }

        nav:hover li:nth-child(7) {
            transform: rotateZ(280deg);
        }

        nav:hover li:nth-child(7) span {
            transform: rotateZ(2240deg);
        }

        nav:hover li:nth-child(8) {
            transform: rotateZ(320deg);
        }

        nav:hover li:nth-child(8) span {
            transform: rotateZ(2560deg);
        }

        nav:hover li:nth-child(9) {
            transform: rotateZ(360deg);
        }

        nav:hover li:nth-child(9) span {
            transform: rotateZ(3240deg);
        }

    </style>
</head>
<body>
<nav>
    <ul>
        <li><span>1</span></li>
        <li><span>2</span></li>
        <li><span>3</span></li>
        <li><span>4</span></li>
        <li><span>5</span></li>
        <li><span>6</span></li>
        <li><span>7</span></li>
        <li><span>8</span></li>
        <li><span>9</span></li>
    </ul>
</nav>
</body>
</html>
CATALOG