当前位置: 首页 > news >正文

网站建设 文章WordPress二级目录404

网站建设 文章,WordPress二级目录404,放心网站推广优化咨询,南昌房产网官网画板实现的效果#xff1a;可以切换画笔的粗细#xff0c;颜色#xff0c;还可以使用橡皮擦#xff0c;还可以清除画布#xff0c;然后将画的内容保存下载成一张图片#xff1a; 具体用到的canvas功能有#xff1a;画笔的粗细调整lineWidth#xff0c;开始一个新的画笔…画板实现的效果可以切换画笔的粗细颜色还可以使用橡皮擦还可以清除画布然后将画的内容保存下载成一张图片 具体用到的canvas功能有画笔的粗细调整lineWidth开始一个新的画笔路径beginPath结束一个画笔路径closePath这个可以保证不影响之前画的效果重新开始一个画笔路径。 还有橡皮擦使用的ctx.globalCompositeOperation destination-out属性清空画布使用的ctx.clearRect(0, 0, canvas.width, canvas.height)保存图片使用的是let url canvas.toDataURL(image/png)。 完整的代码如下 !DOCTYPE html html langenheadmeta charsetUTF-8 /meta nameviewport contentwidthdevice-width, initial-scale1.0 /title像素操作/titlestyle.active {background-color: #f2a1a1;}/style/headbodydiv创建一个画布可以使用画笔随意画画/divdiv stylewidth: 800px; margin-top: 6pxbutton classbold粗线条/buttonbutton classthin细线条/buttoninput idcolor typecolor /button classdel橡皮擦/buttonbutton classclear清空画布/buttonbutton classsave保存图片/buttonhr /canvas idmyCanvas width800 height600/canvas/divscript// 获取画布const canvas document.getElementById(myCanvas)// 获取画笔const ctx canvas.getContext(2d)// 让画笔的拐弯处更加圆润没有锯齿感ctx.lineCap roundctx.lineJoin round// 获取控制按钮const bold document.querySelector(.bold)const thin document.querySelector(.thin)const color document.querySelector(#color)const del document.querySelector(.del)const clear document.querySelector(.clear)const save document.querySelector(.save)// 添加点击事件bold.onclick function () {ctx.lineWidth 20bold.classList.add(active)thin.classList.remove(active)del.classList.remove(active)clear.classList.remove(active)save.classList.remove(active)}thin.onclick function () {ctx.lineWidth 5thin.classList.add(active)bold.classList.remove(active)del.classList.remove(active)clear.classList.remove(active)save.classList.remove(active)}color.onchange function (e) {console.log(颜色改变了:, e.target.value)ctx.strokeStyle e.target.value}del.onclick function () {console.log(橡皮擦)ctx.globalCompositeOperation destination-outctx.lineWidth 30del.classList.add(active)bold.classList.remove(active)thin.classList.remove(active)clear.classList.remove(active)save.classList.remove(active)}clear.onclick function () {console.log(清空画布)ctx.clearRect(0, 0, canvas.width, canvas.height)}// 保存图片save.onclick function () {console.log(保存图片)let url canvas.toDataURL(image/png)let a document.createElement(a)a.href urla.download canvas.pnga.click()}// 监听画布画画事件let mouseDown false// 鼠标按下将变量设置为truecanvas.onmousedown function (e) {ctx.beginPath()mouseDown truectx.moveTo(e.offsetX, e.offsetY)}// 鼠标抬起将变量设置为falsecanvas.onmouseup function () {mouseDown falsectx.closePath()ctx.globalCompositeOperation source-over}canvas.onmouseleave function () {mouseDown falsectx.closePath()}// 鼠标移动canvas.onmousemove function (e) {if (mouseDown) {console.log(鼠标移动)ctx.lineTo(e.offsetX, e.offsetY)ctx.stroke()}}/script/body /html
http://www.hkea.cn/news/14561912/

相关文章:

  • 优酷的网站头怎么做的2018建设工程管理招团支部网站
  • 高新快速建设网站找哪家wordpress设置用户头像
  • 网站开发软件开发流程东莞网络推广哪家公司奿
  • 网站如何做邮箱订阅做wordpress 下载站
  • 怎样创立一个网站百度竞价推广开户费用
  • 国外木屋建设网站重庆网站建设网站制作
  • 响应式衣柜网站dw做简单小说网站
  • 广州网站设计首选刻电子工程师有前途吗
  • 百度官方网站登录国内很多网站不是响应式
  • 淘客怎么做网站辽宁建设工程信息网怎么查人员
  • 福田做棋牌网站建设哪家技术好青岛公司注册
  • 网站建设公司(深圳信科)本地做的网站如何映射出去
  • 装修设计网站哪个好用奉贤免费网站建设
  • 做料理网站关键词怎么设置长春公司网站建设
  • 电脑软件下载官方网站还有多少用.net做网站的
  • 微信网站特点自学平面设计入门教程
  • 深圳做微信商城网站西安网站设计试听
  • 电子商务网站平台建设协会类网站免费模板
  • 400套商业网站的静态模板巩义做网站哪家好
  • html5餐饮美食订餐微官网wap手机网站模板整站下载模板做的网站不好优化
  • 如何免费搭建自己的网站阿里网站建设
  • 怎么制作网站域名网站备案需要什么东西
  • 做网站每年需要多少维护费Sql 发wordpress
  • 链家二手房官网关键字排名优化公司
  • 如何推广自己的个人网站呢装修案例实景图
  • 中国农业工程建设协会网站图片设计用什么软件
  • 做本地化的返利网站怎么样泰州网站制作网站
  • 做网站要买什么空间php网站开发第三章
  • 网站建设公司有哪些方面如何发布网站教程
  • 清爽网站模板网站上传 文件夹结构