js实现canvas物理重力感应拖拽模拟反馈交互效果代码
代码语言:html
所属分类:拖放
代码描述:js实现canvas物理重力感应拖拽模拟反馈交互效果代码,单击鼠标左键选择一个关键点可进行拖动。
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<style>
* {
margin: 0;
overflow:hidden;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
-o-user-select: none;
user-select: none;
}
body {
background:#333;
}
canvas {
background:#333;
width:1000px;
height:340px;
margin:0 auto;
display:block;
border:1px dashed #555;
border-top:none;
}
#info {
position:absolute;
left:-1px;
top:-1px;
width:auto;
max-width:380px;
height:auto;
background:#f2f2f2;
border-bottom-right-radius:10px;
}
#top {
background:#fff;
width:100%;
height:auto;
position:relative;
border-bottom:1px solid #eee;
}
p {
font-family:Arial, sans-serif;
color:#666;
text-align:justify;
font-size: 16px;
line-height:22px;
margin:10px;
}
a {
font-family:sans-serif;
color:#444;
text-decoration:none;
font-size: 20px;
}
#site {
float:left;
margin: 10px;
color: #38a;
border-bottom: 1px dashed #bbf;
padding-bottom:3px
}
#close {
float:right;
margin: 10px;
}
</style>
</head>
<body>
<canvas id="c"></canvas>
<div id="info">
<div id="top">
<a id="close" href="">×</a>
</div>
<p>
- 单击鼠标左键拖动点(角点、关节等).<br> - 单击鼠标右键可删除点.<br> - 按住ctrl键可进入编辑模式,松开可退出.<br><br>
<strong>处于编辑模式的时候:</strong><br> -单击以添加点,按住alt键以生成固定点.<br> -默认情况下,新点将连接到最后一个点.<br> - 按shift键取消选择点.<br> -选择任意两个点以连接它们.&.........完整代码请登录后点击上方下载按钮下载查看
















网友评论0