脚本宝典收集整理的这篇文章主要介绍了 canvas绘制奥运五环代码分享,脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。运行效果:
<!DOCTYPE htML> <html> <head> </head> <body> <canvas id="drawing" width="800" height="600">A drawing of someing!</canvas> <script type="text/javascript">VAR drawing = document.getElementById('drawing');if(drawing.getContext) {//绘制奥运五环,画圆var context = drawing.getContext('2d'); context.lineWidth = 7; context.strokeStyle = '#0180C3'; context.beginPath(); context.arc(70, 70, 40, 0, 2*Math.PI, false); context.stroke(); context.strokeStyle = '#000'; context.beginPath(); context.arc(160, 70, 40, 0, 2*Math.PI, false); context.stroke(); context.strokeStyle = '#BF0628'; context.beginPath(); context.arc(250, 70, 40, 0, 2*Math.PI, false); context.stroke(); context.strokeStyle = '#EBC41F'; context.beginPath(); context.arc(115, 110, 40, 0, 2*Math.PI, false); context.stroke(); context.strokeStyle = '#198E4A'; context.beginPath(); context.arc(205, 110, 40, 0, 2*Math.PI, false); context.stroke();//环环相扣,画弧(实现相关圆弧的覆盖)context.strokeStyle = '#0180C3'; context.beginPath(); context.arc(70, 70, 40, 1.9*Math.PI, 2.1*Math.PI, false); context.stroke(); context.strokeStyle = '#000'; context.beginPath(); context.arc(160, 70, 40, 1.9*Math.PI, 2.1*Math.PI, false); context.stroke(); context.beginPath(); context.arc(160, 70, 40, 0.5*Math.PI, 0.7*Math.PI, false); context.stroke(); context.strokeStyle = '#BF0628'; context.beginPath(); context.arc(250, 70, 40, 0.5*Math.PI, 0.7*Math.PI, false); context.stroke(); }</script> </body> </html>
以上就是 canvas绘制奥运五环代码分享的详细内容,更多请关注脚本宝典其它相关文章!
以上是脚本宝典为你收集整理的 canvas绘制奥运五环代码分享全部内容,希望文章能够帮你解决 canvas绘制奥运五环代码分享所遇到的问题。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。