forked from vishanurag/Canvas-Editor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
about.html
192 lines (157 loc) · 7.04 KB
/
about.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Creative Canvas Tool</title>
<!-- Single bootstrap inclusion to avoid redundancy -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/5.3.0/css/bootstrap.min.css">
<link rel="stylesheet" href="src/Styles/scroll.css">
<!-- External styles -->
<link rel="stylesheet" href="./src/Styles/Style.css">
<link rel="stylesheet" href="./src/Styles/Responsive.css">
<!-- Font Awesome icons -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.6.0/css/all.min.css"
integrity="sha512-Kc323vGBEqzTmouAECnVceyQqyqdsSiqLQISBL29aUW4U/M7pSPA/gEUZQqv1cwx4OnYxTxve5UMg5GT6L4JJg=="
crossorigin="anonymous" referrerpolicy="no-referrer" />
<style>
body {
background-color: #eef1f5;
font-family: 'Arial', sans-serif;
}
.container {
max-width: 1200px;
margin: 0 auto;
color: black;
}
.canvas-container {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
background: #ffffff;
border-radius: 10px;
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
padding: 20px;
}
#mainCanvas {
width: 100%;
height: 60vh; /* Responsive height */
border: 2px solid #007bff;
border-radius: 10px;
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
background-color: #f0f0f0; /* Default background color */
}
.btn {
margin: 5px;
transition: background-color 0.3s, transform 0.2s;
}
.btn:hover {
background-color: #0056b3;
color: white;
transform: scale(1.05);
}
.btn:active {
transform: scale(0.95);
}
.palette {
margin: 15px 0;
text-align: center;
}
.form-control {
border-radius: 5px;
}
</style>
</head>
<body>
<!-- Preloader HTML omitted for brevity -->
<div class="container">
<div class="header text-center">
<h1 class="display-4" ">
<img src="download (1).png" style="height: 100px; width: auto;
border-radius: 50px 50px 50px 50px ; margin-right: 70px;">
<a href="/" style="color: inherit; text-decoration: none;margin-bottom: 50px;">Creative Canvas Tool Build the future</a>
</h1>
<br>
<h3 class="lead"> Introducing Creative Canvas: a dynamic tool designed to unleash your
imagination and elevate your creative projects! Whether you’re an artist, designer, or simply someone who loves to explore ideas, Creative Canvas provides a flexible platform where you can sketch, brainstorm, and bring your visions to life. With intuitive features and an array of customizable templates, you can easily collaborate with others or work solo to refine your concepts. Dive into a world of creativity and let your ideas flow freely on your digital canvas!
</h3>
</div>
<!-- Canvas Section -->
<div class="canvas-container">
<canvas id="mainCanvas"></canvas>
</div>
</div>
<script>
document.addEventListener("DOMContentLoaded", function () {
const canvas = document.getElementById('mainCanvas');
const ctx = canvas.getContext('2d');
// Set canvas dimensions dynamically based on window size
function setCanvasSize() {
canvas.width = window.innerWidth * 0.8;
canvas.height = window.innerHeight * 0.5;
}
window.addEventListener('resize', setCanvasSize);
setCanvasSize(); // Set the initial canvas size
let history = [];
let redoStack = [];
// Function to save the canvas state
function saveCanvasState() {
history.push(ctx.getImageData(0, 0, canvas.width, canvas.height));
redoStack = [];
if (history.length > 10) history.shift(); // Limit history to 10 states
}
// Function to set the canvas background color
function setCanvasBackgroundColor(color) {
ctx.fillStyle = color;
ctx.fillRect(0, 0, canvas.width, canvas.height);
saveCanvasState(); // Save state after setting the background color
}
// Initial background color
const bgColorPicker = document.getElementById('bgColorPicker');
bgColorPicker && setCanvasBackgroundColor(bgColorPicker.value);
// Background color change event
bgColorPicker?.addEventListener('input', function() {
setCanvasBackgroundColor(this.value);
});
// Add text functionality
document.getElementById('addText')?.addEventListener('click', function() {
const textData = document.getElementById('textData').value;
const textSize = document.getElementById('textSize').value;
const textColor = document.getElementById('colorPicker').value;
const x = 50; // Default text x position, make customizable
const y = 50; // Default text y position, make customizable
if (textData) {
saveCanvasState();
ctx.fillStyle = textColor;
ctx.font = `${textSize}px Arial`;
ctx.fillText(textData, x, y); // Position text on canvas
document.getElementById('textData').value = '';
} else {
alert('Please enter some text!');
}
});
// Upload image functionality (completed function)
document.getElementById('uploadImage')?.addEventListener('click', function() {
const input = document.createElement('input');
input.type = 'file';
input.accept = 'image/*';
input.onchange = function(e) {
const file = e.target.files[0];
const reader = new FileReader();
reader.onload = function(event) {
const img = new Image();
img.onload = function() {
ctx.drawImage(img, 0, 0, canvas.width, canvas.height);
saveCanvasState(); // Save state after uploading image
};
img.src = event.target.result;
};
reader.readAsDataURL(file);
};
input.click();
});
});
</script>
</body>
</html>