# css3小鸡从鸡蛋破壳而出动画特效

# 快速导航

# 示例效果

# 示例代码

<template>
    <div>
            <div class="eggWrapper">
                <div class="chickHead">
                    <div class="eyeDiv"></div>
                    <div class="eyeDiv"></div>
                    <div class="beakDiv"></div>
                </div>
                <div class="eggDiv"></div>
                <div class="eggTop"></div>
            </div>
            <div class="eggWrapper">
                <div class="chickHead">
                <div class="eyeDiv"></div>
                <div class="eyeDiv"></div>
                <div class="beakDiv"></div>
            </div>
            <div class="eggDiv"></div>
            <div class="eggTop"></div>
        </div>
    <div class="eggWrapper">
    <div class="chickHead">
        <div class="eyeDiv"></div>
        <div class="eyeDiv"></div>
        <div class="beakDiv"></div>
    </div>
    <div class="eggDiv"></div>
    <div class="eggTop"></div>
    </div>
    <div class="eggWrapper">
        <div class="chickHead">
            <div class="eyeDiv"></div>
            <div class="eyeDiv"></div>
            <div class="beakDiv"></div>
        </div>
        <div class="eggDiv"></div>
        <div class="eggTop"></div>
    </div>
    <div class="eggWrapper">
        <div class="chickHead">
            <div class="eyeDiv"></div>
            <div class="eyeDiv"></div>
            <div class="beakDiv"></div>
        </div>
        <div class="eggDiv"></div>
        <div class="eggTop"></div>
    </div>  
  </div>
</template>
<style>
.eggWrapper {
  position: relative;
  display: inline-flex;
  margin-left: 1em;
  margin-top: 20vh;
  width: 10em;
  height: 12em;
}
.eggDiv,
.eggTop {
  position: absolute;
  width: 10em;
  height: 10em;
  border-radius: 80% 20% 55% 50% / 55% 20% 80% 50%;
  -webkit-transform: rotate(-45deg);
          transform: rotate(-45deg);
  background-color: #ffffee;
  box-shadow: inset 1em 1em 2em rgba(0, 0, 0, 0.3),
    inset 0.2em 0.2em 1em #ffff55;
  -webkit-clip-path: polygon(
    -35.87% 83.08%,
    244% 155.05%,
    108.11% 49.6%,
    76.11% 57.69%,
    71.33% 37.01%,
    44.85% 22.33%,
    32.41% -13.39%
  );
          clip-path: polygon(
    -35.87% 83.08%,
    244% 155.05%,
    108.11% 49.6%,
    76.11% 57.69%,
    71.33% 37.01%,
    44.85% 22.33%,
    32.41% -13.39%
  );
  margin-top: 2em;
  transition: -webkit-transform 300ms cubic-bezier(0.5, -0.5, 0.5, 1.5) 0s;
  transition: transform 300ms cubic-bezier(0.5, -0.5, 0.5, 1.5) 0s;
  transition: transform 300ms cubic-bezier(0.5, -0.5, 0.5, 1.5) 0s, -webkit-transform 300ms cubic-bezier(0.5, -0.5, 0.5, 1.5) 0s;
}
.eggTop {
  -webkit-transform: rotate(-45deg) translateY(0.1em) translateX(-0.1em) scale(1.016);
          transform: rotate(-45deg) translateY(0.1em) translateX(-0.1em) scale(1.016);
  -webkit-clip-path: polygon(
    27.84% -22.62%,
    123.57% -5.52%,
    108.11% 49.6%,
    76.11% 57.69%,
    71.33% 37.01%,
    44.85% 22.33%,
    32.41% -13.39%
  );
          clip-path: polygon(
    27.84% -22.62%,
    123.57% -5.52%,
    108.11% 49.6%,
    76.11% 57.69%,
    71.33% 37.01%,
    44.85% 22.33%,
    32.41% -13.39%
  );
}
.chickHead {
  position: absolute;
  top: 1em;
  width: 7em;
  height: 7em;
  margin-left: 1.5em;
  margin-top: 2em;
  background-color: #ffff55;
  box-shadow: inset 1em 1em 2em rgba(0, 0, 0, 0.3),
    inset 0 2em 1em rgba(0, 0, 0, 0.3);
  border-radius: 100%;
  transition: -webkit-transform 300ms ease-in-out 0s;
  transition: transform 300ms ease-in-out 0s;
  transition: transform 300ms ease-in-out 0s, -webkit-transform 300ms ease-in-out 0s;
}
.chickHead .eyeDiv {
  position: relative;
  width: 1em;
  height: 1em;
  float: left;
  border-radius: 100%;
  margin: 0.3em;
  margin-top: 3em;
  background-color: #666666;
  box-shadow: inset 0.3em -0.3em 0.5em rgba(0, 0, 0, 0.8);
  -webkit-animation-name: blinkAnim;
          animation-name: blinkAnim;
  -webkit-animation-duration: 3s;
          animation-duration: 3s;
  -webkit-animation-timing-function: ease-in-out;
          animation-timing-function: ease-in-out;
  -webkit-animation-iteration-count: infinite;
          animation-iteration-count: infinite;
}
.chickHead .eyeDiv:nth-of-type(2) {
  float: right;
  -webkit-animation-delay: 20ms;
          animation-delay: 20ms;
}
.chickHead .beakDiv {
  position: absolute;
  width: 1em;
  height: 1em;
  margin-top: 3.2em;
  margin-left: 3em;
  border-radius: 80% 20% 55% 50% / 55% 20% 80% 50%;
  -webkit-transform: rotate(135deg);
          transform: rotate(135deg);
  background-color: #ff5800;
  border: 0.1em solid #ffff55;
  box-shadow: inset -0.3em 0.3em 0.5em rgba(0, 0, 0, 0.3);
}
.eggWrapper:hover .eggTop {
  /*margin-top: -1vw;*/
  -webkit-transform: translateY(-3em) rotate(-45deg);
          transform: translateY(-3em) rotate(-45deg);
}
.eggWrapper:hover .chickHead {
  -webkit-transform: translateY(-3em);
          transform: translateY(-3em);
}
@-webkit-keyframes blinkAnim {
  0% {
    -webkit-transform: scaleY(1);
            transform: scaleY(1);
  }
  5% {
    -webkit-transform: scaleY(0.1);
            transform: scaleY(0.1);
  }
  10% {
    -webkit-transform: scaleY(0.1);
            transform: scaleY(0.1);
  }
  15% {
    -webkit-transform: scaleY(1);
            transform: scaleY(1);
  }
  100% {
    -webkit-transform: scaleY(1);
            transform: scaleY(1);
  }
}
@keyframes blinkAnim {
  0% {
    -webkit-transform: scaleY(1);
            transform: scaleY(1);
  }
  5% {
    -webkit-transform: scaleY(0.1);
            transform: scaleY(0.1);
  }
  10% {
    -webkit-transform: scaleY(0.1);
            transform: scaleY(0.1);
  }
  15% {
    -webkit-transform: scaleY(1);
            transform: scaleY(1);
  }
  100% {
    -webkit-transform: scaleY(1);
            transform: scaleY(1);
  }
}

</style>
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
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
白色

关注公众号

一个走心,有温度的号,同千万同行一起交流学习

加作者微信

扫二维码 备注 【加群】

扫码易购

福利推荐