纯css实现日全食的原理解释动画效果
代码语言:html
所属分类:动画
代码描述:纯css实现日全食的原理解释动画效果
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <style> body { background: #21223a; } .container { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); } .sun { width: 150px; height: 150px; background: #fffaa9; border-radius: 100%; box-shadow: 0 0 60px #ffcfa9, 0 0 100px #b9a018; position: relative; left: 250px; } .sun .left-eye, .sun .left-eye::after { position: relative; border-top-right-radius: 90px; border-top-left-radius: 90px; background: #ffcfa9; width: 25px; height: 12.5px; transform: scale(1.5); top: 60px; left: 30px; animation: sun-lefteye 2.3s ease-in-out infinite; } .sun .left-eye::after { content: ""; position: absolute; background: #fffaa9; left: 0px; top: 3px; transform: scale(0.9); animation: sun-eye-smol 2.3s ease-in-out infinite; } .sun .right-eye, .sun .right-eye::after { position: absolute; border-top-right-radius: 90px; border-top-left-radius: 90px; background: #ffcfa9; width: 25px; height: 12.5px; transform: scale(1.5); top: 60px; left: 90px; animation: sun-righteye 2.3s ease-in-out infinite; } .sun .right-eye::after { content: ""; position: absolute; background: #fffaa9; left: 0px; top: 3px; transform: scale(0.9); animation: sun-eye-smol 2.3s ease-in-out infinite; } .left-eyelash, .left-eyelash::after, .right-eyelash::after, .right-eyelash { position: relative; width: 2.5px; height: 8px; background: #ffcfa9; border-radius: 200px; } .left-eyelash, .left-eyelash::after, .right-eyelash::after { top: 2px; transform: rotate(-45deg); } .left-eyelash::after, .right-eyelash::after { content: ""; position: absolute; top: -1px; left: 3px; transform: rotate(5deg); } .right-eyelash { top: -1px; left: 21px; transform: rotate(45deg); } .right-eyelash::after { content: ""; position: absolute; top: 1px; left: 3px; } .rays { position: absolute; transform-origin: center; margin: auto; width: 150px; z-index: -1; top: 0; left: 0; right: 0; bottom: 0; animation: spin 120s linear infinite; } .beam { background: linear-gradient(0deg, rgba(255, 255, 255, 0), #ffcfa9 40%, #ffcfa9); margin-left: 10px; border-radius: 50% 50% 0 0; position: absolute; opacity: 0.03; height: 110px; } .beam:nth-child(1) { width: 40px; transform: rotate(180deg); top: -90px; left: 42px; } .beam:nth-child(2) { width: 30px; transform: rotate(210deg); right: -5px; top: -80px; } .beam:nth-child(3) { width: 50px; transform: rotate(255deg); top: -20px; right: -65px; } .beam:nth-child(4) { width: 24px; transform: rotate(300deg); top: 60px; left: 150px; } .beam:nth-child(5) { width: 40px; top: 135px; left: 40px; } .beam:nth-child(6) { width: 30px; transform: rotate(-35deg); top: 115px; right: -12px; } .beam:nth-child(7) { width: 45px; transform: rotate(45deg); top: 100px; left: -45px; } .beam:nth-child(8) { width: 20px; transform: rotate(75deg); top: 40px; left: -70px; } .beam:nth-child(9) { width: 50px; transform: rotate(-250deg); top: -30px; left: -70px; } .beam:nth-child(10) { width: 20px; transform: rotate(145deg); top: -80px; left: -15px; } @keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } } @keyframes sun-lefteye { 50% { left: 40px; } } @keyframes sun-eye-smol { 50% { left: 0px; } } @keyframes sun-righteye { 50% { left: 100px; } } .moon { width: 80px; height: 80px; background: #e3e7ea; border-radius: 100%; position: absolute; top: 110px; right: 130px; transform-origin: 200px center; overflow: hidden; transform: rotate(-20deg); animation: moonOrbit 5s infinite 0.3s; } .moon::after { content: ""; width: 80px; height: 80px; background: transparent; border-radius: 100%; position: absolute; box-shadow: inset 15px -3px 0px #637684; z-index: 3; opacity: 0.2; } .moon .craters { position: absolute; animation: moonScroll 5s linear infinite 0.3s; } .moon .craters:nth-child(1) { width: 40px; height: 40px; background: #ccd3d9; border-radius: 100%; } .moon .craters:nth-child(2) { width: 10px; height: 10px; background: #ccd3d9; border-radius: 100%; left: 40px; top: 35px; } .moon .craters:nth-child(3) { width: 40px; height: 40px; background: #ccd3d9; border-radius: 100%; left: 60px; } .moon .craters:nth-child(4) { width: 20px; height: 20px; background: #ccd3d9; border-radius: 100%; top: 45px; } .moon .craters:nth-child(5) { width: 30px; height: 30px; background: #ccd3d9; border-radius: 100%; top: 55px; left: 30px; } .moon .eyes { display: flex; justify-content: space-between; position: absolute; top: 35px; transform: translateX(-50); } .moon .eyes::before, .moon .eyes::after { display: block; content: ""; position: relative; width: 20px; height: 5px; right: 25%; border-radius: 200px; background: #637684; margin: 0 3px; animation: blink 3.5s infinite; } .moon .eyes::before { transform: rotate(30deg); } .moon .eyes::after { transform: rotate(-30deg); } @keyframes moonOrbit { 20%, 25% { transform: rotate(50deg); } 55%, 60% { transform: rotate(-20deg); } } @keyframes blink { 0% { top: 0px; height: 5px; } 18% { top: 0px; height: 5px; } 20% { top: 3px; height: 2px; } 25% { top: 0px; height: 5px; } 38% { top: 0px; height: 5px; } 40% { top: 3px; height: 2px; } 45% { top: 0px; height: 5px; } 80% { top: 0px; height: 5px; } 100% { top: 0px; height: 5px; } } .earth { position: absolute; display: block; right: 300px; top: 100px; width: 120px; height: 120px; background: #6fd4dd; border-radius: 100%; transform: rotate(-20deg); transform-origin: 400px center; overflow: hidden; animation: earthOrbit 5s infinite; } .earth::after { content: ""; width: 120px; height: 120px; background: transparent; border-radius: 100%; position: absolute; box-shadow: inset 10px 1px 0px #1d747c; z-index: 3; opacity: 0.2; } @keyframes earthOrbit { 20%, 25% { transform: rotate(50deg); } 55%, 60% { transform: rotate(-20deg); } } .countries { position: absolute; z-index: 1; animation: scroll 5s linear alternate infinite; } .countries:nth-child(1) { width: 40px; height: 40px; background: #62e5aa; border-radius: 100%; left: 5px; top: 20px; } .countries:nth-child(2) { width: 50px; height: 50px; background: #62e5aa; border-radius: 100%; left: 25px; top: 45px; } .countries:nth-child(3) { width: 35px; height: 35px; background: #62e5aa; border-radius: 100%; left: 60px; top: 20px; } .countries:nth-child(4) { width: 55px; height: 55px; background: #62e5aa; border-radius: 100%; left: 90px; top: 50px; } .countries:nth-child(5) { width: 60px; height: 60px; background: #62e5aa; border-radius: 100%; left: 75px; } .countries:nth-child(6) { width: 50px; height: 50px; background: #62e5aa; border-radius: 100%; top: 110px; left: 35px; } .countries:nth-child(7) { width: 30px; height: 30px; background: #62e5aa; border-radius: 100%; top: 20px; left: -50px; } .eyes { display: flex; justify-content: space-between; position: absolute; z-index: 3; top: 15px; left: 25%; } .eyes .opened::before, .eyes .opened::after { display: block; content: "\2665"; color: #f55020; font-size: 40px; margin: 0 8px; animation: openBlink 5s linear infinite; } .eyes .closed::before, .eyes .closed::after { display: block; content: ""; background: transparent; width: 30px; height: 30px; border-radius: 50%; box-shadow: 5px 5px 0 0 #1d747c; margin: 8px 8px; transform: rotate(45deg); opacity: 0; animation: closedEyes 5s linear infinite; } .tear { position: absolute; width: 8px; height: 8px; border-radius: 0 50% 50% 50%; background: #54acb7; top: 65px; z-index: 3; left: 35px; opacity: 0; transform: rotate(60deg); animation: crying 5s infinite 3s; } @keyframes crying { from { opacity: 1; transform: translateY(0px) rotate(60deg); } to { opacity: 0; transform: translateY(50px); } } @keyframes openBlink { 0% { transform: scaleY(1); } 18% { transform: scaleY(1); } 20% { transform: scaleY(0); } 25% { transform: scaleY(1); } 38% { transform: scaleY(1); } 40% { transform: scaleY(0); } 45% { transform: scaleY(1); } 48% { transform: scaleY(0), scaleX(0); opacity: 1; } 50% { margin-top: 8px; opacity: 0; } 72% { opacity: 0; } 80% { opacity: 0; } 100% { opacity: 0; } } @keyframes closedEyes { 45% { opacity: 0; margin-top: 8px; } 49% { opacity: 0; } 50% { opacity: 1; } 100% { opacity: 1; margin-top: 15px; } } .shadow { width: 100px; height: 100px; background: #21223a; border-radius: 100%; z-index: 2; position: absolute; opacity: 0.2; right: 270px; top: 210px; transform-origin: 650px center; animation: shadowOrbit 5s infinite 0.3s; } @keyframes shadowOrbit { 20%, 25% { transform: rotate(35deg); } 55%, 60% { transform: rotate(0deg); } } @keyframes scroll { 50% { transform: translateX(-90px); } } @keyframes moonScroll { 50% { transform: translateX(-40px); } } .excited { position: absolute; font-weight: bold; font-family: Arial; z-index: -1; color: white; top: 200px; right: 400px; font-size: 0px; transform: rotate(-30deg); animation: excited 5s infinite 4.5s; } @keyframes excited { 0% { font-size: 0px; } 2% { font-size: 25px; } 10% { opacity: 1; font-size: 25px; } 20% { opacity: 0; font-size: 25px; } 100% { opacity: 0; font-size: 0px; } } @keyframes star-animation { 0% { transform: rotate(-20deg) translateX(-1000px); } 100% { transform: rotate(-20deg) translateX(1000px); } } .stars1 { z-index: -1; width: 1px; height: 1px; border-radius: 50%; box-shadow: 143vh 394vh #FFF , 483vh 512vh #FFF , 70vh 346vh #FFF , 10vh 460vh #FFF , 679vh 478vh #FFF , 528vh 184vh #FFF , 432vh 634vh #FFF , 560vh 343vh #FFF , 631vh 260vh #FFF , 797vh 323vh #FFF , 360vh 513vh #FFF , 849vh 690vh #FFF , 655vh 427vh #FFF , 476vh 775vh #FFF , 113vh 737vh #FFF , 792vh 355vh #FFF , 581vh 346vh #FFF , 857vh 648vh #FFF , 412vh 888vh #FFF , 411vh 592vh #FFF , 481vh 778vh #FFF , 18vh 773vh #FFF , 13vh 103vh #FFF , 575vh 632vh #FFF , 429vh 89vh #FFF , 737vh 363vh #FFF , 190vh 65vh #FFF , 497vh 421vh #FFF , 625vh 539vh #FFF , 462vh 115vh #FFF , 126vh 441vh #FFF , 939vh 736vh #FFF , 12vh 127vh #FFF , 969vh 42vh #FFF , 361vh 465vh #FFF , 240vh 660vh #FFF , 263vh 613vh #FFF , 378vh 506vh #FFF , 844vh 813vh #FFF , 602vh 696vh #FFF , 801vh 563vh #FFF , 18vh 721vh #FFF , 18vh 152vh #FFF , 241vh 495vh #FFF , 484vh 777vh #FFF , 801vh 516vh #FFF , 168vh 589vh #FFF , 402vh 792vh #FFF , 440vh 668vh #FFF , 703vh 695vh #FFF , 321vh 565vh #FFF , 840vh 314vh #FFF , 750vh 69vh #FFF , 639vh 858vh #FFF , 692vh 541vh #FFF , 378vh 229vh #FFF , 975vh 213vh #FFF , 976vh 392vh #FFF , 137vh 644vh #FFF , 927vh 758vh #FFF , 138vh 845vh #FFF , 751vh 47vh #FFF , 998vh 483vh #FFF , 311vh 662vh #FFF , 251vh 397vh #FFF , 509vh 22vh #FFF , 202vh 143vh #FFF , 483vh 475vh #FFF , 748vh 861vh #FFF , 149vh 551vh #FFF , 339vh 259vh #FFF , 358vh 401vh #FFF , 394vh 693vh #FFF , 767vh 745vh #FFF , 781vh 135vh #FFF , 904vh 211vh #FFF , 933vh 243vh #FFF , 101vh 382vh #FFF , 532vh 732vh #FFF , 155vh 238vh #FFF , 397vh 690vh #FFF , 795vh 541vh #FFF , 174vh 758vh #FFF , 546vh 58vh #FFF , 214vh 88vh #FFF , 106vh 319vh #FFF , 344vh 624vh #FFF , 418vh 372vh #FFF , 150vh 787vh #FFF , 508vh 721vh #FFF , 694vh 737vh #FFF , 960vh 179vh #FFF , 360vh 678vh #FFF , 968vh 334vh #FFF , 340vh 629vh #FFF , 294vh 222vh #FFF , 49vh 661vh #FFF , 660vh 464vh #FFF , 218vh 848vh #FFF , 101vh 583vh #FFF , 763vh 587vh #FFF , 590vh 451vh #FFF , 228vh 722vh #FFF , 343vh 577vh #FFF , 859vh 158vh #FFF , 901vh 799vh #FFF , 679vh 47vh #FFF , 646vh 520vh #FFF , 118vh 776vh #FFF , 314vh 625vh #FFF , 649vh 309vh #FFF , 206vh 620vh #FFF , 927vh 663vh #FFF , 286vh 886vh #FFF , 5vh 720vh #FFF , 402vh 428vh #FFF , 90vh 748vh #FFF , 495vh 289vh #FFF , 91vh 157vh #FFF , 51vh 283vh #FFF , 451vh 128vh #FFF , 701vh 305vh #FFF , 104vh 51vh #FFF , 153vh 9vh #FFF , 287vh 434vh #FFF , 224vh 653vh #FFF , 356vh 753vh #FFF , 414vh 278vh #FFF , 353vh 650vh #FFF , 723vh 59vh #FFF , 9vh 372vh #FFF , 70vh 688vh #FFF , 865vh 357vh #FFF , 950vh 664vh #FFF , 376vh 412vh #FFF , 874vh 809vh #FFF , 64vh 543vh #FFF , 629vh 883vh #FFF , 807vh 429vh #FFF , 1vh 599vh #FFF , 89vh 711vh #FFF , 289vh 886vh #FFF , 31vh 737vh #FFF , 390vh 113vh #FFF , 146vh 528vh #FFF , 507vh 559vh #FFF , 240vh 701vh #FFF , 556vh 895vh #FFF , 642vh 571vh #FFF , 138vh 329vh #FFF , 660vh 580vh #FFF , 330vh 729vh #FFF , 551vh 797vh #FFF , 878vh 454vh #FFF , 809vh 662vh #FFF , 904vh 892vh #FFF , 743vh 634vh #FFF , 208vh 795vh #FFF , 465vh 36vh #FFF , 927vh 387vh #FFF , 262vh 858vh #FFF , 591vh 645vh #FFF , 528vh 680vh #FFF , 964vh 632vh #FFF , 740vh 399vh #FFF , 639vh 497vh #FFF , 822vh 455vh #FFF , 474vh 609vh #FFF , 770vh 322vh #FFF , 220vh 78vh #FFF , 548vh 696vh #FFF , 582vh 876vh #FFF , 514vh 327vh #FFF , 241vh 802vh #FFF , 665vh 808vh #FFF , 830vh 94vh #FFF , 596vh 45vh #FFF , 849vh 781vh #FFF , 163vh 310vh #FFF , 163vh 394vh #FFF , 548vh 854vh #FFF , 682vh 779vh #FFF , 337vh 199vh #FFF , 306vh 84vh #FFF , 733vh 30vh #FFF , 451vh 754vh #FFF , 575vh 491vh #FFF , 781vh 427vh #FFF , 829vh 419vh #FFF , 336vh 801vh #FFF , 473vh 580vh #FFF , 480vh 356vh #FFF , 28vh 486vh #FFF , 951vh 202vh #FFF , 422vh 295vh #FFF , 409vh 546vh #FFF , 812vh 832vh #FFF , 208vh 810vh #FFF , 644vh 782vh #FFF , 991vh 303vh #FFF , 332vh 140vh #FFF , 347vh 356vh #FFF , 201vh 193vh #FFF , 124vh 497vh #FFF , 706vh 805vh #FFF , 148vh 194vh #FFF , 407vh 19vh #FFF , 416vh 152vh #FFF , 123vh 823vh #FFF , 797vh 419vh #FFF , 387vh 470vh #FFF , 592vh 218vh #FFF , 202vh 61vh #FFF , 289vh 589vh #FFF , 672vh 687vh #FFF , 120vh 80vh #FFF , 995vh 240vh #FFF , 374vh 894vh #FFF , 342vh 309vh #FFF , 777vh 24vh #FFF , 789vh 34vh #FFF , 768vh 526vh #FFF , 806vh 191vh #FFF , 815vh 304vh #FFF , 845vh 794vh #FFF , 647vh 824vh #FFF , 389vh 586vh #FFF , 655vh 131vh #FFF , 243vh 704vh #FFF , 731vh 411vh #FFF , 418vh 125vh #FFF , 685vh 874vh #FFF , 581vh 676vh #FFF , 648vh 110vh #FFF , 440vh 543vh #FFF , 522vh 799vh #FFF , 949vh 767vh #FFF , 296vh 891vh #FFF , 357vh 871vh #FFF , 963vh 716vh #FFF , 679vh 331vh #FFF , 458vh 604vh #FFF , 412vh 674vh #FFF , 461vh 530vh #FFF , 369vh 768vh #FFF , 59vh 253vh #FFF , 118vh 776vh #FFF , 625vh 587vh #FFF , 425vh 532vh #FFF , 283vh 128vh #FFF , 665vh 801vh #FFF , 466vh 390vh #FFF , 786vh 165vh #FFF , 584vh 590vh #FFF , 860vh 465vh #FFF , 118vh 574vh #FFF , 986vh 39vh #FFF , 820vh 714vh #FFF , 41vh 650vh #FFF , 668vh 745vh #FFF , 197vh 270vh #FFF , 6vh 871vh #FFF , 260vh 343vh #FFF , 26vh 647vh #FFF , 591vh 619vh #FFF , 833vh 445vh #FFF , 427vh 688vh #FFF , 851vh 346vh #FFF , 819vh 858vh #FFF , 567vh 449vh #FFF , 999vh 872vh #FFF , 374vh 688vh #FFF , 25vh 364vh #FFF , 546vh 76vh #FFF , 71vh 634vh #FFF , 203vh 591vh #FFF , 542vh 743vh #FFF , 919vh 75vh #FFF , 963vh 702vh #FFF , 310vh 147vh #FFF , 702vh 420vh #FFF , 455vh 447vh #FFF , 933vh 678vh #FFF , 131vh 614vh #FFF , 798vh 469vh #FFF , 11vh 758vh #FFF , 438vh 628vh #FFF , 657vh 136vh #FFF , 626vh 449vh #FFF , 55vh 438vh #FFF , 869vh 4vh #FFF , 319vh 798vh #FFF , 252vh 521vh #FFF , 659vh 819vh #FFF , 460vh 398vh #FFF , 853vh 495vh #FFF , 387vh 402vh #FFF , 691vh 853vh #FFF , 130vh 304vh #FFF , 496vh 546vh #FFF , 264vh 548vh #FFF , 491vh 33vh #FFF , 815vh 477vh #FFF , 968vh 419vh #FFF , 921vh 106vh #FFF , 844vh 794vh #FFF , 606vh 639vh #FFF , 552vh 541vh #FFF , 312vh 670vh #FFF , 56vh 420vh #FFF , 516vh 98vh #FFF , 642vh 486vh #FFF , 633vh 198vh #FFF , 855vh 283vh #FFF , 230vh 77vh #FFF , 650vh 593vh #FFF , 828vh 211vh #FFF , 351vh 177vh #FFF , 219vh 781vh #FFF , 431vh 828vh #FFF , 816vh 658vh #FFF , 407vh 808vh #FFF , 960vh 829vh #FFF , 355vh 625vh #FFF , 811vh 80vh #FFF , 154vh 339vh #FFF , 271vh 418vh #FFF , 421vh 150vh #FFF , 824vh 872vh #FFF , 331vh 642vh #FFF , 120vh 373vh #FFF , 227vh 565vh #FFF , 222vh 690vh #FFF , 702vh 387vh #FFF , 223vh 869vh #FFF , 459vh 479vh #FFF , 179vh 301vh #FFF , 276vh 699vh #FFF , 155vh 328vh #FFF , 904vh 587vh #FFF , 226vh 881vh #FFF , 333vh 264vh #FFF , 119vh 513vh #FFF , 157vh 125vh #FFF , 409vh 415vh #FFF , 127vh 795vh #FFF , 35vh 746vh #FFF , 271vh 692vh #FFF , 392vh 726vh #FFF , 333vh 581vh #FFF , 829vh 520vh #FFF , 470vh 696vh #FFF , 140vh 154vh #FFF , 422vh 410vh #FFF , 347vh 276vh #FFF , 212vh 733vh #FFF , 904vh 704vh #FFF , 907vh 241vh #FFF , 595vh 628vh #FFF , 354vh 491vh #FFF , 874vh 89vh #FFF , 962vh 510vh #FFF , 732vh 93vh #FFF , 646vh 758vh #FFF , 214vh 478vh #FFF , 630vh 181vh #FFF , 432vh 659vh #FFF , 797vh 390vh #FFF , 927vh 312vh #FFF , 87vh 845vh #FFF , 19vh 286vh #FFF , 403vh 721vh #FFF , 39vh 589vh #FFF , 561vh 134vh #FFF , 62vh 146vh #FFF , 716vh 291vh #FFF , 771vh 409vh #FFF , 511vh 551vh #FFF , 84vh 91vh #FFF , 235vh 190vh #FFF , 58vh 6vh #FFF , 981vh 245vh #FFF , 966vh 673vh #FFF , 922vh 125vh #FFF , 648vh 647vh #FFF , 212vh 237vh #FFF , 649vh 821vh #FFF , 610vh 489vh #FFF , 355vh 641vh #FFF , 508vh 417vh #FFF , 712vh 337vh #FFF , 875vh 228vh #FFF , 246vh 328vh #FFF , 154vh 672vh #FFF , 161vh 307vh #FFF , 829vh 832vh #FFF , 481vh 298vh #FFF , 212vh 389vh #FFF , 243vh 488vh #FFF , 471vh 497vh #FFF; animation: star-animation 100s linear infinite; } .stars1:after { content: " "; top: -900px; width: 1px; height: 1px; border-radius: 50%; position: absolute; box-shadow: 247vh 195vh #FFF , 351vh 423vh #FFF , 435vh 354vh #FFF , 198vh 197vh #FFF , 210vh 430vh #FFF , 19vh 133vh #FFF , 161vh 191vh #FFF , 101vh 485vh #FFF , 300vh 663vh #FFF , 314vh 327vh #FFF , 224vh 535vh #FFF , 169vh 742vh #FFF , 18vh 322vh #FFF , 285vh 8vh #FFF , 39vh 679vh #FFF , 301vh 614vh #FFF , 173vh 173vh #FFF , 444vh 292vh #FFF , 269vh 792vh #FFF , 287vh 185vh #FFF , 418vh 150vh #FFF , 51vh 639vh #FFF , 449vh 341vh #FFF , 452vh 347vh #FFF , 398vh 305vh #FFF , 136vh 463vh #FFF , 333vh 714vh #FFF , 108vh 464vh #FFF , 343vh 691vh #FFF , 111vh 794vh #FFF , 363vh 786vh #FFF , 121vh 511vh #FFF , 95vh 720vh #FFF , 72vh 7vh #FFF , 442vh 689vh #FFF , 465vh 644vh #FFF , 123vh 586vh #FFF , 343vh 551vh #FFF , 386vh 676vh #FFF , 457vh 32vh #FFF , 408vh 344vh #FFF , 331vh 27vh #FFF , 47vh 151vh #FFF , .........完整代码请登录后点击上方下载按钮下载查看
网友评论0