vue实现一个简单的画板功能代码

代码语言:html

所属分类:其他

代码描述:vue实现一个简单的画板功能代码,可设置笔触颜色及粗细,还可撤销与保存。

代码标签: vue 画板

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html lang="en" >

<head>
  <meta charset="UTF-8">
  
<link type="text/css" rel="stylesheet" href="//repo.bfw.wiki/bfwrepo/css/ionicons.min.css">
  
<style>
@import url("https://fonts.googleapis.com/css?family=Roboto:300,400,500");
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: black;
  color: white;
}

body,
button,
input {
  font-family: "Roboto", sans-serif;
  font-size: 14px;
  font-weight: 400;
}

h1,
h2,
h3,
h4,
h5 {
  font-weight: 500;
}

.text-faded {
  opacity: 0.5;
}

.cursor {
  position: fixed;
  top: 0;
  left: 0;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 3px solid #1e1e1e;
  pointer-events: none;
  -webkit-user-select: none;
     -moz-user-select: none;
      -ms-user-select: none;
          user-select: none;
  mix-blend-mode: difference;
  opacity: 0;
  transition: opacity 1s;
}

canvas {
  width: 100%;
  height: calc(100vh - 60px);
  background-color: white;
  cursor: none;
}
canvas:hover + .cursor {
  opacity: 1;
}
canvas:active + .cursor {
  border-color: #3c3c3c;
}

.controls {
  position: fixed;
  z-index: 5;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 60px;
  background-color: #0a0a0a;
  display: flex;
  justify-content: center;
  align-items: center;
  -webkit-user-select: none;
     -moz-user-select: none;
      -ms-user-select: none;
          user-select: none;
}

.stat {
  font-size: 20px;
  margin-bottom: 15px;
}

.btn-row {
  position: relative;
  margin-bottom: 5px;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  padding: 0 15px;
  border-radius: 4px;
}

.popup {
  position: absolute;
  width: 300px;
  bottom: 58px;
  padding: 30px;
  left: calc(50% - 150px);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  background-color: white;
  color: #1e1e1e;
  border-radius: 10px 10px 0 0;
  border: 1px solid gainsboro;
  border-bottom-width: 0;
  opacity: 0;
  -webkit-animation: popup 0.5s forwards cubic-bezier(0.2, 2, 0.4, 1);
          animatio.........完整代码请登录后点击上方下载按钮下载查看

网友评论0