<!DOCTYPE html> <html> <head lang="en"> <meta charset="UTF-8"> <title>画圆</title> <script type="text/javascript" src="../../jCanvaScript.1.5.18.min.js"></script> <style type="text/css"> *{margin:0;padding:0} body{background:blue} #c1{border:1px solid black;background:#fff} </style> </head> <body> <canvas id="c1" width="800px" height="800px"></canvas> <script type="text/javascript"> window.onload=function(){ function onload_1(idCanvas) { jc.start(idCanvas); //circle(float x, float y, float radius) jc.circle(100,120,50);//第一个圆 // circle(float x, float y, float radius, string color) jc.circle(150,120,50,'rgb(0,255,0)');//第二个圆,多了边框色 //circle(float x, float y, float radius, bool fill) jc.circle(200,120,50,true);//实心圆true 边框圆false,默认false //实心有背景色的圆 //circle(float x, float y, float radius, string color, bool fill) jc.circle(250,120,50,'rgba(255,0,0,0.9)',true); //带上参数 jc.circle({x:300,y:120,radius:50,color:'#eced60',fill:1}); jc.start(idCanvas); } //不需要获取canvas,也不需要设置场景,直接将canvas的id传给onload_1方法即可 onload_1('c1') } </script> </body> </html>