43 lines
1.4 KiB
HTML
43 lines
1.4 KiB
HTML
|
||
<!DOCTYPE html>
|
||
<html lang="en">
|
||
|
||
<head>
|
||
<meta charset="UTF-8">
|
||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||
<title>Document</title>
|
||
</head>
|
||
|
||
<body>
|
||
|
||
</body>
|
||
|
||
|
||
<script>
|
||
// 1——var random = Math.random() -------------------------------- [0,1)
|
||
|
||
// 2——Math.random() * 10 --------------------------------------------[0,10)
|
||
|
||
// 3——(Math.random() * 10) +1 ---------------------------------------[1, 10)
|
||
|
||
// 以下函数返回 min(包含)~ max(不包含)之间的数字:
|
||
// 4——(Math.random() * (max-min)) + min -----------------------[min, max)
|
||
|
||
// 以下函数返回 min(包含)~ max(包含)之间的数字:
|
||
// 5——(Math.random() * (max-min+1)) + min ---------------- [min,max]
|
||
|
||
|
||
var totalWaterPipeHeight = this.innerHeight - 112 - this.WaterPipeClearance;
|
||
// 只限制最大高度,但是还是会出现上面自己压缩自己的情况
|
||
//方法一
|
||
//var TopWaterPipeHeight = Math.random() * (totalWaterPipeHeight*2/3);
|
||
|
||
//上水管最大最小高度都限制
|
||
//方法二
|
||
//var TopWaterPipeHeight = Math.random() * ( (totalWaterPipeHeight*2/3) - (totalWaterPipeHeight*1/3) ) + (totalWaterPipeHeight*1/3))
|
||
var BottomWaterPipeHeight = totalWaterPipeHeight - TopWaterPipeHeight;
|
||
</script>
|
||
|
||
</html>
|