纯css布局实现一个画家作画的动画
代码语言:html
所属分类:动画
代码描述:纯css布局实现一个画家作画的动画
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <style> *, *::after, *::before { margin: 0; padding: 0; -webkit-box-sizing: border-box; box-sizing: border-box; -webkit-transform-style: preserve-3d; transform-style: preserve-3d; -webkit-tap-highlight-color: transparent; } /* Generic */ body { display: -webkit-box; display: -ms-flexbox; display: flex; -webkit-box-pack: center; -ms-flex-pack: center; justify-content: center; -webkit-box-align: center; -ms-flex-align: center; align-items: center; width: 100%; height: 100vh; background-color: #FCF2E6; } .main { position: relative; width: 55vw; height: 41vw; } /*-------------*/ .nube { position: absolute; top: 0; left: 5vw; display: -webkit-box; display: -ms-flexbox; display: flex; -webkit-box-pack: center; -ms-flex-pack: center; justify-content: center; width: 4vw; height: 1vw; -webkit-animation: nube ease 8s infinite alternate; animation: nube ease 8s infinite alternate; } .nube:nth-of-type(2) { left: 40vw; top: 5vw; animation: nube ease 12s infinite reverse alternate; } .nube-1, .nube-2 { position: relative; border-radius: 50%; margin-left: -.5vw; border-top: 1.5vw solid white; border-left: 1.5vw solid white; border-bottom: 1.5vw solid transparent; border-right: 1.5vw solid transparent; -webkit-transform: rotateZ(45deg); -ms-transform: rotate(45deg); transform: rotateZ(45deg); } .nube-2 { margin-top: .25vw; border-top: 1.25vw solid white; border-left: 1.25vw solid white; border-bottom: 1.25vw solid transparent; border-right: 1.25vw solid transparent; } .pajaro { position: absolute; width: 3vw; height: 4vw; top: 6vw; left: 11vw; z-index: 1; -webkit-animation: pajaro 4s infinite; animation: pajaro 4s infinite; } .pajaro-i { position: absolute; width: 0.15vw; -webkit-transform-origin: bottom left; -ms-transform-origin: bottom left; transform-origin: bottom left; } .pajaro-1 { bottom: -.5vw; left: 1.5vw; width: 3vw; height: 3vw; border-radius: 50%; border-bottom: 1.5vw solid #4546c8; border-left: 1.5vw solid #4546c8; border-right: 1.5vw solid transparent; border-top: 1.5vw solid transparent; -webkit-transform: rotateZ(-45deg); -ms-transform: rotate(-45deg); transform: rotateZ(-45deg); } .pajaro-2 { bottom: 1.5vw; right: 0; width: 1.8vw; height: 1.5vw; border-top-left-radius: 1vw; border-top-right-radius: 1vw; background-color: #4546c8; } .pajaro-2::before { content: ''; position: absolute; right: 20%; top: 30%; width: .6vw; height: .6vw; background-color: #FEFEFC; border-radius: 50%; } .pajaro-2::after { content: ''; position: absolute; right: 25%; top: 50%; width: .2vw; height: .2vw; background-color: #2C0870; border-radius: 50%; } .pajaro-3 { top: 1.5vw; left: 2.8vw; z-index: -1; border-bottom: .4vw solid transparent; border-left: 0.7vw solid #FEBD6A; border-right: 1vw solid transparent; border-top: .4vw solid transparent; } .suelo { position: absolute; bottom: 2.7vw; left: 50%; width: 46.25vw; height: 0.15vw; -webkit-transform: translateX(-50%); -ms-transform: translateX(-50%); transform: translateX(-50%); border-radius: 50%; background-image: -webkit-gradient(linear, left top, right top, from(#238396), color-stop(#178ba4), to(#238396)); background-image: -webkit-linear-gradient(left, #238396, #178ba4, #238396); background-image: -o-linear-gradient(left, #238396, #178ba4, #238396); background-image: linear-gradient(left, #238396, #178ba4, #238396); } .bote { position: absolute; bottom: 0; left: 17.8vw; width: 4vw; height: 4.5vw; background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0.5vw, #6AA5CA), color-stop(0.5vw, #398CB4), color-stop(0.6vw, #398CB4), color-stop(0.6vw, #6AA5CA), color-stop(6vw, #398CB4)); background-image: -webkit-linear-gradient(top, #6AA5CA 0.5vw, #398CB4 0.5vw, #398CB4 0.6vw, #6AA5CA 0.6vw, #398CB4 6vw); background-image: -o-linear-gradient(top, #6AA5CA 0.5vw, #398CB4 0.5vw, #398CB4 0.6vw, #6AA5CA 0.6vw, #398CB4 6vw); background-image: linear-gradient(top, #6AA5CA 0.5vw, #398CB4 0.5vw, #398CB4 0.6vw, #6AA5CA 0.6vw, #398CB4 6vw); } .bote:nth-of-type(2) { bottom: -.1vw; left: 40vw; -webkit-transform: rotateZ(-90deg); -ms-transform: rotate(-90deg); transform: rotateZ(-90deg); } .bote:nth-of-type(2)::before { content: ''; position: absolute; left: -2vw; top: -2vw; height: .2vw; width: 4vw; background: #f09b1f; border: none; -webkit-transform: rotateZ(90deg); -ms-transform: rotate(90deg); transform: rotateZ(90deg); } .bote::before { content: ''; position: absolute; top: -1vw; right: -.1vw; width: 4vw; height: 3vw; border-top: 0.1vw solid transparent; border-left: 0.1vw solid transparent; border-bottom: 0.1vw solid #FEFEFC; border-right: 0.1vw solid #FEFEFC; border-radius: 50%; -webkit-transform: rotateZ(30deg); -ms-transform: rotate(30deg); transform: rotateZ(30deg); } .colores-i { position: absolute; width: 0.15vw; -webkit-transform-origin: bottom right; -ms-transform-origin: bottom right; transform-origin: bottom right; } .colores-1 { height: 1.3vw; top: -1.3vw; left: 0.7vw; -webkit-transform: rotateZ(-20deg); -ms-transform: rotate(-20deg); transform: rotateZ(-20deg); background-color: #116577; } .colores-2 { height: 1.8vw; top: -1.8vw; left: 1.4vw; -webkit-transform: rotateZ(-5deg); -ms-transform: rotate(-5deg); transform: rotateZ(-5deg); background-color: #FEBD6A; } .colores-3 { height: 2vw; top: -2vw; left: 2.7vw; -webkit-transform: rotateZ(10deg); -ms-transform: rotate(10deg); transform: rotateZ(10deg); background-color: #002E83; } .colores-4 { height: 1.5vw; top: -1.4vw; left: 3vw; -webkit-transform: rotateZ(35deg); -ms-transform: rotate(35deg); transform: rotateZ(35deg); background-color: #238396; } .colores-5 { height: 2.2vw; top: -2.15vw; left: 3.5vw; -webkit-transform: rotateZ(25deg); -ms-transform: rotate(25deg); transform: rotateZ(25deg); background-color: #238396; } .humano { position: absolute; top: 3vw; left: 5.5vw; width: 25vw; height: 35vw; z-index: 100; } .humano-i { position: absolute; } .humano-pi { width: 4.5vw; height: 15vw; bottom: 4vw; left: 9vw; -webkit-transform-origin: bottom left; -ms-transform-origin: bottom left; transform-origin: bottom left; -webkit-transform: rotateZ(40deg); -ms-transform: rotate(40deg); transform: rotateZ(40deg); border-top-right-radius: 2vw; background-image: -webkit-linear-gradient(170deg, transparent 2vw, #020750 2vw, #002E83 2.75vw); background-image: -o-linear-gradient(170deg, transparent 2vw, #020750 2vw, #002E83 2.75vw); background-image: linear-gradient(-80deg, transparent 2vw, #020750 2vw, #002E83 2.75vw); } .humano-pi::before { content: ''; position: absolute; bottom: 0; border-top: 1.5vw solid transparent; border-bottom: 1.5vw solid transparent; border-left: 6vw solid #020750; border-right: 1vw solid transparent; -webkit-transform-origin: bottom left; -ms-transform-origin: bottom left; transform-origin: bottom left; -webkit-transform: rotateZ(30deg) skewX(30deg); -ms-transform: rotate(30deg) skewX(30deg); transform: rotateZ(30deg) skewX(30deg); } .humano-pi::after { content: ''; position: absolute; bottom: 1vw; width: 3vw; height: 3vw; background-image: -webkit-linear-gradient(170deg, transparent 0.4vw, #2C0870 0.5vw, #020750 1.5vw); background-image: -o-linear-gradient(170deg, transparent 0.4vw, #2C0870 0.5vw, #020750 1.5vw); background-image: linear-gradient(-80deg, transparent 0.4vw, #2C0870 0.5vw, #020750 1.5vw); } .humano-pd { width: 4.5vw; height: 15vw; top: 10.9vw; left: 12.5vw; -webkit-transform-origin: bottom left; -ms-transform-origin: bottom left; transform-origin: bottom left; -webkit-transform: rotateZ(-63deg); -ms-transform: rotate(-63deg); transform: rotateZ(-63deg); border-top-left-radius: 3vw; border-top-right-radius: 2vw; background-image: -webkit-linear-gradient(10deg, transparent 2vw, #2C0870 2vw, #024799 2.75vw); background-image: -o-linear-gradient(10deg, transparent 2vw, #2C0870 2vw, #024799 2.75vw); background-image: linear-gradient(80deg, transparent 2vw, #2C0870 2vw, #024799 2.75vw); } .humano-pd::before { content: ''; position: absolute; bottom: 0; right: 0; border-top: 1.5vw solid transparent; border-bottom: 1.5vw solid transparent; border-left: 1vw solid transparent; border-right: 6vw solid #020750; -webkit-transform-origin: bottom right; -ms-transform-origin: bottom right; transform-origin: bottom right; -webkit-transform: rotateZ(-30deg) skewX(-30deg); -ms-transform: rotate(-30deg) skewX(-30deg); transform: rotateZ(-30deg) skewX(-30deg); } .humano-pd::after { content: ''; position: absolute; right: 0; bottom: 1vw; width: 3vw; height: 3vw; background-image: -webkit-linear-gradient(10deg, transparent 0.4vw, #2C0870 0.5vw, #020750 1.5vw); background-image: -o-linear-gradient(10deg, transparent 0.4vw, #2C0870 0.5vw, #020750 1.5vw); background-image: linear-gradient(80deg, transparent 0.4vw, #2C0870 0.5vw, #020750 1.5vw); } .humano-pdt { bottom: 15.5vw; width: 10vw; height: 5vw; border-top-left-radius: 3vw; border-bottom-left-radius: 2vw; background-image: -webkit-gradient(linear, left top, left bottom, from(#020750), to(#024799)); background-image: -webkit-linear-gradient(top, #020750, #024799); background-image: -o-linear-gradient(top, #020750, #024799); background-image: linear-gradient(top, #020750, #024799); } .humano-pdt::before { content: ''; position: absolute; bottom: 2.1vw; right: -.4vw; width: 5vw; height: 0.125vw; background-color: #00256a; -webkit-transform-origin: top left; -ms-transform-origin: top left; transform-origin: top left; -webkit-transform: rotateZ(25deg); -ms-transform: rotate(25deg); transform: rotateZ(25deg); } .humano-pdt::after { content: ''; position: absolute; bottom: 0; right: 0; width: 3vw; height: 6vw; background-image: -webkit-linear-gradient(50deg, transparent 1.9vw, #f09b1f 1.9vw); background-image: -o-linear-gradient(50deg, transparent 1.9vw, #f09b1f 1.9vw); background-image: linear-gradient(40deg, transparent 1.9vw, #f09b1f 1.9vw); border-top-left-radius: 1.4vw; } .humano-mandila { top: 10.5vw; right: 13.5vw; width: 7vw; height: 13vw; -webkit-transform-origin: top right; -ms-transform-origin: top right; transform-origin: top right; -webkit-transform: rotateZ(-40deg); -ms-transform: rotate(-40deg); transform: rotateZ(-40deg); background-image: -webkit-gradient(linear, left top, left bottom, color-stop(70%, #f09b1f), to(#FE.........完整代码请登录后点击上方下载按钮下载查看
网友评论0