-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebsitemockupdesigntool.html
More file actions
413 lines (384 loc) · 17.5 KB
/
websitemockupdesigntool.html
File metadata and controls
413 lines (384 loc) · 17.5 KB
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
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Modern Mockup Generator - Create Stunning Website Mockups Online</title>
<meta name="description" content="Generate professional website mockups online for free. Use our modern mockup generator to create stunning designs for iPhone, MacBook, iPad, and more.">
<meta name="keywords" content="website mockup, mockup generator, online mockup tool, free mockup, iPhone mockup, MacBook mockup, iPad mockup, design mockup">
<meta name="author" content="Your Company Name">
<meta name="robots" content="index, follow">
<!-- Canonical URL -->
<link rel="canonical" href="https://dev-nayanray.github.io/mockup-generator">
<!-- Open Graph Tags for Social Media -->
<meta property="og:title" content="Modern Mockup Generator - Create Stunning Website Mockups Online">
<meta property="og:description" content="Generate professional website mockups online for free. Use our modern mockup generator to create stunning designs for iPhone, MacBook, iPad, and more.">
<meta property="og:image" content="https://dev-nayanray.github.io/images/mockup-generator-thumbnail.jpg">
<meta property="og:url" content="https://dev-nayanray.github.io/mockup-generator">
<!-- Twitter Card Tags -->
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:title" content="Modern Mockup Generator - Create Stunning Website Mockups Online">
<meta name="twitter:description" content="Generate professional website mockups online for free. Use our modern mockup generator to create stunning designs for iPhone, MacBook, iPad, and more.">
<meta name="twitter:image" content="https://dev-nayanray.github.io/images/mockup-generator-thumbnail.jpg">
<!-- Tailwind CSS CDN -->
<script src="https://cdn.tailwindcss.com"></script>
<!-- Structured Data (Schema Markup) -->
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "WebApplication",
"name": "Modern Mockup Generator",
"description": "Generate professional website mockups online for free. Use our modern mockup generator to create stunning designs for iPhone, MacBook, iPad, and more.",
"applicationCategory": "Design Tool",
"operatingSystem": "Web",
"url": "https://dev-nayanray.github.io/mockup-generator",
"image": "https://dev-nayanray.github.io/images/mockup-generator-thumbnail.jpg",
"offers": {
"@type": "Offer",
"price": "0",
"priceCurrency": "USD"
}
}
</script>
<style>
/* Custom styles for modern design */
.mockup-frame {
position: relative;
background-size: contain;
background-repeat: no-repeat;
background-position: center;
}
/* Loading spinner */
.loader {
border: 4px solid #f3f3f3;
border-top: 4px solid #3498db;
border-radius: 50%;
width: 40px;
height: 40px;
animation: spin 1s linear infinite;
}
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
/* Drag and drop area */
.drop-zone {
border: 2px dashed #ccc;
border-radius: 12px;
padding: 40px;
text-align: center;
cursor: pointer;
transition: border-color 0.3s ease, background-color 0.3s ease;
background-color: #f9fafb;
}
.drop-zone.dragover {
border-color: #3b82f6;
background-color: #eef2ff;
}
.drop-zone:hover {
border-color: #3b82f6;
}
/* Frame buttons */
.frame-button {
transition: transform 0.2s ease, box-shadow 0.2s ease;
border: 1px solid #e5e7eb;
background-color: #ffffff;
}
.frame-button:hover {
transform: translateY(-5px);
box-shadow: 0 10px 15px rgba(0, 0, 0, 0.1);
border-color: #3b82f6;
}
.frame-button.active {
border-color: #3b82f6;
background-color: #eff6ff;
}
/* Canvas styling */
.mockup-canvas {
box-shadow: 0 10px 15px rgba(0, 0, 0, 0.1);
border-radius: 12px;
background-color: #ffffff;
}
/* Buttons */
.action-button {
transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.action-button:hover {
transform: translateY(-2px);
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}
</style>
</head>
<body class="bg-gray-50 flex items-center justify-center min-h-screen">
<div class="bg-white p-8 rounded-xl shadow-lg w-full max-w-6xl mx-4">
<h1 class="text-4xl font-bold text-center mb-8 text-gray-900">Modern Mockup Generator</h1>
<h2 class="text-2xl text-center mb-6 text-gray-700">Create Stunning Website Mockups Online</h2>
<!-- Upload Section -->
<div class="mb-8">
<label for="imageUpload" class="block text-sm font-medium text-gray-700 mb-2">Upload Your Image</label>
<div id="imageDropZone" class="drop-zone">
<span class="text-gray-600">Drag & Drop or Click to Upload Image</span>
<input type="file" id="imageUpload" accept="image/*" class="hidden">
</div>
</div>
<!-- Mockup Frame Selection (Hidden by Default) -->
<div id="frameSelection" class="hidden grid grid-cols-2 md:grid-cols-5 gap-4 mb-8">
<!-- Default Frames -->
<button data-frame="iphone" class="frame-button p-4 rounded-lg hover:bg-gray-50 focus:ring-2 focus:ring-blue-500">
<img src="https://cdn-icons-png.flaticon.com/512/0/747.png" alt="iPhone Mockup Generator" class="w-12 h-12 mx-auto">
<span class="text-sm mt-2 text-gray-700">iPhone</span>
</button>
<button data-frame="macbook" class="frame-button p-4 rounded-lg hover:bg-gray-50 focus:ring-2 focus:ring-blue-500">
<img src="https://cdn-icons-png.flaticon.com/512/0/191.png" alt="MacBook Mockup Generator" class="w-12 h-12 mx-auto">
<span class="text-sm mt-2 text-gray-700">MacBook</span>
</button>
<button data-frame="ipad" class="frame-button p-4 rounded-lg hover:bg-gray-50 focus:ring-2 focus:ring-blue-500">
<img src="https://cdn-icons-png.flaticon.com/512/0/327.png" alt="iPad Mockup Generator" class="w-12 h-12 mx-auto">
<span class="text-sm mt-2 text-gray-700">iPad</span>
</button>
<button data-frame="monitor" class="frame-button p-4 rounded-lg hover:bg-gray-50 focus:ring-2 focus:ring-blue-500">
<img src="https://cdn-icons-png.flaticon.com/512/0/175.png" alt="Monitor Mockup Generator" class="w-12 h-12 mx-auto">
<span class="text-sm mt-2 text-gray-700">Monitor</span>
</button>
<button data-frame="poster" class="frame-button p-4 rounded-lg hover:bg-gray-50 focus:ring-2 focus:ring-blue-500">
<img src="https://cdn-icons-png.flaticon.com/512/0/488.png" alt="Poster Mockup Generator" class="w-12 h-12 mx-auto">
<span class="text-sm mt-2 text-gray-700">Poster</span>
</button>
</div>
<!-- Mockup Preview Section -->
<div id="mockupPreview" class="hidden mockup-container mb-8 flex justify-center">
<canvas id="mockupCanvas" class="mockup-canvas border border-gray-200" width="800" height="600"></canvas>
</div>
<!-- Loading Spinner -->
<div id="loadingSpinner" class="hidden justify-center mb-8">
<div class="loader"></div>
</div>
<!-- Buttons (Hidden by Default) -->
<div id="actionButtons" class="hidden flex justify-center gap-4">
<button id="previewMockup" class="action-button px-6 py-2 bg-blue-500 text-white rounded-lg hover:bg-blue-600">Preview Mockup</button>
<button id="generateMockup" class="action-button px-6 py-2 bg-green-500 text-white rounded-lg hover:bg-green-600">Generate Mockup</button>
<a id="downloadLink" download="mockup.png" class="action-button px-6 py-2 bg-purple-500 text-white rounded-lg hover:bg-purple-600 hidden">Download Mockup</a>
</div>
<!-- Internal Links -->
<div class="text-center mt-8">
<a href="features.html" class="text-blue-500 hover:underline">Explore More Features</a> |
<a href="mockuptemplate.html" class="text-blue-500 hover:underline">Browse Mockup Templates</a>
</div>
</div>
<script>
// JavaScript for handling mockup generation
const imageUpload = document.getElementById('imageUpload');
const imageDropZone = document.getElementById('imageDropZone');
const frameSelection = document.getElementById('frameSelection');
const mockupPreview = document.getElementById('mockupPreview');
const mockupCanvas = document.getElementById('mockupCanvas');
const ctx = mockupCanvas.getContext('2d');
const previewMockupBtn = document.getElementById('previewMockup');
const generateMockupBtn = document.getElementById('generateMockup');
const downloadLink = document.getElementById('downloadLink');
const loadingSpinner = document.getElementById('loadingSpinner');
const actionButtons = document.getElementById('actionButtons');
const frameButtons = document.querySelectorAll('[data-frame]');
let selectedFrame = 'iphone'; // Default frame
let uploadedImage = null; // Image uploaded by the user
// Define screen areas for each frame
const frameScreenAreas = {
iphone: { x: 120, y: 70, width: 560, height: 960 },
macbook: { x: 120, y: 70, width: 560, height: 360 },
ipad: { x: 120, y: 70, width: 560, height: 760 },
monitor: { x: 120, y: 70, width: 560, height: 360 },
poster: { x: 100, y: 50, width: 600, height: 800 }
};
// Handle frame selection
frameButtons.forEach(button => {
button.addEventListener('click', () => {
frameButtons.forEach(btn => btn.classList.remove('active'));
button.classList.add('active');
selectedFrame = button.getAttribute('data-frame');
updateMockup();
});
});
// Handle image upload
imageUpload.addEventListener('change', (event) => {
const file = event.target.files[0];
if (file) {
loadImage(file).then(img => {
uploadedImage = img;
frameSelection.classList.remove('hidden');
actionButtons.classList.remove('hidden');
updateMockup();
});
}
});
// Drag and drop functionality
function setupDropZone(dropZone, input) {
dropZone.addEventListener('dragover', (e) => {
e.preventDefault();
dropZone.classList.add('dragover');
});
dropZone.addEventListener('dragleave', () => {
dropZone.classList.remove('dragover');
});
dropZone.addEventListener('drop', (e) => {
e.preventDefault();
dropZone.classList.remove('dragover');
const file = e.dataTransfer.files[0];
if (file) {
input.files = e.dataTransfer.files;
loadImage(file).then(img => {
uploadedImage = img;
frameSelection.classList.remove('hidden');
actionButtons.classList.remove('hidden');
updateMockup();
});
}
});
dropZone.addEventListener('click', () => input.click());
}
setupDropZone(imageDropZone, imageUpload);
// Load image from file
function loadImage(file) {
return new Promise((resolve, reject) => {
const img = new Image();
img.src = URL.createObjectURL(file);
img.onload = () => resolve(img);
img.onerror = reject;
});
}
// Draw frame on canvas
function drawFrame(frame) {
ctx.clearRect(0, 0, mockupCanvas.width, mockupCanvas.height);
// Draw frame based on selection
switch (frame) {
case 'iphone':
drawiPhoneFrame();
break;
case 'macbook':
drawMacBookFrame();
break;
case 'ipad':
drawiPadFrame();
break;
case 'monitor':
drawMonitorFrame();
break;
case 'poster':
drawPosterFrame();
break;
default:
break;
}
// Draw uploaded image inside the frame's screen area
if (uploadedImage) {
const screenArea = frameScreenAreas[frame];
const scale = Math.min(screenArea.width / uploadedImage.width, screenArea.height / uploadedImage.height);
const width = uploadedImage.width * scale;
const height = uploadedImage.height * scale;
const x = screenArea.x + (screenArea.width - width) / 2;
const y = screenArea.y + (screenArea.height - height) / 2;
ctx.drawImage(uploadedImage, x, y, width, height);
}
}
// Frame designs
function drawiPhoneFrame() {
// iPhone body with gradient and shadow
ctx.beginPath();
ctx.roundRect(100, 50, 600, 1000, 50); // Rounded corners
ctx.fillStyle = '#1c1c1e'; // Dark gray
ctx.fill();
ctx.shadowColor = 'rgba(0, 0, 0, 0.5)';
ctx.shadowBlur = 20;
ctx.shadowOffsetX = 10;
ctx.shadowOffsetY = 10;
// Screen area
ctx.beginPath();
ctx.roundRect(120, 70, 560, 960, 30); // Rounded corners
ctx.fillStyle = '#000'; // Black screen
ctx.fill();
}
function drawMacBookFrame() {
// MacBook base with gradient and shadow
ctx.beginPath();
ctx.roundRect(100, 50, 600, 400, 20); // Rounded corners
ctx.fillStyle = '#d1d1d6'; // Light gray
ctx.fill();
ctx.shadowColor = 'rgba(0, 0, 0, 0.5)';
ctx.shadowBlur = 20;
ctx.shadowOffsetX = 10;
ctx.shadowOffsetY = 10;
// Screen area
ctx.beginPath();
ctx.roundRect(120, 70, 560, 360, 10); // Rounded corners
ctx.fillStyle = '#000'; // Black screen
ctx.fill();
}
function drawiPadFrame() {
// iPad body with gradient and shadow
ctx.beginPath();
ctx.roundRect(100, 50, 600, 800, 40); // Rounded corners
ctx.fillStyle = '#f2f2f7'; // Light gray
ctx.fill();
ctx.shadowColor = 'rgba(0, 0, 0, 0.5)';
ctx.shadowBlur = 20;
ctx.shadowOffsetX = 10;
ctx.shadowOffsetY = 10;
// Screen area
ctx.beginPath();
ctx.roundRect(120, 70, 560, 760, 20); // Rounded corners
ctx.fillStyle = '#000'; // Black screen
ctx.fill();
}
function drawMonitorFrame() {
// Monitor base with gradient and shadow
ctx.beginPath();
ctx.roundRect(100, 50, 600, 400, 10); // Rounded corners
ctx.fillStyle = '#2c2c2e'; // Dark gray
ctx.fill();
ctx.shadowColor = 'rgba(0, 0, 0, 0.5)';
ctx.shadowBlur = 20;
ctx.shadowOffsetX = 10;
ctx.shadowOffsetY = 10;
// Screen area
ctx.beginPath();
ctx.roundRect(120, 70, 560, 360, 5); // Rounded corners
ctx.fillStyle = '#000'; // Black screen
ctx.fill();
}
function drawPosterFrame() {
// Poster background with shadow
ctx.beginPath();
ctx.roundRect(100, 50, 600, 800, 10); // Rounded corners
ctx.fillStyle = '#fff'; // White background
ctx.fill();
ctx.shadowColor = 'rgba(0, 0, 0, 0.5)';
ctx.shadowBlur = 20;
ctx.shadowOffsetX = 10;
ctx.shadowOffsetY = 10;
// Poster border
ctx.strokeStyle = '#000';
ctx.lineWidth = 10;
ctx.strokeRect(100, 50, 600, 800);
}
// Update mockup
function updateMockup() {
if (!uploadedImage) return;
drawFrame(selectedFrame);
}
// Preview mockup
previewMockupBtn.addEventListener('click', () => {
mockupPreview.classList.remove('hidden');
updateMockup();
});
// Generate mockup
generateMockupBtn.addEventListener('click', () => {
loadingSpinner.classList.remove('hidden');
mockupCanvas.toBlob(blob => {
const url = URL.createObjectURL(blob);
downloadLink.href = url;
downloadLink.classList.remove('hidden');
loadingSpinner.classList.add('hidden');
}, 'image/png');
});
</script>
</body>
</html>