一款如何利用html5和css3动画排列人物头像的实例演示

初秋的风似一支七彩的画笔,走到哪里,哪里就披上秋的盛装,五光十色的鲜花和着七彩的蝴蝶,迎着丰收的景象。五彩缤纷的鲜花撒满大地,丰收的果园一派欣欣向荣的景象,金黄色的稻谷堆满仓,大地一片喜气洋洋。

  今天给大家分享一款html5和css3动画排列人物头像演示。这款实例页面初始时,只有中间的美女图,然后出现微笑图,紧接着出现小的人物图,慢慢的以动画的形式排列到页面中形成一个圆环。效果图如下:

  实现的代码。

  html代码:

XML/HTML Code复制内容到剪贴板
  1. <divclass='stage'>
  2. <divclass='image'>
  3. <imgsrc="https://pbs.twimg.com/profile_images/529224080751202304/UNLt5nUZ_400x400.jpeg">
  4. <divclass='smiley'>
  5. <svgwidth="30px"height="30px">
  6. <pathfill="#effedd"d="M15,0C6.7,0,0,6.7,0,15c0,8.3,6.7,15,15,15s15-6.7,15-15C30,6.7,23.3,0,15,0zM20.5,8c1.4,0,2.5,1.1,2.5,2.5c0,1.4-1.1,2.5-2.5,2.5S18,11.9,18,10.5C18,9.1,19.1,8,20.5,8zM10.5,8c1.4,0,2.5,1.1,2.5,2.5c0,1.4-1.1,2.5-2.5,2.5S8,11.9,8,10.5C8,9.1,9.1,8,10.5,8zM15,26c-5,0-9-4-9-9h3c0,3.3,2.7,6,6,6s6-2.7,6-6h3C24,22,20,26,15,26z"/></svg>
  7. </div>
  8. </div>
  9. <figureclass='avatar'>
  10. </figure>
  11. <figureclass='avatar'>
  12. </figure>
  13. <figureclass='avatar'>
  14. </figure>
  15. <figureclass='avatar'>
  16. </figure>
  17. <figureclass='avatar'>
  18. </figure>
  19. <figureclass='avatar'>
  20. </figure>
  21. <figureclass='avatar'>
  22. </figure>
  23. <figureclass='avatar'>
  24. </figure>
  25. </div>

  css3代码:

