Fix rand rect display bug
This commit is contained in:
parent
608fc248b5
commit
6aaff4cb85
|
@ -25,7 +25,11 @@ function listPoint(props) {
|
||||||
let col = randArr[i][1];
|
let col = randArr[i][1];
|
||||||
if (qrcode.isDark(row, col)) {
|
if (qrcode.isDark(row, col)) {
|
||||||
let tempRand = rand(0.8, 1.3);
|
let tempRand = rand(0.8, 1.3);
|
||||||
let tempRGB = randRGB();
|
let randNum = rand(50,230);
|
||||||
|
let tempRGB = [
|
||||||
|
'rgb(' + Math.floor(20 + randNum) + ',' + Math.floor(170 - randNum / 2) + ',' + Math.floor(60 + randNum * 2) + ')',
|
||||||
|
'rgb(' + Math.floor(-20 + randNum) + ',' + Math.floor(130 - randNum / 2) + ',' + Math.floor(20 + randNum * 2) + ')'
|
||||||
|
];
|
||||||
let width = 0.15;
|
let width = 0.15;
|
||||||
pointList.push(<rect key={id++} opacity="0.9" fill={tempRGB[1]} width={1 * tempRand + width} height={1 * tempRand + width} x={row - (tempRand - 1)/2} y={col - (tempRand - 1)/2}/>);
|
pointList.push(<rect key={id++} opacity="0.9" fill={tempRGB[1]} width={1 * tempRand + width} height={1 * tempRand + width} x={row - (tempRand - 1)/2} y={col - (tempRand - 1)/2}/>);
|
||||||
pointList.push(<rect key={id++} fill={tempRGB[0]} width={1 * tempRand} height={1 * tempRand} x={row - (tempRand - 1)/2} y={col - (tempRand - 1)/2}/>);
|
pointList.push(<rect key={id++} fill={tempRGB[0]} width={1 * tempRand} height={1 * tempRand} x={row - (tempRand - 1)/2} y={col - (tempRand - 1)/2}/>);
|
||||||
|
|
|
@ -9,16 +9,8 @@ export function rand(min, max) {
|
||||||
return min + (seed / 233280.0) * (max - min);
|
return min + (seed / 233280.0) * (max - min);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function randRGB() {
|
export function randRGB(minR, maxR, minG, maxG, minB, maxB) {
|
||||||
let randNum = rand(50,230);
|
return 'rgb(' + parseInt(minR, maxR) + ',' + parseInt(minG, maxG) + ',' + parseInt(minB, maxB) + ')';
|
||||||
let rgb = [];
|
|
||||||
rgb.push(
|
|
||||||
'rgb(' + String(20 + randNum) + ',' + String(170 - randNum / 2) + ',' + String(60 + randNum * 2) + ')'
|
|
||||||
)
|
|
||||||
rgb.push(
|
|
||||||
'rgb(' + String(-20 + randNum) + ',' + String(130 - randNum / 2) + ',' + String(20 + randNum * 2) + ')'
|
|
||||||
)
|
|
||||||
return rgb;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function isWeiXin(){
|
export function isWeiXin(){
|
||||||
|
|
Loading…
Reference in New Issue