작은 프로그램 사용자 정의 원형 진도표

2879 단어 소절차진도표
본고의 실례는 모두에게 소프로그램 사용자 정의 원형 진도표의 구체적인 코드를 공유하여 참고하도록 하였으며, 구체적인 내용은 다음과 같다.
circle.wxss:

page {
 width: 100%;
 height: 100%;
 background-color: #fff;
}
 
.circle-box {
 text-align: center;
 margin-top: 10vw;
}

.circle {
 position: absolute;
 left: 0;
 right: 0;
 margin: auto;
}

.draw_btn {
 width: 35vw;
 position: absolute;
 top: 33vw;
 right: 0;
 left: 0;
 margin: auto;
 border: 1px #000 solid;
 border-radius: 5vw;
}
circle.wxml:

<view class="wrap">
 <view class="circle-box">
 <canvas class="circle" style="z-index: -99; width:200px; height:200px;" canvas-id="canvasCircle">
 </canvas>
 <canvas class="circle" style="width:200px; height:200px;" canvas-id="canvasArcCir">
 </canvas>
 <view class="draw_btn">
 <view>80 </view>
 <view>( 100 )</view>
 </view>
 </view>
</view>
circle.js:

// pages/circle/circle.js
// 
const app = getApp()
var ctx = wx.createCanvasContext('canvasArcCir');
Page({

 /**
 *  
 */
 data: {

 },
 drawCircle: function() {
 function drawArc(s, e) {
 ctx.setFillStyle('white');
 ctx.clearRect(0, 0, 200, 200);
 ctx.draw();
 var x = 100,
 y = 100,
 radius = 96;
 ctx.setLineWidth(5);
 ctx.setStrokeStyle('#d81e06');
 ctx.setLineCap('round');
 ctx.beginPath();
 //  x,y ,radius  s: , ( 3 ) e: ,:false 
 ctx.arc(x, y, radius, s, e, false);
 ctx.stroke()
 ctx.draw()
 }
 var step = 70,
 startAngle = 1.5 * Math.PI,
 endAngle = 0,
 n = 100,
 endAngle = step * 2 * Math.PI / n + 1.5 * Math.PI;
 drawArc(startAngle, endAngle);

 },
 /**
 *  -- 
 */
 onLoad: function(options) {
 // 
 this.drawCircle()
 },
 /**
 *  -- 
 */
 onReady: function() {
 // context 。
 var cxt_arc = wx.createCanvasContext('canvasCircle');
 cxt_arc.setLineWidth(6);
 cxt_arc.setStrokeStyle('#eaeaea');
 cxt_arc.setLineCap('round');
 cxt_arc.beginPath();
 cxt_arc.arc(100, 100, 96, 0, 2 * Math.PI, false);
 cxt_arc.stroke();
 cxt_arc.draw();
 },
})
여러분에게 현재 관심이 비교적 높은 위챗 소프로그램 강좌 한 편을 추천합니다《위챗 소프로그램 개발 강좌》. 여러분을 위해 정성스럽게 정리한 것이니 마음에 드셨으면 좋겠습니다.
이상은 본문의 전체 내용입니다. 여러분의 학습에 도움이 되고 저희를 많이 응원해 주십시오.

좋은 웹페이지 즐겨찾기