CSS Code复制内容到剪贴板
  1. .stage{
  2. position:absolute;
  3. top:0;
  4. rightright:0;
  5. bottombottom:0;
  6. left:0;
  7. margin:auto;
  8. height:460px;
  9. width:480px;
  10. }
  11. .avatar{
  12. position:absolute;
  13. top:0;
  14. rightright:0;
  15. bottombottom:0;
  16. left:0;
  17. margin:auto;
  18. height:64px;
  19. width:64px;
  20. background-repeat:no-repeat;
  21. background-size:cover;
  22. border-radius:50%;
  23. -webkit-transform-origin:center;
  24. -ms-transform-origin:center;
  25. transform-origin:center;
  26. }
  27. .avatar:before{
  28. content:'';
  29. position:absolute;
  30. top:-8%;
  31. rightright:-8%;
  32. height:17.06667px;
  33. width:17.06667px;
  34. background:#bec4bc;
  35. border-radius:50%;
  36. border:3pxsolidwhite;
  37. }
  38. .avatar:nth-of-type(1){
  39. -webkit-animation:ani12s0.1scubic-bezier(0.175,0.885,0.32,1.275)forwards;
  40. animation:ani12s0.1scubic-bezier(0.175,0.885,0.32,1.275)forwards;
  41. }
  42. @-webkit-keyframesani1{
  43. 0%,20%{
  44. -webkit-transform:rotate(45deg)translate(0)rotate(-45deg);
  45. transform:rotate(45deg)translate(0)rotate(-45deg);
  46. }
  47. 34%,100%{
  48. -webkit-transform:rotate(45deg)translate(208px)rotate(-45deg);
  49. transform:rotate(45deg)translate(208px)rotate(-45deg);
  50. }
  51. }
  52. @keyframesani1{
  53. 0%,20%{
  54. -webkit-transform:rotate(45deg)translate(0)rotate(-45deg);
  55. transform:rotate(45deg)translate(0)rotate(-45deg);
  56. }
  57. 34%,100%{
  58. -webkit-transform:rotate(45deg)translate(208px)rotate(-45deg);
  59. transform:rotate(45deg)translate(208px)rotate(-45deg);
  60. }
  61. }
  62. .avatar:nth-of-type(2){
  63. -webkit-animation:ani22s0.2scubic-bezier(0.175,0.885,0.32,1.275)forwards;
  64. animation:ani22s0.2scubic-bezier(0.175,0.885,0.32,1.275)forwards;
  65. }
  66. @-webkit-keyframesani2{
  67. 0%,20%{
  68. -webkit-transform:rotate(90deg)translate(0)rotate(-90deg);
  69. transform:rotate(90deg)translate(0)rotate(-90deg);
  70. }
  71. 34%,100%{
  72. -webkit-transform:rotate(90deg)translate(208px)rotate(-90deg);
  73. transform:rotate(90deg)translate(208px)rotate(-90deg);
  74. }
  75. }
  76. @keyframesani2{
  77. 0%,20%{
  78. -webkit-transform:rotate(90deg)translate(0)rotate(-90deg);
  79. transform:rotate(90deg)translate(0)rotate(-90deg);
  80. }
  81. 34%,100%{
  82. -webkit-transform:rotate(90deg)translate(208px)rotate(-90deg);
  83. transform:rotate(90deg)translate(208px)rotate(-90deg);
  84. }
  85. }
  86. .avatar:nth-of-type(3){
  87. -webkit-animation:ani32s0.3scubic-bezier(0.175,0.885,0.32,1.275)forwards;
  88. animation:ani32s0.3scubic-bezier(0.175,0.885,0.32,1.275)forwards;
  89. }
  90. @-webkit-keyframesani3{
  91. 0%,20%{
  92. -webkit-transform:rotate(135deg)translate(0)rotate(-135deg);
  93. transform:rotate(135deg)translate(0)rotate(-135deg);
  94. }
  95. 34%,100%{
  96. -webkit-transform:rotate(135deg)translate(208px)rotate(-135deg);
  97. transform:rotate(135deg)translate(208px)rotate(-135deg);
  98. }
  99. }
  100. @keyframesani3{
  101. 0%,20%{
  102. -webkit-transform:rotate(135deg)translate(0)rotate(-135deg);
  103. transform:rotate(135deg)translate(0)rotate(-135deg);
  104. }
  105. 34%,100%{
  106. -webkit-transform:rotate(135deg)translate(208px)rotate(-135deg);
  107. transform:rotate(135deg)translate(208px)rotate(-135deg);
  108. }
  109. }
  110. .avatar:nth-of-type(4){
  111. -webkit-animation:ani42s0.4scubic-bezier(0.175,0.885,0.32,1.275)forwards;
  112. animation:ani42s0.4scubic-bezier(0.175,0.885,0.32,1.275)forwards;
  113. }
  114. @-webkit-keyframesani4{
  115. 0%,20%{
  116. -webkit-transform:rotate(180deg)translate(0)rotate(-180deg);
  117. transform:rotate(180deg)translate(0)rotate(-180deg);
  118. }
  119. 34%,100%{
  120. -webkit-transform:rotate(180deg)translate(208px)rotate(-180deg);
  121. transform:rotate(180deg)translate(208px)rotate(-180deg);
  122. }
  123. }
  124. @keyframesani4{
  125. 0%,20%{
  126. -webkit-transform:rotate(180deg)translate(0)rotate(-180deg);
  127. transform:rotate(180deg)translate(0)rotate(-180deg);
  128. }
  129. 34%,100%{
  130. -webkit-transform:rotate(180deg)translate(208px)rotate(-180deg);
  131. transform:rotate(180deg)translate(208px)rotate(-180deg);
  132. }
  133. }
  134. .avatar:nth-of-type(5){
  135. -webkit-animation:ani52s0.5scubic-bezier(0.175,0.885,0.32,1.275)forwards;
  136. animation:ani52s0.5scubic-bezier(0.175,0.885,0.32,1.275)forwards;
  137. }
  138. @-webkit-keyframesani5{
  139. 0%,20%{
  140. -webkit-transform:rotate(225deg)translate(0)rotate(-225deg);
  141. transform:rotate(225deg)translate(0)rotate(-225deg);
  142. }
  143. 34%,100%{
  144. -webkit-transform:rotate(225deg)translate(208px)rotate(-225deg);
  145. transform:rotate(225deg)translate(208px)rotate(-225deg);
  146. }
  147. }
  148. @keyframesani5{
  149. 0%,20%{
  150. -webkit-transform:rotate(225deg)translate(0)rotate(-225deg);
  151. transform:rotate(225deg)translate(0)rotate(-225deg);
  152. }
  153. 34%,100%{
  154. -webkit-transform:rotate(225deg)translate(208px)rotate(-225deg);
  155. transform:rotate(225deg)translate(208px)rotate(-225deg);
  156. }
  157. }
  158. .avatar:nth-of-type(6){
  159. -webkit-animation:ani62s0.6scubic-bezier(0.175,0.885,0.32,1.275)forwards;
  160. animation:ani62s0.6scubic-bezier(0.175,0.885,0.32,1.275)forwards;
  161. }
  162. @-webkit-keyframesani6{
  163. 0%,20%{
  164. -webkit-transform:rotate(270deg)translate(0)rotate(-270deg);
  165. transform:rotate(270deg)translate(0)rotate(-270deg);
  166. }
  167. 34%,100%{
  168. -webkit-transform:rotate(270deg)translate(208px)rotate(-270deg);
  169. transform:rotate(270deg)translate(208px)rotate(-270deg);
  170. }
  171. }
  172. @keyframesani6{
  173. 0%,20%{
  174. -webkit-transform:rotate(270deg)translate(0)rotate(-270deg);
  175. transform:rotate(270deg)translate(0)rotate(-270deg);
  176. }
  177. 34%,100%{
  178. -webkit-transform:rotate(270deg)translate(208px)rotate(-270deg);
  179. transform:rotate(270deg)translate(208px)rotate(-270deg);
  180. }
  181. }
  182. .avatar:nth-of-type(7){
  183. -webkit-animation:ani72s0.7scubic-bezier(0.175,0.885,0.32,1.275)forwards;
  184. animation:ani72s0.7scubic-bezier(0.175,0.885,0.32,1.275)forwards;
  185. }
  186. @-webkit-keyframesani7{
  187. 0%,20%{
  188. -webkit-transform:rotate(315deg)translate(0)rotate(-315deg);
  189. transform:rotate(315deg)translate(0)rotate(-315deg);
  190. }
  191. 34%,100%{
  192. -webkit-transform:rotate(315deg)translate(208px)rotate(-315deg);
  193. transform:rotate(315deg)translate(208px)rotate(-315deg);
  194. }
  195. }
  196. @keyframesani7{
  197. 0%,20%{
  198. -webkit-transform:rotate(315deg)translate(0)rotate(-315deg);
  199. transform:rotate(315deg)translate(0)rotate(-315deg);
  200. }
  201. 34%,100%{
  202. -webkit-transform:rotate(315deg)translate(208px)rotate(-315deg);
  203. transform:rotate(315deg)translate(208px)rotate(-315deg);
  204. }
  205. }
  206. .avatar:nth-of-type(8){
  207. -webkit-animation:ani82s0.8scubic-bezier(0.175,0.885,0.32,1.275)forwards;
  208. animation:ani82s0.8scubic-bezier(0.175,0.885,0.32,1.275)forwards;
  209. }
  210. @-webkit-keyframesani8{
  211. 0%,20%{
  212. -webkit-transform:rotate(360deg)translate(0)rotate(-360deg);
  213. transform:rotate(360deg)translate(0)rotate(-360deg);
  214. }
  215. 34%,100%{
  216. -webkit-transform:rotate(360deg)translate(208px)rotate(-360deg);
  217. transform:rotate(360deg)translate(208px)rotate(-360deg);
  218. }
  219. }
  220. @keyframesani8{
  221. 0%,20%{
  222. -webkit-transform:rotate(360deg)translate(0)rotate(-360deg);
  223. transform:rotate(360deg)translate(0)rotate(-360deg);
  224. }
  225. 34%,100%{
  226. -webkit-transform:rotate(360deg)translate(208px)rotate(-360deg);
  227. transform:rotate(360deg)translate(208px)rotate(-360deg);
  228. }
  229. }
  230. .avatar:nth-of-type(4):before,.avatar:nth-of-type(2):before{
  231. -webkit-animation:bounce3s1.8scubic-bezier(0.175,0.885,0.32,1.275)forwards,colorchange1s1.8scubic-bezier(0.175,0.885,0.32,1.275)forwards;
  232. animation:bounce3s1.8scubic-bezier(0.175,0.885,0.32,1.275)forwards,colorchange1s1.8scubic-bezier(0.175,0.885,0.32,1.275)forwards;
  233. }
  234. .avatar:nth-of-type(7):before{
  235. -webkit-animation:bounce3s2scubic-bezier(0.175,0.885,0.32,1.275)forwards,colorchange1s2scubic-bezier(0.175,0.885,0.32,1.275)forwards;
  236. animation:bounce3s2scubic-bezier(0.175,0.885,0.32,1.275)forwards,colorchange1s2scubic-bezier(0.175,0.885,0.32,1.275)forwards;
  237. }
  238. .avatar:nth-of-type(3):before{
  239. -webkit-animation:bounce3s2.8scubic-bezier(0.175,0.885,0.32,1.275)forwards,colorchange1s2.8scubic-bezier(0.175,0.885,0.32,1.275)forwards;
  240. animation:bounce3s2.8scubic-bezier(0.175,0.885,0.32,1.275)forwards,colorchange1s2.8scubic-bezier(0.175,0.885,0.32,1.275)forwards;
  241. }
  242. .avatar:nth-of-type(1):before{
  243. -webkit-animation:bounce3s3scubic-bezier(0.175,0.885,0.32,1.275)forwards,colorchange1s3scubic-bezier(0.175,0.885,0.32,1.275)forwards;
  244. animation:bounce3s3scubic-bezier(0.175,0.885,0.32,1.275)forwards,colorchange1s3scubic-bezier(0.175,0.885,0.32,1.275)forwards;
  245. }
  246. .avatar:nth-of-type(6):before{
  247. -webkit-animation:bounce3s3.2scubic-bezier(0.175,0.885,0.32,1.275)forwards,colorchange1s3.2scubic-bezier(0.175,0.885,0.32,1.275)forwards;
  248. animation:bounce3s3.2scubic-bezier(0.175,0.885,0.32,1.275)forwards,colorchange1s3.2scubic-bezier(0.175,0.885,0.32,1.275)forwards;
  249. }
  250. .avatar:nth-of-type(5):before{
  251. -webkit-animation:bounce3s3.8scubic-bezier(0.175,0.885,0.32,1.275)forwards,colorchange1s3.8scubic-bezier(0.175,0.885,0.32,1.275)forwards;
  252. animation:bounce3s3.8scubic-bezier(0.175,0.885,0.32,1.275)forwards,colorchange1s3.8scubic-bezier(0.175,0.885,0.32,1.275)forwards;
  253. }
  254. .avatar:nth-of-type(8):before{
  255. -webkit-animation:bounce3s4scubic-bezier(0.175,0.885,0.32,1.275)forwards,colorchange1s4scubic-bezier(0.175,0.885,0.32,1.275)forwards;
  256. animation:bounce3s4scubic-bezier(0.175,0.885,0.32,1.275)forwards,colorchange1s4scubic-bezier(0.175,0.885,0.32,1.275)forwards;
  257. }
  258. .image{
  259. position:absolute;
  260. top:0;
  261. rightright:0;
  262. bottombottom:0;
  263. left:0;
  264. margin:auto;
  265. height:220px;
  266. width:220px;
  267. }
  268. .imageimg{
  269. position:relative;
  270. height:220px;
  271. width:220px;
  272. border-radius:50%;
  273. z-index:1;
  274. }
  275. .image:before{
  276. position:absolute;
  277. top:0;
  278. rightright:0;
  279. bottombottom:0;
  280. left:0;
  281. margin:auto;
  282. content:'';
  283. height:100%;
  284. width:100%;
  285. background:#f9fff7;
  286. border:3pxsolid#e7f5d1;
  287. border-radius:50%;
  288. -webkit-animation:pulse1s1.4sease-out;
  289. animation:pulse1s1.4sease-out;
  290. -webkit-animation-iteration-count:3;
  291. animation-iteration-count:3;
  292. }
  293. .image.smiley{
  294. position:absolute;
  295. top:-8px;
  296. rightright:-8px;
  297. height:64px;
  298. width:64px;
  299. background:#b5e763;
  300. border-radius:50%;
  301. border:5pxsolidwhite;
  302. -webkit-animation:bounce5scubic-bezier(0.175,0.885,0.32,1.275)forwards;
  303. animation:bounce5scubic-bezier(0.175,0.885,0.32,1.275)forwards;
  304. -webkit-transform-origin:center;
  305. -ms-transform-origin:center;
  306. transform-origin:center;
  307. z-index:1;
  308. }
  309. .image.smileysvg{
  310. position:absolute;
  311. top:0;
  312. rightright:0;
  313. bottombottom:0;
  314. left:0;
  315. margin:auto;
  316. -webkit-animation:bounce5s0.075scubic-bezier(0.175,0.885,0.32,1.275)forwards;
  317. animation:bounce5s0.075scubic-bezier(0.175,0.885,0.32,1.275)forwards;
  318. }
  319. @-webkit-keyframesbounce{
  320. 0%{
  321. -webkit-transform:scale(0);
  322. transform:scale(0);
  323. }
  324. 5%{
  325. -webkit-transform:scale(1.5);
  326. transform:scale(1.5);
  327. }
  328. 10%,100%{
  329. -webkit-transform:scale(1);
  330. transform:scale(1);
  331. }
  332. }
  333. @keyframesbounce{
  334. 0%{
  335. -webkit-transform:scale(0);
  336. transform:scale(0);
  337. }
  338. 5%{
  339. -webkit-transform:scale(1.5);
  340. transform:scale(1.5);
  341. }
  342. 10%,100%{
  343. -webkit-transform:scale(1);
  344. transform:scale(1);
  345. }
  346. }
  347. @-webkit-keyframespulse{
  348. 0%{
  349. -webkit-transform:scale(0.1,0.1);
  350. transform:scale(0.1,0.1);
  351. opacity:0.0;
  352. }
  353. 50%{
  354. opacity:1.0;
  355. }
  356. 100%{
  357. -webkit-transform:scale(3);
  358. transform:scale(3);
  359. opacity:0.0;
  360. }
  361. }
  362. @keyframespulse{
  363. 0%{
  364. -webkit-transform:scale(0.1,0.1);
  365. transform:scale(0.1,0.1);
  366. opacity:0.0;
  367. }
  368. 50%{
  369. opacity:1.0;
  370. }
  371. 100%{
  372. -webkit-transform:scale(3);
  373. transform:scale(3);
  374. opacity:0.0;
  375. }
  376. }
  377. @-webkit-keyframescolorchange{
  378. 0%{
  379. background:#bec4bc;
  380. }
  381. 100%{
  382. background:#b5e763;
  383. }
  384. }
  385. @keyframescolorchange{
  386. 0%{
  387. background:#bec4bc;
  388. }
  389. 100%{
  390. background:#b5e763;
  391. }
  392. }
  393. .avatar:nth-of-type(1){
  394. background-image:url("128.jpg");
  395. }
  396. .avatar:nth-of-type(2){
  397. background-image:url("rasagy.jpg");
  398. }
  399. .avatar:nth-of-type(3){
  400. background-image:url("geeftvorm.jpg");
  401. }
  402. .avatar:nth-of-type(4){
  403. background-image:url("VinThomas.jpg");
  404. }
  405. .avatar:nth-of-type(5){
  406. background-image:url("ladylexy.jpg");
  407. }
  408. .avatar:nth-of-type(6){
  409. background-image:url("claudioguglieri.jpg");
  410. }
  411. .avatar:nth-of-type(7){
  412. background-image:url("jina.jpg");
  413. }
  414. .avatar:nth-of-type(8){
  415. background-image:url("peterme.jpg");
  416. }

  好了以上就是今天介绍的html5和css3动画排列人物头像代码演示,谢谢阅读,希望能帮到大家,请继续关注,我们会努力分享更多优秀的文章。

标签: