经验首页 前端设计 程序设计 Java相关 移动开发 数据库/运维 软件/图像 大数据/云计算 其他经验
当前位置:技术经验 » HTML/CSS » CSS3 » 查看文章
css3实现的天气图标动画效果_css3_CSS
来源:jb51  时间:2021/4/12 9:35:28  对本文有异议

实现效果

实现代码

html

  1. <div class="wrapper">
  2. <div class="sun"></div>
  3. <div class="cloud">
  4. <div class="cloud1">
  5. <ul>
  6. <li></li>
  7. <li></li>
  8. <li></li>
  9. <li></li>
  10. </ul>
  11. </div>
  12. <div class="cloud1 c_shadow">
  13. <ul>
  14. <li></li>
  15. <li></li>
  16. <li></li>
  17. <li></li>
  18. </ul>
  19. </div>
  20. </div>
  21. <div class="cloud_s">
  22. <div class="cloud1">
  23. <ul>
  24. <li></li>
  25. <li></li>
  26. <li></li>
  27. <li></li>
  28. </ul>
  29. </div>
  30. <div class="cloud1 c_shadow">
  31. <ul>
  32. <li></li>
  33. <li></li>
  34. <li></li>
  35. <li></li>
  36. </ul>
  37. </div>
  38. </div>
  39. <div class="cloud_vs">
  40. <div class="cloud1">
  41. <ul>
  42. <li></li>
  43. <li></li>
  44. <li></li>
  45. <li></li>
  46. </ul>
  47. </div>
  48. <div class="cloud1 c_shadow">
  49. <ul>
  50. <li></li>
  51. <li></li>
  52. <li></li>
  53. <li></li>
  54. </ul>
  55. </div>
  56. </div>
  57. <div class="haze"></div>
  58. <div class="haze_stripe"></div>
  59. <div class="haze_stripe"></div>
  60. <div class="haze_stripe"></div>
  61. <div class="thunder"></div>
  62. <div class="rain">
  63. <ul>
  64. <li></li>
  65. <li></li>
  66. <li></li>
  67. </ul>
  68. </div>
  69. <div class="sleet">
  70. <ul>
  71. <li></li>
  72. <li></li>
  73. <li></li>
  74. </ul>
  75. </div>
  76. <div class="text">
  77. <ul>
  78. <li>Mostly Sunny</li>
  79. <li>Partly Sunny</li>
  80. <li>Partly Cloudy</li>
  81. <li>Mostly Cloudy</li>
  82. <li>Cloudy</li>
  83. <li>Hazy</li>
  84. <li>Thunderstorm</li>
  85. <li>Rain</li>
  86. <li>Sleet</li>
  87. </ul>
  88. </div>
  89. </div>

