如何用纯CSS实现接扎啤的特效_第1页
免费预览已结束,剩余17页可下载查看

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、如何用纯css实现接扎啤的特效源代码下载代码解读定义dom,容器中包含一个表示酒桶的.keg元素和表示啤酒杯的.glass元素。酒桶有2个子元素,.handle表示把手,.pipe表示出水管,酒杯有1个表示啤酒的子元素.beer:居中显示:bodymargin:0;height:100vh;display:flex;justify-content:center;background:linear-gradient(lightslategray300px,333300px);定义容器尺寸和伪元素的共有属性:.containerwidth:700px;height:300px;position:r

2、elative;.container*:before,.container*:aftercontent:&39;&39;position:absolute;画出酒桶:.kegposition:absolute;width:90px;height:200px;background:linear-gradient(toright,77770px,55570px);bottom:0;left:310px;画出出水管和它的支架:.keg.pipeposition:absolute;width:10px;height:40px;background-color:ccc;top:33px;

3、left:10px;.keg.pipe:beforewidth:40px;height:20px;background:radial-gradient(circleat10px10px,eee7px,ccc7px,ccc10px,transparent10px),linear-gradient(ccc50%,99950%);border-radius:10px;top:-2px;left:-5px;画出把手:.keg.handleposition:absolute;border-style:solid;border-width:50px10px010px;border-color:blackt

4、ransparenttransparenttransparent;top:-10px;left:5px;.keg.handle:beforewidth:20px;height:10px;background-color:ccc;top:-60px;left:-10px;border-radius:5px5px00;.keg.handle:afterwidth:10px;height:20px;background-color:ccc;top:-20px;left:-5px;画出酒杯:.glassposition:absolute;width:70px;height:100px;color:rg

5、ba(255,255,255,0.3);background-color:currentcolor;bottom:0;left:300px;border-radius:5px;.glass:beforewidth:50px;height:40px;border:10pxsolid;top:20px;right:-20px;border-radius:040%40%0;clip-path:inset(00072%);画出杯中的啤酒和泡沫:.beerposition:absolute;width:60px;height:80px;background-color:rgba(255,206,84,0

6、.8);bottom:15px;left:5px;border-radius:005px5px;border-top:solidrgba(255,206,84,0.8);.beer:beforewidth:inherit;height:15px;background-color:eee;top:-15px;border-radius:5px5px00;接下来制作动画。增强酒杯把手被压下的动画效果:.keg.handletransform-origin:center50px;animation:handle5sinfinite;keyframeshandle10%,60%transform:ro

7、tate(0deg);20%,50%transform:rotate(-90deg);增强啤酒被斟满的动画效果:.beeranimation:fillup5sinfinite;keyframesfillup0%,20%height:0px;border-width:0px;40%height:40px;80%,100%height:80px;border-width:5px;增强啤酒泡沫泛起的动画效果:.beer:beforeanimation:wave0.5sinfinitealternate,fillup-foam5slinearinfinite;keyframesfillup-foam0

8、%,20%top:0;height:0;60%,100%top:-15px;height:15px;keyframeswavefromtransform:skewy(-3deg);totransform:skewy(3deg);增强啤酒从出水口流出的效果:.keg.pipe:afterwidth:10px;background-color:rgba(255,206,84,0.5);animation:flow5sinfinite;keyframesflow0%,15%top:40px;height:0;20%height:115px;40%height:75px;55%top:40px;height:50px;60%,100%top:80px;height:0;最后,增强酒杯滑动的效果:.glassanimation:slide5seaseinfinite;ke

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论