Javascript, HTML, CSS Code
Copy
<html>
<head>
<script type="text/javascript"> window.addEventListener('error', function(event) { var message = JSON.parse(JSON.stringify(event.message)); var source = event.filename; var lineno = event.lineno; var colno = event.colno; var error = event.error; window.parent.postMessage({ type: 'iframeError', details: { message: message, source: source, lineno: lineno, colno: colno, error: error ? error.stack : '' } }, '*'); }); window.addEventListener('unhandledrejection', function(event) { window.parent.postMessage({ type: 'iframePromiseRejection', details: { reason: event.reason } }, '*'); }); </script>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>CinePaint Prototype - Unified Conceptual Code</title>
<meta name="description" content="CinePaint is a prototype for a painting application with advanced brush definitions, layered canvas, and shader-based rendering for artistic effects.">
<meta name="keywords" content="CinePaint, Painting App, Brushes, Canvas, Layer Management, Shader, OpenGL">
<style>
body {
background-color: #f0f0f0;
color: #333333;
font-family: 'Roboto', sans-serif;
}
#main-container {
display: flex;
flex-direction: column;
align-items: center;
margin-top: 20px;
}
h1 {
color: #4a90e2;
}
#canvas {
border: 2px solid #4a90e2;
background-color: white;
width: 1000px;
height: 600px;
cursor: crosshair;
}
.btn {
margin: 5px;
padding: 10px 20px;
border-radius: 5px;
border: none;
color: white;
background: linear-gradient(270deg, #ff9d00, #ff5e02);
transition: background-color 0.3s;
}
.btn:hover {
background: linear-gradient(270deg, #ff5e02, #ff9d00);
}
</style>
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;700&display=swap" rel="stylesheet">
<link rel="canonical" href="https://calculator.tools/prompt/10394/">
<meta charset="utf-8">
</head>
<body>
<div id="main-container">
<h1>CinePaint Prototype</h1>
<canvas id="canvas"></canvas>
<button class="btn" onclick="loadBrushes()">Load Brushes</button>
<button class="btn" onclick="addLayer()">Add Layer</button>
<button class="btn" onclick="applyShaderEffects()">Apply Effects</button>
</div>
<script type="text/javascript">
let layers = [{name: "Background", opacity: 1}, {name: "Layer 1", opacity: 1}];
let activeBrush = {name: "WatercolorSoft", type: "watercolor", size: 10, opacity: 1};
const canvas = document.getElementById("canvas");
const ctx = canvas.getContext("2d");
let isDrawing = false;
let lastX = 0;
let lastY = 0;
canvas.addEventListener("mousedown", (e) => {
isDrawing = true;
lastX = e.offsetX;
lastY = e.offsetY;
draw(e.offsetX, e.offsetY);
});
canvas.addEventListener("mousemove", (e) => {
if(isDrawing) {
draw(e.offsetX, e.offsetY);
lastX = e.offsetX;
lastY = e.offsetY;
}
});
canvas.addEventListener("mouseup", () => isDrawing = false);
canvas.addEventListener("mouseout", () => isDrawing = false);
function draw(x, y) {
ctx.strokeStyle = activeBrush.type === "watercolor" ? `rgba(255, 165, 0, ${activeBrush.opacity})` : '#000000';
ctx.lineWidth = activeBrush.size;
ctx.beginPath();
ctx.moveTo(lastX, lastY);
ctx.lineTo(x, y);
ctx.stroke();
ctx.closePath();
}
function loadBrushes() {
// Load brushes from resource
alert("Brushes loaded. Active brush: " + activeBrush.name);
}
function addLayer() {
const layerName = `Layer ${layers.length + 1}`;
layers.push({name: layerName, opacity: 1});
alert(`Added layer: ${layerName}`);
}
function applyShaderEffects() {
// Simulate applying shader effects
alert("Applying cinematic effects to canvas!");
}
</script>
<script type="text/javascript"> var localStoragePrefix = "ct-{{ cachebreaker }}"; var lastSave = 0; function saveLocal(data) { if (Date.now() - lastSave < 1000) { return; } let cookie = localStoragePrefix + "=" + JSON.stringify(data) + "; path=" + window.location.pathname + "'; SameSite=Strict"; cookie += "; expires=" + new Date(Date.now() + 1000 * 60 * 60 * 24 * 365 * 1000).toUTCString(); document.cookie = cookie; lastSave = Date.now(); } function loadLocal() { var cookiePrefix = localStoragePrefix + "="; var cookieStart = document.cookie.indexOf(cookiePrefix); if (cookieStart > -1) { let cookieEnd = document.cookie.indexOf(";", cookieStart); if (cookieEnd == -1) { cookieEnd = document.cookie.length; } var cookieData = document.cookie.substring(cookieStart + cookiePrefix.length, cookieEnd); return JSON.parse(cookieData); } } </script>
<script type="text/javascript"> window.addEventListener('load', function() { var observer = new MutationObserver(function() { window.parent.postMessage({height: document.documentElement.scrollHeight || document.body.scrollHeight},"*"); }); observer.observe(document.body, {attributes: true, childList: true, subtree: true}); window.parent.postMessage({height: document.documentElement.scrollHeight || document.body.scrollHeight},"*"); }); </script>
</body>
</html>