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-type(6) { top: calc(20% + 9px); margin-left: calc(50% - 12px); -webkit-animation-delay: 0.15s; animation-delay: 0.15s; } body .wrap .wrapper .cheese .shred:nth-of-type(7), body .wrap .wrapper .lettuce .shred:nth-of-type(7), body .wrap .wrapper .tomatoes .shred:nth-of-type(7) { top: calc(20% + 10.5px); margin-left: calc(50% - 14px); -webkit-animation-delay: 0.175s; animation-delay: 0.175s; } body .wrap .wrapper .cheese .shred:nth-of-type(8), body .wrap .wrapper .lettuce .shred:nth-of-type(8), body .wrap .wrapper .tomatoes .shred:nth-of-type(8) { top: calc(20% + 12px); margin-left: calc(50% - 16px); -webkit-animation-delay: 0.2s; animation-delay: 0.2s; } body .wrap .wrapper .cheese .shred:nth-of-type(9), body .wrap .wrapper .lettuce .shred:nth-of-type(9), body .wrap .wrapper .tomatoes .shred:nth-of-type(9) { top: calc(20% + 13.5px); margin-left: calc(50% - 18px); -webkit-animation-delay: 0.225s; animation-delay: 0.225s; } body .wrap .wrapper .cheese .shred:nth-of-type(10), body .wrap .wrapper .lettuce .shred:nth-of-type(10), body .wrap .wrapper .tomatoes .shred:nth-of-type(10) { top: calc(20% + 15px); margin-left: calc(50% - 20px); -webkit-animation-delay: 0.25s; animation-delay: 0.25s; } body .wrap .wrapper .cheese .shred:nth-of-type(11), body .wrap .wrapper .lettuce .shred:nth-of-type(11), body .wrap .wrapper .tomatoes .shred:nth-of-type(11) { top: calc(20% + 16.5px); margin-left: calc(50% - 22px); -webkit-animation-delay: 0.275s; animation-delay: 0.275s; } body .wrap .wrapper .cheese .shred:nth-of-type(12), body .wrap .wrapper .lettuce .shred:nth-of-type(12), body .wrap .wrapper .tomatoes .shred:nth-of-type(12) { top: calc(20% + 18px); margin-left: calc(50% - 24px); -webkit-animation-delay: 0.3s; animation-delay: 0.3s; } body .wrap .wrapper .cheese .shred:nth-of-type(13), body .wrap .wrapper .lettuce .shred:nth-of-type(13), body .wrap .wrapper .tomatoes .shred:nth-of-type(13) { top: calc(20% + 19.5px); margin-left: calc(50% - 26px); -webkit-animation-delay: 0.325s; animation-delay: 0.325s; } body .wrap .wrapper .cheese .shred:nth-of-type(14), body .wrap .wrapper .lettuce .shred:nth-of-type(14), body .wrap .wrapper .tomatoes .shred:nth-of-type(14) { top: calc(20% + 21px); margin-left: calc(50% - 28px); -webkit-animation-delay: 0.35s; animation-delay: 0.35s; } body .wrap .wrapper .cheese .shred:nth-of-type(15), body .wrap .wrapper .lettuce .shred:nth-of-type(15), body .wrap .wrapper .tomatoes .shred:nth-of-type(15) { top: calc(20% + 22.5px); margin-left: calc(50% - 30px); -webkit-animation-delay: 0.375s; animation-delay: 0.375s; } body .wrap .wrapper .cheese .shred:nth-of-type(16), body .wrap .wrapper .lettuce .shred:nth-of-type(16), body .wrap .wrapper .tomatoes .shred:nth-of-type(16) { top: calc(20% + 24px); margin-left: calc(50% - 32px); -webkit-animation-delay: 0.4s; animation-delay: 0.4s; } body .wrap .wrapper .cheese .shred:nth-of-type(17), body .wrap .wrapper .lettuce .shred:nth-of-type(17), body .wrap .wrapper .tomatoes .shred:nth-of-type(17) { top: calc(20% + 25.5px); margin-left: calc(50% - 34px); -webkit-animation-delay: 0.425s; animation-delay: 0.425s; } body .wrap .wrapper .cheese .shred:nth-of-type(18), body .wrap .wrapper .lettuce .shred:nth-of-type(18), body .wrap .wrapper .tomatoes .shred:nth-of-type(18) { top: calc(20% + 27px); margin-left: calc(50% - 36px); -webkit-animation-delay: 0.45s; animation-delay: 0.45s; } body .wrap .wrapper .cheese .shred:nth-of-type(19), body .wrap .wrapper .lettuce .shred:nth-of-type(19), body .wrap .wrapper .tomatoes .shred:nth-of-type(19) { top: calc(20% + 28.5px); margin-left: calc(50% - 38px); -webkit-animation-delay: 0.475s; animation-delay: 0.475s; } body .wrap .wrapper .cheese .shred:nth-of-type(20), body .wrap .wrapper .lettuce .shred:nth-of-type(20), body .wrap .wrapper .tomatoes .shred:nth-of-type(20) { top: calc(20% + 30px); margin-left: calc(50% - 40px); -webkit-animation-delay: 0.5s; animation-delay: 0.5s; } body .wrap .wrapper .cheese .shred:nth-of-type(21), body .wrap .wrapper .lettuce .shred:nth-of-type(21), body .wrap .wrapper .tomatoes .shred:nth-of-type(21) { top: calc(20% + 31.5px); margin-left: calc(50% - 42px); -webkit-animation-delay: 0.525s; animation-delay: 0.525s; } body .wrap .wrapper .cheese .shred:nth-of-type(22), body .wrap .wrapper .lettuce .shred:nth-of-type(22), body .wrap .wrapper .tomatoes .shred:nth-of-type(22) { top: calc(20% + 33px); margin-left: calc(50% - 44px); -webkit-animation-delay: 0.55s; animation-delay: 0.55s; } body .wrap .wrapper .cheese .shred:nth-of-type(23), body .wrap .wrapper .lettuce .shred:nth-of-type(23), body .wrap .wrapper .tomatoes .shred:nth-of-type(23) { top: calc(20% + 34.5px); margin-left: calc(50% - 46px); -webkit-animation-delay: 0.575s; animation-delay: 0.575s; } body .wrap .wrapper .cheese .shred:nth-of-type(24), body .wrap .wrapper .lettuce .shred:nth-of-type(24), body .wrap .wrapper .tomatoes .shred:nth-of-type(24) { top: calc(20% + 36px); margin-left: calc(50% - 48px); -webkit-animation-delay: 0.6s; animation-delay: 0.6s; } body .wrap .wrapper .cheese .shred:nth-of-type(25), body .wrap .........完整代码请登录后点击上方下载按钮下载查看
网友评论0