svg实现画中卡通小船漂浮航行动画效果代码
代码语言:html
所属分类:动画
代码描述:svg实现画中卡通小船漂浮航行动画效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <style> @import url("https://fonts.cdnfonts.com/css/sofia-sans-condensed"); body { display: flex; align-items: center; justify-content: center; height: 100vh; width: 100vw; background-color: #111; } body .frame { width: 350px; height: 350px; border: 25px solid #fff; display: flex; align-items: center; justify-content: center; border-radius: 25px; position: relative; overflow: hidden; z-index: 9; } body .frame:before { content: ''; width: 350px; height: 350px; position: absolute; border-radius: 15px; border: 5px solid #fff; overflow: hidden; z-index: 8; box-shadow: inset 0 0 25px rgba(0,0,0,0.45); } body .frame:after { content: ''; width: 350px; height: 350px; position: absolute; z-index: 0; background-color: #87ceeb; } body .frame .layer1 { position: absolute; width: 150%; bottom: -50px; z-index: 6; } body .frame .layer1 .waterl1 { fill: rgba(0,0,200,0.5); } body .frame .layer2 { width: 225%; position: absolute; bottom: -45px; z-index: 4; } body .frame .layer2 .waterl2 { fill: rgba(20,20,200,0.5); } body .frame .clouds { position: absolute; z-index: 8; animation: scroll 4s linear infinite alternate; } body .frame .clouds .cloud { fill: rgba(255,255,255,0.55); filter: drop-shadow(0 0 1px rgba(0,0,0,0.25)); } body .frame .clouds .three { transform: translate(0, -55px); } body .frame .clouds .two { transform: translate(-55px, -75px); } body .frame .clouds .one { transform: translate(85px, -60px); } body .frame .boatt { position: absolute; top: 105px; z-index: 5; } body .frame .boatt .boat { transform-origin: center; transform: translate(0, 0); animation: rock 2s linear infinite alternate; } body .frame .boatt .boat .skull { transform: scale(0.25) translate(650px, 460px); } @-moz-keyframes scroll { 0% { left: 0; } 100% { left: -25px; } } @-webkit-keyframes scroll { 0% { left: 0; } 100% { left: -25px; } } @-o-keyframes scroll { 0% { left: 0; } 100% { left: -25px; } } @keyframes scroll { 0% { left: 0; } 100% { left: -25px; } } @-moz-keyframes rock { 0% { transform: rotate(-15deg); } 100% { transform: rotate(15deg); } } @-webkit-keyframes rock { 0% { transform: rotate(-15deg); } 100% { transform: rotate(15deg); } } @-o-keyframes rock { 0% { transform: rotate(-15deg); } 100% { transform: rotate(15deg); } } @keyframes rock { 0% { transform: rotate(-15deg); } 100% { transform: rotate(15deg); } } </style> </head> <body translate="no"> <div class="frame"> <svg class="layer1" clip-rule="evenodd" fill-rule="evenodd" image-rendering="optimizeQuality" shape-rendering="geometricPrecision" text-rendering="geometricPrecision" viewbox="0 0 20 4" xml:space="preserve" xmlns="http://www.w3.org/2000/svg"><path class="waterl1" d="M0 2.2c6-3 13 0 20 0v2H0V2z;"><animate attributename="d" calcmode="ease-in-out" dur="6s" repeatcount="indefinite" values="M0 2.2c6-3 14 2 20 0v2H0V2z;M0 2.2c6-3 14-3 20 0v2H0V2z;M0 2.2c6 2 13-4 20 0v2H0V2z;M0 2.2c6-3 14-3 20 0v2H0V2z;M0 2.2c6-3 14 2 20 0v2H0V2z;"></animate></path></svg><svg class="layer2" clip-rule="evenodd" fill-rule="evenodd" image-rendering="optimizeQuality" shape-rendering="geomet.........完整代码请登录后点击上方下载按钮下载查看
网友评论0