svg+css实现平底锅烹饪美食开关切换效果代码
代码语言:html
所属分类:动画
代码描述:svg+css实现平底锅烹饪美食开关切换效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <style> body { width: 100%; height: 100vh; display: flex; justify-content: center; align-items: center; background: radial-gradient(circle at center, #b3d5c6, #a3ccba); } body svg { position: absolute; width: 0; height: 0; } body .wrap { width: 350px; height: 150px; min-width: 350px; position: relative; box-shadow: 0 0 0 10px #fff, 0 0 0 11px #88bda5, 0 0px 20px 15px #88bda5; background: #fff; border-radius: 100px; opacity: 0; -webkit-animation: fadein 0.5s ease-in-out 1 forwards; animation: fadein 0.5s ease-in-out 1 forwards; -webkit-animation-delay: 0.5s; animation-delay: 0.5s; } @-webkit-keyframes fadein { to { opacity: 1; } } @keyframes fadein { to { opacity: 1; } } body .wrap input { position: absolute; width: 100%; height: 100%; opacity: 0; z-index: 999; top: 0; left: 0; } body .wrap input:checked ~ .syrup:before { animation: drip 3.25s ease-out 1 forwards; -webkit-animation: drip 3.25s ease-out 1 forwards; } @keyframes drip { 0% { transform: translateY(-100vh); -webkit-clip-path: polygon(55% 0, 44% 1%, 39% 9%, 40% 15%, 39% 19%, 38% 24%, 37% 27%, 37% 31%, 39% 34%, 40% 36%, 43% 38%, 46% 39%, 50% 41%, 53% 39%, 55% 37%, 59% 35%, 63% 35%, 64% 31%, 61% 24%, 60% 16%, 59% 9%); clip-path: polygon(55% 0, 44% 1%, 39% 9%, 40% 15%, 39% 19%, 38% 24%, 37% 27%, 37% 31%, 39% 34%, 40% 36%, 43% 38%, 46% 39%, 50% 41%, 53% 39%, 55% 37%, 59% 35%, 63% 35%, 64% 31%, 61% 24%, 60% 16%, 59% 9%); } 80% { transform: translateY(-100vh); -webkit-clip-path: polygon(55% 0, 44% 1%, 39% 9%, 40% 15%, 39% 19%, 38% 24%, 37% 27%, 37% 31%, 39% 34%, 40% 36%, 43% 38%, 46% 39%, 50% 41%, 53% 39%, 55% 37%, 59% 35%, 63% 35%, 64% 31%, 61% 24%, 60% 16%, 59% 9%); clip-path: polygon(55% 0, 44% 1%, 39% 9%, 40% 15%, 39% 19%, 38% 24%, 37% 27%, 37% 31%, 39% 34%, 40% 36%, 43% 38%, 46% 39%, 50% 41%, 53% 39%, 55% 37%, 59% 35%, 63% 35%, 64% 31%, 61% 24%, 60% 16%, 59% 9%); } 90% { transform: translateY(0vh); -webkit-clip-path: polygon(55% 0, 44% 1%, 39% 9%, 40% 15%, 39% 19%, 38% 24%, 37% 27%, 37% 31%, 39% 34%, 40% 36%, 43% 38%, 46% 39%, 50% 41%, 53% 39%, 55% 37%, 59% 35%, 63% 35%, 64% 31%, 61% 24%, 60% 16%, 59% 9%); clip-path: polygon(55% 0, 44% 1%, 39% 9%, 40% 15%, 39% 19%, 38% 24%, 37% 27%, 37% 31%, 39% 34%, 40% 36%, 43% 38%, 46% 39%, 50% 41%, 53% 39%, 55% 37%, 59% 35%, 63% 35%, 64% 31%, 61% 24%, 60% 16%, 59% 9%); } 100% { transform: translateY(0vh); -webkit-clip-path: polygon(60% 14%, 40% 16%, 22% 6%, 8% 23%, 2% 36%, 13% 55%, 10% 68%, 7% 96%, 13% 97%, 24% 57%, 38% 56%, 44% 75%, 42% 94%, 61% 97%, 57% 56%, 70% 57%, 80% 92%, 91% 96%, 95% 85%, 86% 51%, 88% 7%); clip-path: polygon(60% 14%, 40% 16%, 22% 6%, 8% 23%, 2% 36%, 13% 55%, 10% 68%, 7% 96%, 13% 97%, 24% 57%, 38% 56%, 44% 75%, 42% 94%, 61% 97%, 57% 56%, 70% 57%, 80% 92%, 91% 96%, 95% 85%, 86% 51%, 88% 7%); } } @-webkit-keyframes drip { 0% { -webkit-transform: translateY(-100vh); -webkit-clip-path: polygon(55% 0, 44% 1%, 39% 9%, 40% 15%, 39% 19%, 38% 24%, 37% 27%, 37% 31%, 39% 34%, 40% 36%, 43% 38%, 46% 39%, 50% 41%, 53% 39%, 55% 37%, 59% 35%, 63% 35%, 64% 31%, 61% 24%, 60% 16%, 59% 9%); } 80% { -webkit-transform: translateY(-100vh); -webkit-clip-path: polygon(55% 0, 44% 1%, 39% 9%, 40% 15%, 39% 19%, 38% 24%, 37% 27%, 37% 31%, 39% 34%, 40% 36%, 43% 38%, 46% 39%, 50% 41%, 53% 39%, 55% 37%, 59% 35%, 63% 35%, 64% 31%, 61% 24%, 60% 16%, 59% 9%); } 90% { -webkit-transform: translateY(0vh); -webkit-clip-path: polygon(55% 0, 44% 1%, 39% 9%, 40% 15%, 39% 19%, 38% 24%, 37% 27%, 37% 31%, 39% 34%, 40% 36%, 43% 38%, 46% 39%, 50% 41%, 53% 39%, 55% 37%, 59% 35%, 63% 35%, 64% 31%, 61% 24%, 60% 16%, 59% 9%); } 100% { -webkit-transform: translateY(0vh); -webkit-clip-path: polygon(60% 14%, 40% 16%, 22% 6%, 8% 23%, 2% 36%, 13% 55%, 10% 68%, 7% 96%, 13% 97%, 24% 57%, 38% 56%, 44% 75%, 42% 94%, 61% 97%, 57% 56%, 70% 57%, 80% 92%, 91% 96%, 95% 85%, 86% 51%, 88% 7%); } } body .wrap input:checked ~ .butter { animation: drop 3.25s ease-out 1 forwards; -webkit-animation: drop 3.25s ease-out 1 forwards; } body .wrap input:checked ~ .butter.two { -webkit-animation-delay: 0.25s; animation-delay: 0.25s; z-index: 12; filter: brightness(0.975); -webkit-filter: brightness(0.975); } @keyframes drop { 0% { transform: translateY(-100vh) rotate(-10deg); } 90% { transform: translateY(-100vh) rotate(-10deg); } 100% { transform: translateY(0vh) rotate(-10deg); } } @-webkit-keyframes drop { 0% { -webkit-transform: translateY(-100vh) rotate(-10deg); } 90% { -webkit-transform: translateY(-100vh) rotate(-10deg); } 100% { -webkit-transform: translateY(0vh) rotate(-10deg); } } body .wrap input:checked ~ .cake { animation: flip 3.25s linear 1 forwards; -webkit-animation: flip 3.25s linear 1 forwards; transform-style: preserve-3d; -webkit-transform-style: preserve-3d; } @keyframes flip { 0% { background: transparent; } 45% { background: transparent; border-radius: 100%; } 50% { background: #f5e3be; border-radius: 100%; transform: translateX(0); box-shadow: inset 0 0 5px 90px #f5e3be; } 65% { background: #f5e3be; border-radius: 100%; transform: scale(1) translateX(0) rotateY(0deg); box-shadow: inset 0 0 5px 90px #f5e3be; } 70% { background: #f5e3be; border-radius: 100%; transform: scale(1.5) translateX(25px) rotateY(75deg); box-shadow: inset 0 0 5px 90px #f5e3be; } 75% { background: #f5e3be; border-radius: 100%; transform: scale(1.75) translateX(100px) rotateY(120deg); box-shadow: inset 0 0 5px 90px #f5e3be; } 80% { background: #eec87d; border-radius: 100%; transform: scale(1.1) translateX(185px) rotateY(180deg); box-shadow: inset 0 0 5px 15px #f5e3be; } 100% { background: #eec87d; border-radius: 100%; transform: scale(1.1) translateX(185px) rotateY(180deg); box-shadow: inset 0 0 5px 10px #f5e3be; } } @-webkit-keyframes flip { 0% { background: transparent; } 45% { background: transparent; -webkit-border-radius: 100%; } 50% { background: #f5e3be; -webkit-border-radius: 100%; -webkit-transform: translateX(0); -webkit-box-shadow: inset 0 0 5px 90px #f5e3be; } 65% { background: #f5e3be; -webkit-border-radius: 100%; -webkit-transform: scale(1) translateX(0) rotateY(0deg); -webkit-box-shadow: inset 0 0 5px 90px #f5e3be; } 70% { background: #f5e3be; -webkit-border-radius: 100%; -webkit-transform: scale(1.5) translateX(25px) rotateY(75deg); -webkit-box-shadow: inset 0 0 5px 90px #f5e3be; } 75% { background: #f5e3be; -webkit-border-radius: 100%; -webkit-transform: scale(1.75) translateX(100px) rotateY(120deg); -webkit-box-shadow: inset 0 0 5px 90px #f5e3be; } 80% { background: #eec87d; border-radius: 100%; transform: scale(1.1) translateX(185px) rotateY(180deg); box-shadow: inset 0 0 5px 15px #f5e3be; } 100% { background: #eec87d; -webkit-border-radius: 100%; -webkit-transform: scale(1.1) translateX(185px) rotateY(180deg); -webkit-box-shadow: inset 0 0 5px 10px #f5e3be; } } body .wrap input:checked ~ .cake:before { animation: pour 3s linear 1 forwards; -webkit-animation: pour 3s linear 1 forwards; transition: 0.5s ease-in-out; transform: scale(1); } @keyframes pour { 0% { -webkit-clip-path: polygon(49% 51%, 49% 51%, 49% 51%, 49% 51%, 49% 51%, 49% 51%, 49% 51%, 49% 50%, 50% 50%, 49% 51%, 49% 51%, 49% 51%, 49% 51%, 49% 51%, 49% 51%, 49% 51%, 49% 51%); clip-path: poly.........完整代码请登录后点击上方下载按钮下载查看
网友评论0