Parcourir la source

[feat][生涯彩虹图][试验生涯彩虹图]

hizhangling il y a 1 semaine
Parent
commit
a134fb591a
1 fichiers modifiés avec 17 ajouts et 4 suppressions
  1. 17 4
      src/views/xjc-integratedmachine/common/ai/TestColorCanvas.vue

+ 17 - 4
src/views/xjc-integratedmachine/common/ai/TestColorCanvas.vue

@@ -82,10 +82,13 @@
         // 第二个职业
         else if(sum < Math.pow(300,2) && sum > Math.pow(250,2)){
             startAngle21 = calcAngle();
+            calcPaintCircleFlag(3)
         }else if(sum < Math.pow(350,2) && sum > Math.pow(300,2)){
             startAngle22 = calcAngle();
+            calcPaintCircleFlag(4)
         }else if(sum < Math.pow(400,2) && sum > Math.pow(350,2)){
             startAngle23 = calcAngle();
+            calcPaintCircleFlag(5)
         }
     }
 
@@ -124,11 +127,17 @@
         }
         // 第二个职业
         else if(sum < Math.pow(300,2) && sum > Math.pow(250,2)){
-            paint("#ffd309", 275, startAngle21 ,ret);
+            if(paintFlagList[3]){
+                paint("#ffd309", 275, startAngle21 ,ret);
+            }
         }else if(sum < Math.pow(350,2) && sum > Math.pow(300,2)){
-            paint("#ffd309", 325, startAngle22 ,ret);
+            if(paintFlagList[4]){
+                paint("#ffd309", 325, startAngle22 ,ret);
+            }
         }else if(sum < Math.pow(400,2) && sum > Math.pow(350,2)){
-            paint("#ffd309", 375, startAngle23 ,ret);
+            if(paintFlagList[5]){
+                paint("#ffd309", 375, startAngle23 ,ret);
+            }
         }
     }
 
@@ -143,7 +152,7 @@
             ret += 450;
         }
         let num = ret * Math.PI/180 +Math.PI;
-        // console.log('角度:'+num);
+        console.log('角度:'+num);
         return num;
     }
 
@@ -164,6 +173,10 @@
 
 
     function paint(color, radius, startAngle, endAngle){
+        // 结束角度不能小于起始角度
+        if(endAngle <= startAngle){
+            return;
+        }
         context.lineWidth = 50;
         context.strokeStyle = color;
         context.beginPath();