js+css实现在线ps图片编辑修改代码
代码语言:html
所属分类:其他
代码描述:做个在线图片编辑ps工具网页
代码标签: js+css实现在线 ps 图片 编辑 修改 代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Canvas Photoshop - 图像编辑器</title>
<style>
:root {
--bg: #1e1e1e;
--panel: #2d2d2d;
--border: #3a3a3a;
--text: #ccc;
--text-bright: #fff;
--accent: #4a90d9;
--accent-hover: #5aa0e9;
--danger: #c0392b;
--tool-bg: #252525;
--tool-hover: #333;
--tool-active: #3a3a3a;
--input-bg: #1a1a1a;
--scrollbar: #555;
--font: 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
--radius: 6px;
--shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
background: #121212;
font-family: var(--font);
height: 100vh;
display: flex;
flex-direction: column;
overflow: hidden;
user-select: none;
-webkit-user-select: none;
}
/* 顶部菜单栏 */
.menubar {
background: var(--panel);
border-bottom: 1px solid var(--border);
display: flex;
align-items: center;
padding: 0 8px;
height: 36px;
gap: 2px;
z-index: 100;
flex-shrink: 0;
}
.menubar .brand {
font-weight: 700;
color: var(--accent);
margin-right: 16px;
font-size: 0.9rem;
letter-spacing: -0.02em;
white-space: nowrap;
}
.menu-btn {
background: none;
border: none;
color: var(--text);
padding: 6px 12px;
cursor: pointer;
border-radius: 4px;
font-size: 0.8rem;
font-family: var(--font);
white-space: nowrap;
transition: background 0.15s;
}
.menu-btn:hover {
background: var(--tool-hover);
color: var(--text-bright);
}
.menu-btn.active {
background: var(--accent);
color: #fff;
}
.sep {
width: 1px;
height: 20px;
background: var(--border);
margin: 0 6px;
}
/* 主体布局 */
.main-area {
display: flex;
flex: 1;
overflow: hidden;
position: relative;
}
/* 左侧工具栏 */
.toolbar {
width: 52px;
background: var(--tool-bg);
border-right: 1px solid var(--border);
display: flex;
flex-direction: column;
align-items: center;
padding: 8px 4px;
gap: 3px;
flex-shrink: 0;
z-index: 50;
overflow-y: auto;
}
.tool-btn {
width: 40px;
height: 40px;
border-radius: var(--radius);
border: 2px solid transparent;
background: transparent;
color: #aaa;
cursor: pointer;
font-size: 1.2rem;
display: flex;
align-items: center;
justify-content: center;
transition: all 0.15s;
position: relative;
flex-shrink: 0;
}
.tool-btn:hover {
background: var(--tool-hover);
color: #ddd;
}
.tool-btn.active {
background: var(--tool-active);
border-color: var(--accent);
color: #fff;
box-shadow: 0 0 8px rgba(74, 144, 217, 0.3);
}
.tool-btn .tip {
display: none;
position: absolute;
left: 48px;
background: #000;
color: #fff;
padding: 4px 10px;
border-radius: 4px;
font-size: 0.7rem;
white-space: nowrap;
z-index: 200;
pointer-events: none;
}
.tool-btn:hover .tip {
display: block;
}
.tool-spacer {
flex: 1;
min-height: 8px;
}
/* 画布容器 */
.canvas-container {
flex: 1;
display: flex;
align-items: center;
justify-content: center;
background: #1a1a1a;
background-image: repeating-conic-gradient(#2a2a2a 0% 25%, #222 0% 50%);
background-size: 20px 20px;
position: relative;
overflow: hidden;
cursor: crosshair;
}
.canvas-container.crop-mode {
cursor: crosshair;
}
.canvas-container.pan-mode {
cursor: grab;
}
.canvas-wrap {
position: relative;
box-shadow: 0 0 40px rgba(0, 0, 0, 0.6);
display: flex;
align-items: center;
justify-content: center;
}
canvas#mainCanvas {
display: block;
image-rendering: auto;
}
canvas#overlayCanvas {
position: absolute;
top: 0;
left: 0;
pointer-events: none;
z-index: 10;
}
.canvas-wrap.crop-active canvas#overlayCanvas {
pointer-events: auto;
}
/* 右侧面板 */
.right-panel {
width: 240px;
background: var(--panel);
border-left: 1px solid var(--border);
display: flex;
flex-direction: column;
flex-shrink: 0;
z-index: 50;
overflow: hidden;
}
.panel-section {
padding: 10px 12px;
border-bottom: 1px solid var(--border);
}
.panel-title {
font-size: 0.75rem;
font-weight: 600;
color: #999;
text-transform: uppercase;
letter-spacing: 0.05em;
margin-bottom: 8px;
}
.layer-list {
flex: 1;
overflow-y: auto;
padding: 4px 0;
min-height: 120px;
max-height: 40vh;
}
.layer-item {
display: flex;
align-items: center;
gap: 8px;
padding: 6px 10px;
cursor: pointer;
border: 2px solid transparent;
border-radius: 4px;
margin: 2px 6px;
transition: all 0.12s;
font-size: 0.78rem;
color: var(--text);
background: var(--tool-bg);
}
.layer-item:hover {
background: var(--tool-hover);
}
.layer-item.active {
border-color: var(--accent);
background: #2a3550;
color: #fff;
}
.layer-thumb {
width: 36px;
height: 36px;
.........完整代码请登录后点击上方下载按钮下载查看















网友评论0