js实现填涂画板
•
Python
文章目录
- 1实现效果
- 2 实现代码
凑个数,存粹是好玩儿,哈哈…
1实现效果

最上方一栏:
左侧是颜色按钮,点击选中颜色,
中间是功能按钮,重置颜色、清空画板、回退、涂改液(填涂色置为白色)
右侧是显示当前所选颜色
下方填涂板是表格实现的。
2 实现代码
画图板
* {
margin: 0px;
padding: 0px;
}
#bt {
display: flex;
margin-top: 5px;
height: 30px;
box-sizing: border-box;
}
.bt1 {
padding-left: 20px;
flex: 1;
box-sizing: border-box;
}
.bt2 {
flex: 1;
text-align: center;
}
.bt3 {
flex: 1;
font-size: 20px;
}
#content {
margin-top: 10px;
}
table {
border-collapse: collapse;
}
td {
width: 25px;
height: 25px;
border: 0.5px solid gray;
}
td:hover {
background-color: gray;
}
.b1 {
margin-left: 10px;
width: 15px;
height: 15px;
}
.b2 {
margin-right: 10px;
width: 100px;
line-height: 27px;
background-color: lightgray;
border: none;
border-radius: 10px;
}
.b1:hover {
width: 20px;
height: 20px;
}
.b2:hover {
background-color: lightblue;
}
#colorName {
display: inline-block;
color: red;
width: 200px;
height: 30px;
text-align: center;
background-color: gray;
}
当前所选颜色为:rgb(255,0,0)
// 存放改变颜色的td索引
let bakeTable = [];
let div = document.getElementById('content');
let width = 60;
let height = 25;
// 初始化颜色按钮
createColorTable();
// 打印画板
let str = "| "; } str += ' |
本文来自网络,不代表协通编程立场,如若转载,请注明出处:https://www.net2asp.com/4c145aec6f.html
