div+css实现包卷饼煎饼动画效果代码
代码语言:html
所属分类:动画
代码描述:div+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, #a9cfbe, #99c6b2); } body input { width: 300px; height: 125px; position: absolute; left: calc(50% - 150px); top: calc(50% - 62.5px); z-index: 9; opacity: 0; } body input:checked ~ .wrap .wrapper { transform: translateX(175px); } body input:checked ~ .wrap .beans { -webkit-animation: beanroll 2.5s ease-in-out 1 forwards; animation: beanroll 2.5s ease-in-out 1 forwards; opacity: 0; } body input:checked ~ .wrap .beans:before { box-shadow: 10px 5px #826343, 5px -10px #826343, 12px -7px #826343, 20px -20px #826343, 17px -22px #826343, 30px -17px #826343, 27px -22px #826343, 13px -80px #826343, 24px -40px #826343, 10px -15px #93704c, 30px -82px #93704c, 35px -82px #93704c, 70px -72px #826343, 60px -52px #826343; } body input:checked ~ .wrap .beans:after { -webkit-clip-path: polygon(0 0, 100% 0, 100% 100%, 0% 100%); clip-path: polygon(0 0, 100% 0, 100% 100%, 0% 100%); } body input:checked ~ .wrap .tortilla { -webkit-animation: rollup 2.5s ease-in-out 1 forwards; animation: rollup 2.5s ease-in-out 1 forwards; } body input:checked ~ .wrap .tortilla .roll { -webkit-animation: rollup2 2.5s ease-in-out 1 forwards; animation: rollup2 2.5s ease-in-out 1 forwards; } body input:checked ~ .wrap .cheese, body input:checked ~ .wrap .lettuce, body input:checked ~ .wrap .tomatoes { -webkit-animation: beanroll 2.5s ease-in-out 1 forwards; animation: beanroll 2.5s ease-in-out 1 forwards; } body input:checked ~ .wrap .cheese .shred, body input:checked ~ .wrap .lettuce .shred, body input:checked ~ .wrap .tomatoes .shred { -webkit-animation: cheesedrop 2.5s ease-out 1 forwards; animation: cheesedrop 2.5s ease-out 1 forwards; } body input:checked ~ .wrap .cheese .tomato, body input:checked ~ .wrap .lettuce .tomato, body input:checked ~ .wrap .tomatoes .tomato { -webkit-animation: grow 2.5s ease-out 1 forwards; animation: grow 2.5s ease-out 1 forwards; } body input:checked ~ .wrap .lettuce .shred { -webkit-animation: lettucedrop 2.5s ease-out 1 forwards; animation: lettucedrop 2.5s ease-out 1 forwards; } body .wrap { width: 300px; height: 125px; border-radius: 75px; box-shadow: 0 0 0 1px #ccc, 0 0 30px 1px #78b499; background: #fff; position: relative; } body .wrap .wrapper { width: 110px; height: 110px; position: absolute; left: 7.5px; top: 7.5px; transform: translateX(0); transition: 1.5s ease-in-out; transition-delay: 1.25s; } body .wrap .wrapper .cheese { max-width: 65%; } body .wrap .wrapper .cheese, body .wrap .wrapper .lettuce, body .wrap .wrapper .tomatoes { width: 80%; height: 80%; z-index: 1; position: absolute; border-radius: 100%; top: 10%; left: 10%; overflow: hidden; } body .wrap .wrapper .cheese .tomato, body .wrap .wrapper .lettuce .tomato, body .wrap .wrapper .tomatoes .tomato { position: absolute; width: 20px; height: 20px; background: radial-gradient(circle at left, #eb5158 7px, rgba(255, 255, 255, 0) 7px), radial-gradient(circle at left, #e6232c 10px, rgba(255, 255, 255, 0) 10px); left: 20px; top: 20px; transform: scale(0); } body .wrap .wrapper .cheese .tomato:nth-of-type(1), body .wrap .wrapper .lettuce .tomato:nth-of-type(1), body .wrap .wrapper .tomatoes .tomato:nth-of-type(1) { -webkit-animation-delay: 0.1s; animation-delay: 0.1s; } body .wrap .wrapper .cheese .tomato:nth-of-type(2), body .wrap .wrapper .lettuce .tomato:nth-of-type(2), body .wrap .wrapper .tomatoes .tomato:nth-of-type(2) { -webkit-animation-delay: 0.2s; animation-delay: 0.2s; } body .wrap .wrapper .cheese .tomato:nth-of-type(3), body .wrap .wrapper .lettuce .tomato:nth-of-type(3), body .wrap .wrapper .tomatoes .tomato:nth-of-type(3) { -webkit-animation-delay: 0.3s; animation-delay: 0.3s; } body .wrap .wrapper .cheese .tomato:nth-of-type(4), body .wrap .wrapper .lettuce .tomato:nth-of-type(4), body .wrap .wrapper .tomatoes .tomato:nth-of-type(4) { -webkit-animation-delay: 0.4s; animation-delay: 0.4s; } body .wrap .wrapper .cheese .tomato:nth-of-type(5), body .wrap .wrapper .lettuce .tomato:nth-of-type(5), body .wrap .wrapper .tomatoes .tomato:nth-of-type(5) { -webkit-animation-delay: 0.5s; animation-delay: 0.5s; } @-webkit-keyframes grow { 0% { transform: scale(0); } 20% { transform: scale(0); } 30% { transform: scale(0); } 40% { transform: scale(1.1); } 45% { transform: scale(1); } 100% { transform: scale(1); } } @keyframes grow { 0% { transform: scale(0); } 20% { transform: scale(0); } 30% { transform: scale(0); } 40% { transform: scale(1.1); } 45% { transform: scale(1); } 100% { transform: scale(1); } } body .wrap .wrapper .cheese .tomato:nth-of-type(2), body .wrap .wrapper .lettuce .tomato:nth-of-type(2), body .wrap .wrapper .tomatoes .tomato:nth-of-type(2) { left: 40px; top: 40px; } body .wrap .wrapper .cheese .tomato:nth-of-type(3), body .wrap .wrapper .lettuce .tomato:nth-of-type(3), body .wrap .wrapper .tomatoes .tomato:nth-of-type(3) { left: 50px; top: 20px; background: radial-gradient(circle at right, #eb5158 7px, rgba(255, 255, 255, 0) 7px), radial-gradient(circle at right, #e6232c 10px, rgba(255, 255, 255, 0) 10px); } body .wrap .wrapper .cheese .tomato:nth-of-type(4), body .wrap .wrapper .lettuce .tomato:nth-of-type(4), body .wrap .wrapper .tomatoes .tomato:nth-of-type(4) { left: 10px; top: 55px; background: radial-gradient(circle at right, #eb5158 7px, rgba(255, 255, 255, 0) 7px), radial-gradient(circle at right, #e6232c 10px, rgba(255, 255, 255, 0) 10px); } body .wrap .wrapper .cheese .tomato:nth-of-type(5), body .wrap .wrapper .lettuce .tomato:nth-of-type(5), body .wrap .wrapper .tomatoes .tomato:nth-of-type(5) { left: 45px; top: 55px; background: radial-gradient(circle at right, #eb5158 7px, rgba(255, 255, 255, 0) 7px), radial-gradient(circle at right, #e6232c 10px, rgba(255, 255, 255, 0) 10px); } body .wrap .wrapper .cheese .shred, body .wrap .wrapper .lettuce .shred, body .wrap .wrapper .tomatoes .shred { position: absolute; width: 5px; height: 5px; border-radius: 0 0 100% 0; border: 2px solid; left: 20px; top: 20px; border-color: rgba(255, 255, 255, 0) rgba(255, 255, 255, 0) #ffc635 rgba(255, 255, 255, 0); transform: translateY(-100vh); } @-webkit-keyframes cheesedrop { 0% { transform: translateY(-100vh); } 20% { transform: translateY(0vh); } 100% { transform: translateY(0vh); } } @keyframes cheesedrop { 0% { transform: translateY(-100vh); } 20% { transform: translateY(0vh); } 100% { transform: translateY(0vh); } } body .wrap .wrapper .cheese .shred:nth-of-type(1n), body .wrap .wrapper .lettuce .shred:nth-of-type(1n), body .wrap .wrapper .tomatoes .shred:nth-of-type(1n) { border-radius: 0 100% 0 0; border-color: rgba(255, 255, 255, 0) #ffc635 rgba(255, 255, 255, 0) rgba(255, 255, 255, 0); left: 17px; margin-top: 5px; } body .wrap .wrapper .cheese .shred:nth-of-type(2n), body .wrap .wrapper .lettuce .shred:nth-of-type(2n), body .wrap .wrapper .tomatoes .shred:nth-of-type(2n) { border-radius: 0 100% 0 0; border-color: rgba(255, 255, 255, 0) #ffc635 rgba(255, 255, 255, 0) rgba(255, 255, 255, 0); left: 35px; margin-top: 5px; } body .wrap .wrapper .cheese .shred:nth-of-type(3n), body .wrap .wrapper .lettuce .shred:nth-of-type(3n), body .wrap .wrapper .tomatoes .shred:nth-of-type(3n) { border-radius: 100% 0 0 0; border-color: #ffc635 rgba(255, 255, 255, 0) rgba(255, 255, 255, 0) rgba(255, 255, 255, 0); left: 50px; margin-top: -2px; } body .wrap .wrapper .cheese .shred:nth-of-type(4n), body .wrap .wrapper .lettuce .shred:nth-of-type(4n), body .wrap .wrapper .tomatoes .shred:nth-of-type(4n) { border-radius: 0 0 0 100%; border-color: rgba(255, 255, 255, 0) rgba(255, 255, 255, 0) rgba(255, 255, 255, 0) #ffc635; left: 65px; } body .wrap .wrapper .cheese .shred:nth-of-type(5n), body .wrap .wrapper .lettuce .shred:nth-of-type(5n), body .wrap .wrapper .tomatoes .shred:nth-of-type(5n) { border-radius: 100% 0 0 0; border-color: #ffc635 rgba(255, 255, 255, 0) rgba(255, 255, 255, 0) rgba(255, 255, 255, 0); left: 30px; margin-top: 5px; } body .wrap .wrapper .cheese .shred:nth-of-type(6n), body .wrap .wrapper .lettuce .shred:nth-of-type(6n), body .wrap .wrapper .tomatoes .shred:nth-of-type(6n) { border-radius: 0 100% 0 0; border-color: rgba(255, 255, 255, 0) #ffc635 rgba(255, 255, 255, 0) rgba(255, 255, 255, 0); left: 5px; margin-top: -5px; } body .wrap .wrapper .cheese .shred:nth-of-type(7n), body .wrap .wrapper .lettuce .shred:nth-of-type(7n), body .wrap .wrapper .tomatoes .shred:nth-of-type(7n) { border-radius: 100% 0 0 0; border-color: #ffc635 rgba(255, 255, 255, 0) rgba(255, 255, 255, 0) rgba(255, 255, 255, 0); left: 46px; margin-top: -2px; } body .wrap .wrapper .cheese .shred:nth-of-type(1), body .wrap .wrapper .lettuce .shred:nth-of-type(1), body .wrap .wrapper .tomatoes .shred:nth-of-type(1) { top: calc(20% + 1.5px); margin-left: calc(50% - 2px); -webkit-animation-delay: 0.025s; animation-delay: 0.025s; } body .wrap .wrapper .cheese .shred:nth-of-type(2), body .wrap .wrapper .lettuce .shred:nth-of-type(2), body .wrap .wrapper .tomatoes .shred:nth-of-type(2) { top: calc(20% + 3px); margin-left: calc(50% - 4px); -webkit-animation-delay: 0.05s; animation-delay: 0.05s; } body .wrap .wrapper .cheese .shred:nth-of-type(3), body .wrap .wrapper .lettuce .shred:nth-of-type(3), body .wrap .wrapper .tomatoes .shred:nth-of-type(3) { top: calc(20% + 4.5px); margin-left: calc(50% - 6px); -webkit-animation-delay: 0.075s; animation-delay: 0.075s; } body .wrap .wrapper .cheese .shred:nth-of-type(4), body .wrap .wrapper .lettuce .shred:nth-of-type(4), body .wrap .wrapper .tomatoes .shred:nth-of-type(4) { top: calc(20% + 6px); margin-left: calc(50% - 8px); -webkit-animation-delay: 0.1s; animation-delay: 0.1s; } body .wrap .wrapper .cheese .shred:nth-of-type(5), body .wrap .wrapper .lettuce .shred:nth-of-type(5), body .wrap .wrapper .tomatoes .shred:nth-of-type(5) { top: calc(20% + 7.5px); margin-left: calc(50% - 10px); -webkit-animation-delay: 0.125s; animation-delay: 0.125s; } body .wrap .wrapper .cheese .shred:nth-of-type(6), body .wrap .wrapper .lettuce .shred:nth-of-type(6), body .wrap .wrapper .tomatoes .shred:nth-of-typ.........完整代码请登录后点击上方下载按钮下载查看
网友评论0