缓冲运动中 speed应设置为:speed=speed>0 ?Math.ceil(speed):Math.floor(speed)
js取整
1.丢弃小数部分,保留整数部分
parseInt(5/2) //2
2.向上取整,有小数就整数部分加1
Math.ceil(5/2) //3
3,四舍五入.
Math.round(5/2) //3
4,向下取整
Math.floor(5/2) //2
纯css画三角形
代码:
#div1{
width: 0;height: 0;border-bottom: 100px solid red;border-right: 100px solid green;border-left: 100px solid yellow;border-top: 100px solid pink;
}
transparent:为全透明黑色的简写rgba(0,0,0,0)
代码:
#div1{
width: 0;height: 0;border-bottom: 100px solid red;border-right: 100px solid transparent;border-left: 100px solid transparent;
}