css3

  1. @import url(https://fonts.googleapis.com/css?family=Raleway+Dots);
  2.  
  3. body{
  4. margin: 0;
  5. padding: 0;
  6. background: #33495f;
  7. }
  8.  
  9. .wrapper{
  10. width: 150px;
  11. height: 150px;
  12. position: absolute;
  13. top: calc(50% - 75px);
  14. left: calc(50% - 75px);
  15. }
  16.  
  17. .sun{
  18. position: absolute;
  19. bottom: 0px;
  20. right: 0px;
  21. width: 85px;
  22. height: 85px;
  23. background: #f9db62;
  24. border-radius: 360px;
  25. opacity: 1;
  26. animation: sun 10s 0s linear infinite;
  27. }
  28.  
  29. .cloud{
  30. position: absolute;
  31. bottom: 12px;
  32. left: 8px;
  33. z-index: 2;
  34. opacity: 0;
  35. animation: cloud 10s 0s linear infinite;
  36. }
  37.  
  38. .cloud .cloud1:not(.c_shadow) ul li{
  39. animation: cloudi 10s 0.1s linear infinite;
  40. }
  41.  
  42. .cloud .cloud1:not(.c_shadow):before{
  43. animation: cloudi 10s 0s linear infinite;
  44. }
  45.  
  46. .cloud_s{
  47. position: absolute;
  48. bottom: 70px;
  49. left: 150px;
  50. transform: scale(0.7,0.7) matrix(-1, 0, 0, 1, 0, 0);
  51. z-index: 1;
  52. opacity: 0;
  53. animation: cloud_s 10s 0s linear infinite;
  54. }
  55.  
  56. .cloud_s .c_shadow{
  57. transform: scale(1.02,1.02);
  58. }
  59.  
  60. .cloud_vs{
  61. position: absolute;
  62. bottom: 90px;
  63. left: 30px;
  64. transform: scale(0.5,0.5);
  65. z-index: 0;
  66. opacity: 0;
  67. animation: cloud_vs 10s 0s linear infinite;
  68. }
  69.  
  70. .c_shadow{
  71. z-index: 4 !important;
  72. left: -5px;
  73. bottom: -3px !important;
  74. }
  75.  
  76. .c_shadow:before{
  77. background: #33495f !important;
  78. }
  79.  
  80. .c_shadow ul li{
  81. width: 60px !important;
  82. height: 60px !important;
  83. background: #33495f !important;
  84. float: left;
  85. position: absolute;
  86. bottom: -2px !important;
  87. border-radius: 360px;
  88. }
  89.  
  90. .c_shadow ul li:nth-child(2){
  91. width: 80px !important;
  92. height: 80px !important;
  93. background: #33495f !important;
  94. float: left;
  95. border-radius: 360px;
  96. position: absolute;
  97. bottom: 16px !important;
  98. left: 25px !important;
  99. }
  100.  
  101. .c_shadow ul li:nth-child(3){
  102. width: 70px !important;
  103. height: 70px !important;
  104. background: #33495f !important;
  105. float: left;
  106. border-radius: 360px;
  107. position: absolute;
  108. bottom: 6px !important;
  109. left: 60px !important;
  110. }
  111.  
  112. .c_shadow ul li:last-child{
  113. width: 60px !important;
  114. height: 60px !important;
  115. background: #33495f !important;
  116. float: left;
  117. border-radius: 360px;
  118. position: absolute;
  119. bottom: 0px;
  120. left: 90px;
  121. }
  122.  
  123.  
  124. .cloud1{
  125. position: absolute;
  126. bottom: 0px;
  127. z-index: 5;
  128. }
  129.  
  130. .cloud1:before{
  131. content: '';
  132. position: absolute;
  133. bottom: 0px;
  134. left: 28px;
  135. width: 90px;
  136. height: 20px;
  137. background: #fff;
  138. }
  139.  
  140. .cloud1 ul{
  141. list-style: none;
  142. margin: 0;
  143. padding: 0;
  144. }
  145.  
  146. .cloud1 ul li{
  147. width: 50px;
  148. height: 50px;
  149. background: #fff;
  150. float: left;
  151. border-radius: 360px;
  152. }
  153.  
  154. .cloud1 ul li:nth-child(2){
  155. width: 70px;
  156. height: 70px;
  157. background: #fff;
  158. float: left;
  159. border-radius: 360px;
  160. position: absolute;
  161. bottom: 18px;
  162. left: 25px;
  163. }
  164.  
  165. .cloud1 ul li:nth-child(3){
  166. width: 60px;
  167. height: 60px;
  168. background: #fff;
  169. float: left;
  170. border-radius: 360px;
  171. position: absolute;
  172. bottom: 8px;
  173. left: 60px;
  174. }
  175.  
  176. .cloud1 ul li:last-child{
  177. width: 50px;
  178. height: 50px;
  179. background: #fff;
  180. float: left;
  181. border-radius: 360px;
  182. position: absolute;
  183. bottom: 0px;
  184. left: 90px;
  185. }
  186.  
  187. .haze{
  188. background: #33495f;
  189. position: absolute;
  190. bottom: 50px;
  191. left: 0px;
  192. width: 200px;
  193. height: 45px;
  194. z-index: 6;
  195. opacity: 0;
  196. animation: haze 10s 0s linear infinite;
  197. }
  198.  
  199. .haze_stripe{
  200. background: #a3b5c7;
  201. position: absolute;
  202. bottom: 75px;
  203. left: 20px;
  204. width: 115px;
  205. height: 10px;
  206. z-index: 17;
  207. opacity: 0;
  208. border-radius: 360px;
  209. animation: haze_stripe 10s 0.1s linear infinite;
  210. }
  211.  
  212. .haze_stripe:nth-child(6){
  213. bottom: 55px;
  214. animation: haze_stripe 10s 0.2s linear infinite;
  215. }
  216. .haze_stripe:last-child{
  217. bottom: 35px;
  218. animation: haze_stripe 10s 0.4s linear infinite;
  219. }
  220.  
  221. .thunder{
  222. position: absolute;
  223. bottom: 100px;
  224. left: 65px;
  225. width: 12px;
  226. height: 12px;
  227. background: #f9db62;
  228. transform: skew(-25deg);
  229. opacity: 0;
  230. animation: thunder 10s 0s linear infinite;
  231. }
  232.  
  233. .thunder:before{
  234. content: '';
  235. position: absolute;
  236. top: 11px;
  237. left: 0px;
  238. width: 25px;
  239. height: 8px;
  240. background: #f9db62;
  241. }
  242.  
  243. .thunder:after{
  244. content: '';
  245. position: absolute;
  246. width: 0;
  247. height: 0;
  248. top: 18px;
  249. right: -14px;
  250. border-left: 5px solid transparent;
  251. border-right: 5px solid transparent;
  252. border-top: 20px solid #f9db62;
  253. transform: skew(5deg);
  254. }
  255.  
  256. .rain{
  257. position: absolute;
  258. bottom: 0px;
  259. left: 25px;
  260. }
  261.  
  262. .rain ul{
  263. list-style: none;
  264. margin: 0;
  265. padding: 0px;
  266. }
  267.  
  268. .rain ul li{
  269. float: left;
  270. position: absolute;
  271. bottom: 50px;
  272. left: 50px;
  273. margin-left: 20px;
  274. background: #6ab9e9;
  275. height: 40px;
  276. width: 10px;
  277. border-radius: 360px;
  278. transform: rotate(35deg);
  279. opacity: 0;
  280. }
  281.  
  282. .rain ul li:first-child{
  283. animation: raini 10s 0s linear infinite;
  284. }
  285.  
  286. .rain ul li:nth-child(2){
  287. animation: rainii 10s 0.2s linear infinite;
  288. }
  289.  
  290. .rain ul li:last-child{
  291. animation: rainiii 10s 0.4s linear infinite;
  292. }
  293.  
  294. .sleet{
  295. position: absolute;
  296. bottom: 0px;
  297. left: 25px;
  298. }
  299.  
  300. .sleet ul{
  301. list-style: none;
  302. margin: 0;
  303. padding: 0px;
  304. }
  305.  
  306. .sleet ul li{
  307. float: left;
  308. position: absolute;
  309. bottom: 50px;
  310. left: 50px;
  311. margin-left: 20px;
  312. background: #fff;
  313. height: 40px;
  314. width: 10px;
  315. border-radius: 360px;
  316. transform: rotate(35deg);
  317. opacity: 0;
  318. }
  319.  
  320. .sleet ul li:first-child{
  321. animation: raini 10s 1.0s linear infinite;
  322. }
  323.  
  324. .sleet ul li:nth-child(2){
  325. animation: rainii 10s 1.4s linear infinite;
  326. }
  327.  
  328. .sleet ul li:last-child{
  329. animation: rainiii 10s 1.6s linear infinite;
  330. }
  331.  
  332. .text{
  333. position: absolute;
  334. bottom: 0px;
  335. }
  336.  
  337. .text ul{
  338. list-style: none;
  339. margin: 0;
  340. padding: 0;
  341. }
  342.  
  343. .text ul li{
  344. position: absolute;
  345. bottom: -50px;
  346. width: 150px;
  347. color: #fff;
  348. font-family: 'Raleway Dots', cursive;
  349. font-weight: 100;
  350. font-size: 20px;
  351. text-align: center;
  352. opacity: 0;
  353. }
  354.  
  355. .text ul li:first-child{
  356. animation: fade_in 10.0s 0s linear infinite;
  357. }
  358.  
  359. .text ul li:nth-child(2){
  360. animation: fade_in 10.0s 1.6s linear infinite;
  361. }
  362.  
  363. .text ul li:nth-child(3){
  364. animation: fade_in 10.0s 2.4s linear infinite;
  365. }
  366.  
  367. .text ul li:nth-child(4){
  368. animation: fade_in 10.0s 3.4s linear infinite;
  369. }
  370.  
  371. .text ul li:nth-child(5){
  372. animation: fade_in 10.0s 4.0s linear infinite;
  373. }
  374.  
  375. .text ul li:nth-child(6){
  376. animation: fade_in 10.0s 5.4s linear infinite;
  377. }
  378.  
  379. .text ul li:nth-child(7){
  380. animation: fade_in 10.0s 6.4s linear infinite;
  381. }
  382.  
  383. .text ul li:nth-child(8){
  384. animation: fade_in 10.0s 7.2s linear infinite;
  385. }
  386.  
  387. .text ul li:nth-child(9){
  388. animation: fade_in 10.0s 8.2s linear infinite;
  389. }
  390.  
  391. @keyframes sun{
  392. 0%{
  393. opacity: 1;
  394. bottom: 35px;
  395. right: 35px;
  396. }
  397. 4%{
  398. bottom: 80px;
  399. right: 80px;
  400. }
  401. 4.5%{
  402. bottom: 75px;
  403. right: 75px;
  404. opacity: 1;
  405. }
  406. 40%{
  407. opacity: 1;
  408. }
  409. 41%{
  410. bottom: 75px;
  411. right: 75px;
  412. opacity: 0;
  413. }
  414. 100%{
  415. opacity: 0;
  416. bottom: 0px;
  417. right: 0px;
  418. }
  419. }
  420.  
  421. @keyframes cloud{
  422. 0%{
  423. transform: scale(0.8);
  424. left: 120px;
  425. bottom: 35px;
  426. opacity: 0;
  427. }
  428. 2%{
  429. opacity: 1;
  430. }
  431. 3.5%{
  432. bottom: 35px;
  433. left: 10px;
  434. opacity: 1;
  435. }
  436. 16%{
  437. transform: scale(0.8);
  438. }
  439. 18%{
  440. transform: scale(0.95);
  441. }
  442. 19%{
  443. transform: scale(0.9);
  444. }
  445. 48%{
  446. opacity: 1;
  447. bottom: 35px;
  448. }
  449. 50%{
  450. bottom: 70px;
  451. }
  452. 64%{
  453. }
  454. 96%{
  455. opacity: 1;
  456. }
  457. 100%{
  458. opacity: 0;
  459. bottom: 70px;
  460. left: 10px;
  461. }
  462. }
  463.  
  464. @keyframes cloud_s{
  465. 0%{
  466. transform: scale(0.6);
  467. opacity: 0;
  468. bottom: 40px;
  469. left: 18px;
  470. }
  471. 23%{
  472. opacity: 0;
  473. }
  474. 24%{
  475. opacity: 1;
  476. bottom: 40px;
  477. left: 30px;
  478. }
  479. 28%{
  480. opacity: 1;
  481. bottom: 85px;
  482. left: 60px;
  483. }
  484. 32%{
  485. transform: scale(0.6);
  486. }
  487. 34%{
  488. transform: scale(0.75);
  489. }
  490. 35%{
  491. transform: scale(0.7);
  492. }
  493. 48%{
  494. opacity: 1;
  495. }
  496. 49%{
  497. opacity: 0;
  498. }
  499. 100%{
  500. transform: scale(0.7);
  501. opacity: 0;
  502. bottom: 85px;
  503. left: 60px;
  504. }
  505. }
  506.  
  507. @keyframes cloud_vs{
  508. 0%{
  509. opacity: 0;
  510. bottom: 85px;
  511. left: 60px;
  512. }
  513. 39%{
  514. opacity: 0;
  515. }
  516. 40%{
  517. opacity: 1;
  518. bottom: 85px;
  519. left: 60px;
  520. }
  521. 42%{
  522. bottom: 125px;
  523. left: 10px;
  524. }
  525. 43%{
  526. bottom: 120px;
  527. left: 15px;
  528. }
  529. 48%{
  530. opacity: 1;
  531. }
  532. 49%{
  533. opacity: 0;
  534. }
  535. 100%{
  536. opacity: 0;
  537. bottom: 120px;
  538. left: 15px;
  539. }
  540. }
  541.  
  542. @keyframes haze{
  543. 0%{
  544. opacity: 0;
  545. }
  546. 48%{
  547. height: 0px;
  548. opacity: 0;
  549. }
  550. 49%{
  551. height: 45px;
  552. opacity: 1;
  553. }
  554. 57%{
  555. opacity:1;
  556. height: 45px;
  557. }
  558. 58%{
  559. opacity: 0;
  560. height: 0px;
  561. }
  562. }
  563.  
  564. @keyframes haze_stripe{
  565. 0%{
  566. opacity: 0;
  567. }
  568. 48%{
  569. opacity: 0;
  570. }
  571. 49%{
  572. opacity: 1;
  573. }
  574. 56%{
  575. opacity:1;
  576. }
  577. 57%{
  578. opacity: 0;
  579. }
  580. }
  581.  
  582. @keyframes cloudi{
  583. 0%{
  584. background: #fff;
  585. }
  586. 56%{
  587. background: #fff;
  588. }
  589. 57%{
  590. background: #92a4b6;
  591. }
  592. 100%{
  593. background: #92a4b6;
  594. }
  595. }
  596.  
  597. @keyframes thunder{
  598. 0%{
  599. opacity: 0;
  600. bottom: 100px;
  601. left: 65px;
  602. }
  603. 62%{
  604. opacity: 0;
  605. bottom: 100px;
  606. left: 65px;
  607. }
  608. 64%{
  609. opacity: 1;
  610. bottom: 50px;
  611. left: 60px;
  612. }
  613. 65%{
  614. opacity: 1;
  615. bottom: 55px;
  616. left: 61px;
  617. }
  618. 72%{
  619. opacity: 1;
  620. bottom: 55px;
  621. left: 61px;
  622. }
  623. 73%{
  624. opacity: 0;
  625. }
  626. 100%{
  627. opacity: 0;
  628. bottom: 55px;
  629. }
  630. }
  631.  
  632. @keyframes raini{
  633. 0%{
  634. opacity: 0;
  635. bottom: 100px;
  636. left: 60px;
  637. }
  638. 72%{
  639. opacity: 0;
  640. bottom: 100px;
  641. left: 60px;
  642. }
  643. 73%{
  644. opacity: 1;
  645. bottom: 15px;
  646. left: 50px;
  647. }
  648. 74%{
  649. opacity: 1;
  650. bottom: 25px;
  651. left: 52px;
  652. }
  653. 80%{
  654. opacity: 1;
  655. bottom: 25px;
  656. left: 52px;
  657. }
  658. 81%{
  659. opacity: 0;
  660. bottom: -15px;
  661. left: 6px;
  662. }
  663. 100%{
  664. opacity: 0;
  665. bottom: 20px;
  666. }
  667. }
  668.  
  669. @keyframes rainii{
  670. 0%{
  671. opacity: 0;
  672. bottom: 100px;
  673. left: 30px;
  674. }
  675. 72%{
  676. opacity: 0;
  677. bottom: 100px;
  678. left: 30px;
  679. }
  680. 73%{
  681. opacity: 1;
  682. bottom: 15px;
  683. left: 20px;
  684. }
  685. 74%{
  686. opacity: 1;
  687. bottom: 25px;
  688. left: 22px;
  689. }
  690. 80%{
  691. opacity: 1;
  692. bottom: 25px;
  693. left: 22px;
  694. }
  695. 81%{
  696. opacity: 0;
  697. bottom: -15px;
  698. left: -6px;
  699. }
  700. 100%{
  701. opacity: 0;
  702. bottom: 20px;
  703. }
  704. }
  705.  
  706. @keyframes rainiii{
  707. 0%{
  708. opacity: 0;
  709. bottom: 100px;
  710. left: 0px;
  711. }
  712. 72%{
  713. opacity: 0;
  714. bottom: 100px;
  715. left: 0px;
  716. }
  717. 73%{
  718. opacity: 1;
  719. bottom: 15px;
  720. left: -10px;
  721. }
  722. 74%{
  723. opacity: 1;
  724. bottom: 25px;
  725. left: -8px;
  726. }
  727. 80%{
  728. opacity: 1;
  729. bottom: 25px;
  730. left: -8px;
  731. }
  732. 81%{
  733. opacity: 0;
  734. bottom: -15px;
  735. left: -28px;
  736. }
  737. 100%{
  738. opacity: 0;
  739. bottom: 20px;
  740. }
  741. }
  742.  
  743. @keyframes fade_in{
  744. 0%{
  745. opacity: 0;
  746. }
  747. 8%{
  748. opacity: 1;
  749. }
  750. 9%{
  751. opacity: 1;
  752. }
  753. 11%{
  754. opacity: 1;
  755. }
  756. 12%{
  757. opacity: 0;
  758. }
  759. 100%{
  760. oapcity: 0;
  761. }
  762. }

以上就是css3实现的天气图标动画效果的详细内容,更多关于css3 天气图标动画的资料请关注w3xue其它相关文章!

 友情链接:直通硅谷  点职佳  北美留学生论坛

本站QQ群:前端 618073944 | Java 606181507 | Python 626812652 | C/C++ 612253063 | 微信 634508462 | 苹果 692586424 | C#/.net 182808419 | PHP 305140648 | 运维 608723728

W3xue 的所有内容仅供测试,对任何法律问题及风险不承担任何责任。通过使用本站内容随之而来的风险与本站无关。
关于我们  |  意见建议  |  捐助我们  |  报错有奖  |  广告合作、友情链接(目前9元/月)请联系QQ:27243702 沸活量
皖ICP备17017327号-2 皖公网安备34020702000426号