博客
关于我
css3电池效果
阅读量:399 次
发布时间:2019-03-05

本文共 1273 字,大约阅读时间需要 4 分钟。

css3电池效果,页面加载,从左到右增长到传入的值。

效果:
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

分析:

黑色的小间隔是自己画的,保证页面伸缩的时候样式不会异样,间隔是循环定位上去的,让间隔的层级最高,然后彩色的小块是循环产生的,宽度固定,撑满整个盒子,一共10个,然后,右边有一个灰色盒子,用100%-要显示的值,就是他的长度,把他定位到右边,最初给他100%,然后在生命周期中500毫秒让他缩到(100%-要显示的值)这个宽度,就可以看到动画增长的效果了;这里直接transition过度也可以实现效果了

代码:

data(){ return{ //色块 colorList:[ { id:'a',color: "#299AF0"}, { id:'b',color: "#309EE6"}, { id:'c',color: "#29A4BF"}, { id:'d',color: "#36D5E8"}, { id:'e',color: "#50D2E2"}, { id:'f',color: "#41D8D8"}, { id:'g',color: "#3BDBEE"}, { id:'h',color: "#3BDBEE"}, { id:'i',color: "#3BDBEE"}, { id:'j',color: "#3BDBEE"}, ] }},computed:{ //值 _value:{ get(){ if(this.value>100){ this.value = 100 }else if(this.value<0||this.value===0){ this.value = 0 }else{ return parseInt(parseInt(this.value)) } } }, //间隔个数 lengthes:{ get(){ let arr = [] for(var i =0;i<11;i++){ arr.push(i) } return arr } }}

转载地址:http://iigwz.baihongyu.com/

你可能感兴趣的文章
NN&DL4.1 Deep L-layer neural network简介
查看>>
NN&DL4.3 Getting your matrix dimensions right
查看>>
NN&DL4.7 Parameters vs Hyperparameters
查看>>
NN&DL4.8 What does this have to do with the brain?
查看>>
nnU-Net 终极指南
查看>>
No 'Access-Control-Allow-Origin' header is present on the requested resource.
查看>>
No 'Access-Control-Allow-Origin' header is present on the requested resource.
查看>>
NO 157 去掉禅道访问地址中的zentao
查看>>
no available service ‘default‘ found, please make sure registry config corre seata
查看>>
No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
查看>>
no connection could be made because the target machine actively refused it.问题解决
查看>>
No Datastore Session bound to thread, and configuration does not allow creation of non-transactional
查看>>
No fallbackFactory instance of type class com.ruoyi---SpringCloud Alibaba_若依微服务框架改造---工作笔记005
查看>>
No Feign Client for loadBalancing defined. Did you forget to include spring-cloud-starter-loadbalanc
查看>>
No mapping found for HTTP request with URI [/...] in DispatcherServlet with name ...的解决方法
查看>>
No mapping found for HTTP request with URI [/logout.do] in DispatcherServlet with name 'springmvc'
查看>>
No module named 'crispy_forms'等使用pycharm开发
查看>>
No module named cv2
查看>>
No module named tensorboard.main在安装tensorboardX的时候遇到的问题
查看>>
No module named ‘MySQLdb‘错误解决No module named ‘MySQLdb‘错误解决
查看>>