CSS绘制小兔子,请老师点评。
完整代码如下(因为考虑浏览器兼容性,所以代码稍多):
HTML
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 | < div class = "BlueSky" > <!--蓝天--> < div class = "cloud one" ></ div > <!--云朵1--> < div class = "cloud two" ></ div > <!--云朵2--> < div class = "cloud three" ></ div > <!--云朵3--> < div class = "cloud four" ></ div > <!--云朵4--> < div class = "cloud five" ></ div > <!--云朵5--> </ div > < div class = "GreenGrassland" > <!--绿地--> < div class = "rabbit" > <!--兔子--> < div class = "face" ></ div > <!--脸--> < div class = "LeftEye" ></ div > <!--左眼--> < div class = "RightEye" ></ div > <!--右眼--> < div class = "nose" ></ div > <!--鼻子--> < div class = "LeftLip" ></ div > <!--左嘴唇--> < div class = "RightLip" ></ div > <!--右嘴唇--> < div class = "beard" ></ div > <!--胡须--> < div class = "beard right" ></ div > <!--右胡须--> < div class = "LeftEar" ></ div > <!--左耳朵--> < div class = "RightEar" ></ div > <!--右耳朵--> < div class = "body" > <!--身体部分--> < div class = "LeftHand" ></ div > <!--左手--> < div class = "RightHand" ></ div > <!--右手--> < div class = "leg" ></ div > <!--腿--> </ div > < div class = "tail" ></ div > <!--尾巴--> </ div > </ div > |
CSS
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 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 | :root { --time 1: 10 s; /*云朵1动画时间*/ --time 2: 14 s; /*云朵2动画时间*/ --time 3: 12 s; /*云朵3动画时间*/ --time 4: 12 s; /*云朵4动画时间*/ --time 5: 16 s; /*云朵5动画时间*/ } body { overflow : hidden ; /*防止窗口出现滚动条*/ margin : 0 ; padding : 0 ; width : 100% ; height : 100 vh; /*整体高度100vh*/ } .BlueSky /*蓝天*/ { position : relative ; width : 100% ; height : 60 vh; /*蓝天高度占60%*/ background-image : -webkit-linear-gradient(to bottom , rgba( 196 , 228 , 253 , 1 ), rgba( 196 , 228 , 253 , 0 )); background-image : -moz-linear-gradient(to bottom , rgba( 196 , 228 , 253 , 1 ), rgba( 196 , 228 , 253 , 0 )); background-image : -o-linear-gradient(to bottom , rgba( 196 , 228 , 253 , 1 ), rgba( 196 , 228 , 253 , 0 )); background-image : -ms-linear-gradient(to bottom , rgba( 196 , 228 , 253 , 1 ), rgba( 196 , 228 , 253 , 0 )); background-image : linear-gradient(to bottom , rgba( 196 , 228 , 253 , 1 ), rgba( 196 , 228 , 253 , 0 )); z-index : -2 ; } .GreenGrassland /*绿地*/ { position : relative ; width : 100% ; height : 40 vh; /*绿地高度占40%*/ background-image : -webkit-linear-gradient(to top , rgba( 148 , 190 , 89 , 1 ), rgba( 148 , 190 , 89 , 0 )); background-image : -moz-linear-gradient(to top , rgba( 148 , 190 , 89 , 1 ), rgba( 148 , 190 , 89 , 0 )); background-image : -o-linear-gradient(to top , rgba( 148 , 190 , 89 , 1 ), rgba( 148 , 190 , 89 , 0 )); background-image : -ms-linear-gradient(to top , rgba( 148 , 190 , 89 , 1 ), rgba( 148 , 190 , 89 , 0 )); background-image : linear-gradient(to top , rgba( 148 , 190 , 89 , 1 ), rgba( 148 , 190 , 89 , 0 )); z-index : -2 ; } .cloud /*云朵*/ { position : absolute ; border-radius: 14% / 50% ; width : 210px ; height : 60px ; background-color : #FFF ; } .cloud::before, .cloud::after, .LeftEye::after, .RightEye::after, .nose::before, .beard::before, .beard::after, .leg::after /*before和after伪元素的通用样式*/ { content : "" ; display : block ; position : absolute ; } .cloud::before { left : 8% ; top : -28% ; -webkit-transform: rotate( -30 deg); -moz-transform: rotate( -30 deg); -o-transform: rotate( -30 deg); -ms-transform: rotate( -30 deg); transform: rotate( -30 deg); border-radius: 50% / 30% ; width : 70px ; height : 86px ; background-color : #FFF ; } .cloud::after { left : 30% ; top : -98% ; border-radius: 50% 50% 50% 38% / 50% ; width : 130px ; height : 128px ; background-color : #FFF ; } .cloud.one /*云朵1*/ { top : 25% ; left : 50% ; -webkit-transform: scale( 1.3 ); /*放大1.3倍*/ -moz-transform: scale( 1.3 ); -o-transform: scale( 1.3 ); -ms-transform: scale( 1.3 ); transform: scale( 1.3 ); -webkit-animation: CloudOneAnimation var(--time 1 ) linear infinite; -moz-animation: CloudOneAnimation var(--time 1 ) linear infinite; -o-animation: CloudOneAnimation var(--time 1 ) linear infinite; -ms-animation: CloudOneAnimation var(--time 1 ) linear infinite; animation: CloudOneAnimation var(--time 1 ) linear infinite; } @-webkit-keyframes CloudOneAnimation /*云朵1动画*/ { 0% { left : 100% } 100% { left : -40% ;} } @-moz-keyframes CloudOneAnimation /*云朵1动画*/ { 0% { left : 100% } 100% { left : -40% ;} } @-o-keyframes CloudOneAnimation /*云朵1动画*/ { 0% { left : 100% } 100% { left : -40% ;} } @-ms-keyframes CloudOneAnimation /*云朵1动画*/ { 0% { left : 100% } 100% { left : -40% ;} } @keyframes CloudOneAnimation /*云朵1动画*/ { 0% { left : 100% } 100% { left : -40% ;} } .cloud.two /*云朵2*/ { top : 6% ; left : 10% ; opacity: . 9 ; /*透明度90%*/ -webkit-animation: CloudTwoAnimation var(--time 2 ) linear infinite; -moz-animation: CloudTwoAnimation var(--time 2 ) linear infinite; -o-animation: CloudTwoAnimation var(--time 2 ) linear infinite; -ms-animation: CloudTwoAnimation var(--time 2 ) linear infinite; animation: CloudTwoAnimation var(--time 2 ) linear infinite; } @-webkit-keyframes CloudTwoAnimation /*云朵2动画*/ { 0% { left : 80% } 100% { left : -20% } } @-moz-keyframes CloudTwoAnimation /*云朵2动画*/ { 0% { left : 80% } 100% { left : -20% } } @-o-keyframes CloudTwoAnimation /*云朵2动画*/ { 0% { left : 80% } 100% { left : -20% } } @-ms-keyframes CloudTwoAnimation /*云朵2动画*/ { 0% { left : 80% } 100% { left : -20% } } @keyframes CloudTwoAnimation /*云朵2动画*/ { 0% { left : 80% } 100% { left : -20% } } .cloud.three /*云朵3*/ { top : 50% ; left : 30% ; -webkit-transform: scale(. 9 ); /*缩小为原来的90%*/ -moz-transform: scale(. 9 ); -o-transform: scale(. 9 ); -ms-transform: scale(. 9 ); transform: scale(. 9 ); opacity: . 8 ; /*透明度80%*/ -webkit-animation: CloudThreeAnimation var(--time 3 ) linear infinite; -moz-animation: CloudThreeAnimation var(--time 3 ) linear infinite; -o-animation: CloudThreeAnimation var(--time 3 ) linear infinite; -ms-animation: CloudThreeAnimation var(--time 3 ) linear infinite; animation: CloudThreeAnimation var(--time 3 ) linear infinite; } @-webkit-keyframes CloudThreeAnimation /*云朵3动画*/ { 0% { left : 30% } 100% { left : -20% } } @-moz-keyframes CloudThreeAnimation /*云朵3动画*/ { 0% { left : 30% } 100% { left : -20% } } @-o-keyframes CloudThreeAnimation /*云朵3动画*/ { 0% { left : 30% } 100% { left : -20% } } @-ms-keyframes CloudThreeAnimation /*云朵3动画*/ { 0% { left : 30% } 100% { left : -20% } } @keyframes CloudThreeAnimation /*云朵3动画*/ { 0% { left : 30% } 100% { left : -20% } } .cloud.four /*云朵4*/ { top : 8% ; left : 70% ; -webkit-transform: scale(. 8 ); /*缩小为原来的80%*/ -moz-transform: scale(. 8 ); -o-transform: scale(. 8 ); -ms-transform: scale(. 8 ); transform: scale(. 8 ); opacity: . 7 ; /*透明度70%*/ -webkit-animation: CloudFourAnimation var(--time 4 ) linear infinite; -moz-animation: CloudFourAnimation var(--time 4 ) linear infinite; -o-animation: CloudFourAnimation var(--time 4 ) linear infinite; -ms-animation: CloudFourAnimation var(--time 4 ) linear infinite; animation: CloudFourAnimation var(--time 4 ) linear infinite; } @-webkit-keyframes CloudFourAnimation /*云朵4动画*/ { 0% { left : 70% } 100% { left : -20% } } @-moz-keyframes CloudFourAnimation /*云朵4动画*/ { 0% { left : 70% } 100% { left : -20% } } @-o-keyframes CloudFourAnimation /*云朵4动画*/ { 0% { left : 70% } 100% { left : -20% } } @-ms-keyframes CloudFourAnimation /*云朵4动画*/ { 0% { left : 70% } 100% { left : -20% } } @keyframes CloudFourAnimation /*云朵4动画*/ { 0% { left : 70% } 100% { left : -20% } } .cloud.five /*云朵5*/ { top : 50% ; left : 65% ; -webkit-transform: scale(. 72 ); /*缩小为原来的72%*/ -moz-transform: scale(. 72 ); -o-transform: scale(. 72 ); -ms-transform: scale(. 72 ); transform: scale(. 72 ); opacity: . 6 ; /*透明度60%*/ -webkit-animation: CloudFiveAnimation var(--time 5 ) linear infinite; -moz-animation: CloudFiveAnimation var(--time 5 ) linear infinite; -o-animation: CloudFiveAnimation var(--time 5 ) linear infinite; -ms-animation: CloudFiveAnimation var(--time 5 ) linear infinite; animation: CloudFiveAnimation var(--time 5 ) linear infinite; } @-webkit-keyframes CloudFiveAnimation /*云朵5动画*/ { 0% { left : 100% ;} 100% { left : -15% ;} } @-moz-keyframes CloudFiveAnimation /*云朵5动画*/ { 0% { left : 100% ;} 100% { left : -15% ;} } @-o-keyframes CloudFiveAnimation /*云朵5动画*/ { 0% { left : 100% ;} 100% { left : -15% ;} } @-ms-keyframes CloudFiveAnimation /*云朵5动画*/ { 0% { left : 100% ;} 100% { left : -15% ;} } @keyframes CloudFiveAnimation /*云朵5动画*/ { 0% { left : 100% ;} 100% { left : -15% ;} } .rabbit /*兔子*/ { position : absolute ; bottom : 5% ; right : 10% ; width : 300px ; height : 250px ; } .face /*脸*/ { position : absolute ; left : 2% ; top : 18% ; -webkit-transform: rotate( -35 deg); -moz-transform: rotate( -35 deg); -o-transform: rotate( -35 deg); -ms-transform: rotate( -35 deg); transform: rotate( -35 deg); border-radius: 50% / 50% 36% 50% 50% ; width : 120px ; height : 120px ; background-color : #FFF ; z-index : 0 ; } .LeftEye /*左眼*/ { position : absolute ; left : 11% ; top : 16% ; -webkit-transform: rotate( 60 deg); -moz-transform: rotate( 60 deg); -o-transform: rotate( 60 deg); -ms-transform: rotate( 60 deg); transform: rotate( 60 deg); border-radius: 26% 70% 70% 25% / 50% ; width : 18px ; height : 40px ; background-color : #838383 ; } .LeftEye::after { left : 3% ; top : 19% ; border-radius: 34% 50% 50% 30% / 50% ; width : 6px ; height : 12px ; background-color : #FFF ; } .RightEye /*右眼*/ { position : absolute ; left : 24% ; top : 30% ; -webkit-transform: rotate( 45 deg); -moz-transform: rotate( 45 deg); -o-transform: rotate( 45 deg); -ms-transform: rotate( 45 deg); transform: rotate( 45 deg); border-radius: 45% 45% 48% 40% / 50% 30% 50% 50% ; width : 24px ; height : 38px ; background-color : #838383 ; } .RightEye::after { left : 28% ; top : 18% ; border-radius: 48% 50% 50% / 50% ; width : 8px ; height : 12px ; background-color : #FFF ; } .nose /*鼻子*/ { position : absolute ; left : 4% ; top : 34% ; -webkit-transform: rotate( 42 deg); -moz-transform: rotate( 42 deg); -o-transform: rotate( 42 deg); -ms-transform: rotate( 42 deg); transform: rotate( 42 deg); border-width : 20px ; border-style : solid ; border-color : #7E7E7F transparent transparent transparent ; border-radius: 50% ; width : 2px ; height : 2px ; } .nose::before { left : -14px ; top : -20px ; border-radius: 50% ; width : 30px ; height : 10px ; background-color : #7E7E7F ; } .LeftLip /*左嘴唇*/ { position : absolute ; left : 5% ; top : 39% ; -webkit-transform: rotate( 46 deg); -moz-transform: rotate( 46 deg); -o-transform: rotate( 46 deg); -ms-transform: rotate( 46 deg); transform: rotate( 46 deg); border-width : 1px ; border-style : solid ; border-color : transparent #7E7E7F #7E7E7F #7E7E7F ; border-radius: 58% 40% 76% 40% / 44% 10% 80% 68% ; width : 15px ; height : 8px ; background-color : transparent ; } .RightLip /*右嘴唇*/ { position : absolute ; left : 8% ; top : 44% ; -webkit-transform: rotate( 60 deg); -moz-transform: rotate( 60 deg); -o-transform: rotate( 60 deg); -ms-transform: rotate( 60 deg); transform: rotate( 60 deg); border-width : 1px ; border-style : solid ; border-color : transparent #7E7E7F #7E7E7F #7E7E7F ; border-radius: 50% ; width : 24px ; height : 12px ; background-color : transparent ; } .beard /*胡须*/ { position : absolute ; left : -6% ; top : 19% ; -webkit-transform: rotate( 50 deg); -moz-transform: rotate( 50 deg); -o-transform: rotate( 50 deg); -ms-transform: rotate( 50 deg); transform: rotate( 50 deg); border-top : 1px solid #7E7E7F ; border-radius: 42% 0 0 / 40% 0 0 ; width : 30px ; height : 16px ; background-color : transparent ; } .beard::before { left : 30% ; top : 114% ; -webkit-transform: rotate( -25 deg); -moz-transform: rotate( -25 deg); -o-transform: rotate( -25 deg); -ms-transform: rotate( -25 deg); transform: rotate( -25 deg); border-top : 1px solid #7E7E7F ; border-radius: 42% 0 0 / 40% 0 0 ; width : 30px ; height : 16px ; background-color : transparent ; } .beard::after { left : 25% ; top : -209% ; -webkit-transform: rotate( 27 deg); -moz-transform: rotate( 27 deg); -o-transform: rotate( 27 deg); -ms-transform: rotate( 27 deg); transform: rotate( 27 deg); border-bottom : 1px solid #7E7E7F ; border-radius: 50% / 0 0 0 18% ; width : 30px ; height : 16px ; background-color : transparent ; } .beard. right /*右胡须*/ { -webkit-transform: scale( -1 , 1 ) rotate( -42 deg) translate( -120px , 22px ); -moz-transform: scale( -1 , 1 ) rotate( -42 deg) translate( -120px , 22px ); -o-transform: scale( -1 , 1 ) rotate( -42 deg) translate( -120px , 22px ); -ms-transform: scale( -1 , 1 ) rotate( -42 deg) translate( -120px , 22px ); transform: scale( -1 , 1 ) rotate( -42 deg) translate( -120px , 22px ); } .LeftEar /*左耳朵*/ { -webkit-transform: rotate( 40 deg) translate( 65px , -110px ); -moz-transform: rotate( 40 deg) translate( 65px , -110px ); -o-transform: rotate( 40 deg) translate( 65px , -110px ); -ms-transform: rotate( 40 deg) translate( 65px , -110px ); transform: rotate( 40 deg) translate( 65px , -110px ); border-radius: 50% 50% 40% 40% / 50% ; width : 30px ; height : 108px ; background-image : -webkit-linear-gradient( 45 deg, #DCDCCC , #FFF ); background-image : -moz-linear-gradient( 45 deg, #DCDCCC , #FFF ); background-image : -o-linear-gradient( 45 deg, #DCDCCC , #FFF ); background-image : -ms-linear-gradient( 45 deg, #DCDCCC , #FFF ); background-image : linear-gradient( 45 deg, #DCDCCC , #FFF ); z-index : -1 ; -webkit-animation: LeftEarAnimation . 6 s ease-in-out infinite; -moz-animation: LeftEarAnimation . 6 s ease-in-out infinite; -o-animation: LeftEarAnimation . 6 s ease-in-out infinite; -ms-animation: LeftEarAnimation . 6 s ease-in-out infinite; animation: LeftEarAnimation . 6 s ease-in-out infinite; } @-webkit-keyframes LeftEarAnimation /*左耳朵动画*/ { 0% {transform: rotate( 40 deg) translate( 65px , -110px );} 50% {transform: rotate( 48 deg) translate( 66px , -120px );} 100% {transform: rotate( 40 deg) translate( 65px , -110px );} } @-moz-keyframes LeftEarAnimation /*左耳朵动画*/ { 0% {transform: rotate( 40 deg) translate( 65px , -110px );} 50% {transform: rotate( 48 deg) translate( 66px , -120px );} 100% {transform: rotate( 40 deg) translate( 65px , -110px );} } @-ms-keyframes LeftEarAnimation /*左耳朵动画*/ { 0% {transform: rotate( 40 deg) translate( 65px , -110px );} 50% {transform: rotate( 48 deg) translate( 66px , -120px );} 100% {transform: rotate( 40 deg) translate( 65px , -110px );} } @-o-keyframes LeftEarAnimation /*左耳朵动画*/ { 0% {transform: rotate( 40 deg) translate( 65px , -110px );} 50% {transform: rotate( 48 deg) translate( 66px , -120px );} 100% {transform: rotate( 40 deg) translate( 65px , -110px );} } @keyframes LeftEarAnimation /*左耳朵动画*/ { 0% {transform: rotate( 40 deg) translate( 65px , -110px );} 50% {transform: rotate( 48 deg) translate( 66px , -120px );} 100% {transform: rotate( 40 deg) translate( 65px , -110px );} } .RightEar /*右耳朵*/ { -webkit-transform: rotate( 65 deg) translate( -24px , -184px ); -moz-transform: rotate( 65 deg) translate( -24px , -184px ); -o-transform: rotate( 65 deg) translate( -24px , -184px ); -ms-transform: rotate( 65 deg) translate( -24px , -184px ); transform: rotate( 65 deg) translate( -24px , -184px ); border-radius: 50% 50% 40% 40% / 50% ; width : 30px ; height : 108px ; background-image : -webkit-linear-gradient( 45 deg, #DCDCCC , #FFF ); background-image : -moz-linear-gradient( 45 deg, #DCDCCC , #FFF ); background-image : -o-linear-gradient( 45 deg, #DCDCCC , #FFF ); background-image : -ms-linear-gradient( 45 deg, #DCDCCC , #FFF ); background-image : linear-gradient( 45 deg, #DCDCCC , #FFF ); z-index : -1 ; -webkit-animation: RightEarAnimation . 6 s ease-in-out infinite; -moz-animation: RightEarAnimation . 6 s ease-in-out infinite; -o-animation: RightEarAnimation . 6 s ease-in-out infinite; -ms-animation: RightEarAnimation . 6 s ease-in-out infinite; animation: RightEarAnimation . 6 s ease-in-out infinite; } @-webkit-keyframes RightEarAnimation /*右耳朵动画*/ { 0% {transform: rotate( 65 deg) translate( -24px , -184px );} 50% {transform: rotate( 61 deg) translate( -25px , -185px );} 100% {transform: rotate( 65 deg) translate( -24px , -184px );} } @-moz-keyframes RightEarAnimation /*右耳朵动画*/ { 0% {transform: rotate( 65 deg) translate( -24px , -184px );} 50% {transform: rotate( 61 deg) translate( -25px , -185px );} 100% {transform: rotate( 65 deg) translate( -24px , -184px );} } @-o-keyframes RightEarAnimation /*右耳朵动画*/ { 0% {transform: rotate( 65 deg) translate( -24px , -184px );} 50% {transform: rotate( 61 deg) translate( -25px , -185px );} 100% {transform: rotate( 65 deg) translate( -24px , -184px );} } @-ms-keyframes RightEarAnimation /*右耳朵动画*/ { 0% {transform: rotate( 65 deg) translate( -24px , -184px );} 50% {transform: rotate( 61 deg) translate( -25px , -185px );} 100% {transform: rotate( 65 deg) translate( -24px , -184px );} } @keyframes RightEarAnimation /*右耳朵动画*/ { 0% {transform: rotate( 65 deg) translate( -24px , -184px );} 50% {transform: rotate( 61 deg) translate( -25px , -185px );} 100% {transform: rotate( 65 deg) translate( -24px , -184px );} } .body /*身体部分*/ { position : absolute ; left : 26% ; top : 45% ; -webkit-transform: rotate( -14 deg); -moz-transform: rotate( -14 deg); -o-transform: rotate( -14 deg); -ms-transform: rotate( -14 deg); transform: rotate( -14 deg); border-radius: 62% 38% 47% 100% / 60% 70% 80% 84% ; width : 128px ; height : 75px ; background-image : -webkit-linear-gradient(to top , #DCDCCC , #FFF ); background-image : -moz-linear-gradient(to top , #DCDCCC , #FFF ); background-image : -o-linear-gradient(to top , #DCDCCC , #FFF ); background-image : -ms-linear-gradient(to top , #DCDCCC , #FFF ); background-image : linear-gradient(to top , #DCDCCC , #FFF ); z-index : -2 ; } .LeftHand /*左手*/ { position : absolute ; left : -15% ; top : 46% ; -webkit-transform: rotate( 69 deg); -moz-transform: rotate( 69 deg); -o-transform: rotate( 69 deg); -ms-transform: rotate( 69 deg); transform: rotate( 69 deg); border-radius: 42% 50% 50% 40% / 40% 40% 40% 45% ; width : 22px ; height : 34px ; background-image : -webkit-linear-gradient(to bottom , #DCDCCC , #FFF ); background-image : -moz-linear-gradient(to bottom , #DCDCCC , #FFF ); background-image : -o-linear-gradient(to bottom , #DCDCCC , #FFF ); background-image : -ms-linear-gradient(to bottom , #DCDCCC , #FFF ); background-image : linear-gradient(to bottom , #DCDCCC , #FFF ); } .RightHand /*右手*/ { position : absolute ; left : -2% ; top : 58% ; -webkit-transform: rotate( 60 deg); -moz-transform: rotate( 60 deg); -o-transform: rotate( 60 deg); -ms-transform: rotate( 60 deg); transform: rotate( 60 deg); border-radius: 50% 50% 56% 56% / 60% 72% 55% 58% ; width : 22px ; height : 48px ; background-image : -webkit-linear-gradient(to top , #DCDCCC , #FFF 80% ); background-image : -moz-linear-gradient(to top , #DCDCCC , #FFF 80% ); background-image : -o-linear-gradient(to top , #DCDCCC , #FFF 80% ); background-image : -ms-linear-gradient(to top , #DCDCCC , #FFF 80% ); background-image : linear-gradient(to top , #DCDCCC , #FFF 80% ); } .leg /*腿*/ { position : absolute ; left : 38% ; top : 22% ; -webkit-transform: rotate( -10 deg); -moz-transform: rotate( -10 deg); -o-transform: rotate( -10 deg); -ms-transform: rotate( -10 deg); transform: rotate( -10 deg); border-radius: 64% 74% 60% 100% / 50% 52% 92% 108% ; width : 62px ; height : 80px ; background-image : -webkit-linear-gradient( -18 deg, #DCDCCC , #FFF 80% ); background-image : -moz-linear-gradient( -18 deg, #DCDCCC , #FFF 80% ); background-image : -o-linear-gradient( -18 deg, #DCDCCC , #FFF 80% ); background-image : -ms-linear-gradient( -18 deg, #DCDCCC , #FFF 80% ); background-image : linear-gradient( -18 deg, #DCDCCC , #FFF 80% ); } .leg::after { left : -37% ; top : 71% ; -webkit-transform: rotate( 22 deg); -moz-transform: rotate( 22 deg); -o-transform: rotate( 22 deg); -ms-transform: rotate( 22 deg); transform: rotate( 22 deg); border-radius: 50% / 50% 42% 30% 30% ; width : 70px ; height : 20px ; background-image : -webkit-linear-gradient( -18 deg, #DCDCCC , #FFF 80% ); background-image : -moz-linear-gradient( -18 deg, #DCDCCC , #FFF 80% ); background-image : -o-linear-gradient( -18 deg, #DCDCCC , #FFF 80% ); background-image : -ms-linear-gradient( -18 deg, #DCDCCC , #FFF 80% ); background-image : linear-gradient( -18 deg, #DCDCCC , #FFF 80% ); } .tail /*尾巴*/ { position : absolute ; left : 60% ; top : 39% ; border-radius: 90% 55% 100% 60% / 73% 73% 85% 50% ; width : 56px ; height : 68px ; background-color : #FFF ; z-index : -3 ; } |
7
收起
正在回答
2回答
同学你好, 因为IE11不支持var函数这种写法, 所以在IE11下白云无法实现动画效果
同学如果想要兼容IE的浏览器, 可以改成直接设置动画时间, 示例:
如果帮助到了你, 欢迎采纳!
祝学习愉快~~~
恭喜解决一个难题,获得1积分~
来为老师/同学的回答评分吧