繪製圓弧的幾種簡單方法

2022-08-21 01:57:20 字數 1445 閱讀 5049

展示圖:

//繪製圓弧  true:逆時針  false:順時針

context.linewidth=5;

context.strokestyle="pink";

context.arc(40,40,30,0,math.pi*2);

context.stroke();//外環是粉色的圓,無填充色

context.beginpath();

context.strokestyle="yellow";

context.fillstyle="red";

context.arc(100,40,30,0,math.pi*2);

context.fill();

context.stroke();//外環是黃色,內填充是red

context.beginpath();

context.strokestyle="yellow";

context.fillstyle="red";

context.arc(180,40,30,0,math.pi/3,true);

context.stroke(); //外環是黃色

context.beginpath();

context.strokestyle="yellow";

context.fillstyle="red";

context.arc(260,40,30,0,math.pi/3,true);

context.fill();//內填充是red的60度的弧

context.beginpath();

context.strokestyle="yellow";

context.fillstyle="red";

context.arc(260,100,30,0,math.pi/3,true);

context.fill();

context.stroke();//外環是黃色,內填充是red的60度的弧

素數求解的的幾種簡單方法

問題 列印出100到200之間的素數 方法一 素數n就是除了1和它本身之外沒有任何因子的數,所以要求素數我們很容易想到從2到n 1去試除,如果能除盡說明它不是素數,這個時候就接著判斷下乙個數也就是下面的這種 上結果圖 方法二 方法一是可以做出來,但是要試的因子太多了有點。我們可以想到如果n有除了它本...

css清除浮動的幾種簡單方法

在頁面的布局和排版中,難免會遇到需要新增浮動和清除浮動的情況,如果不清楚浮動很有可能會造成頁面布局塌陷,那麼如何清除浮動呢,下邊我就來介紹幾個簡單的方法,親測有效。方法一 給父級新增固定的高。例如 用法 適合高度固定的布局,給出明確的高度。方法二 在浮動結束後加上div標籤,新增樣式 clear b...

陣列去重的幾種簡單方法

今天學習一下陣列去重的幾種方法,雖然不全但是實用 方法一 let arr 1 2,3 5,4 8,8 4,8 8,2 2 function chuanru arr return newarr console.log chuanru arr script 使用了push與indexof進行去重 pus...