image

Aide

Draw: Dessinez sur l'image

Eraser: Effacez vos traits

Move: Déplacez l'image

Clear: Effacez tous les dessins

Effet: Applique un effet aléatoire

New: Charge une nouvelle image

{ name: 'Wave Distortion Extreme', apply: (imgData) => { const data = imgData.data; const w = effectCanvas.width; const h = effectCanvas.height; const direction = Math.random() > 0.5 ? 'horizontal' : 'vertical'; const frequency = 0.01 + Math.random() * 0.1; const amplitude = 20 + Math.random() * 30; const phase = Math.random() * Math.PI * 2; if (direction === 'horizontal') { for (let y = 0; y < h; y++) { const offset = Math.sin(y * frequency + phase) * amplitude; for (let x = 0; x < w; x++) { const sourceX = Math.floor((x + offset + w) % w); const targetIdx = (y * w + x) * 4; const sourceIdx = (y * w + sourceX) * 4; for (let c = 0; c < 4; c++) { data[targetIdx + c] = originalImageData.data[sourceIdx + c]; } } } } else { for (let x = 0; x < w; x++) { const offset = Math.sin(x * frequency + phase) * amplitude; for (let y = 0; y < h; y++) { const sourceY = Math.floor((y + offset + h) % h); const targetIdx = (y * w + x) * 4; const sourceIdx = (sourceY * w + x) * 4; for (let c = 0; c < 4; c++) { data[targetIdx + c] = originalImageData.data[sourceIdx + c]; } } } } } }, { name: 'Circular Warp Wild', apply: (imgData) => { const data = imgData.data; const w = effectCanvas.width; const h = effectCanvas.height; const centerX = Math.random() * w; const centerY = Math.random() * h; const strength = 0.3 + Math.random() * 1.5; const radius = 50 + Math.random() * 300; const inverse = Math.random() > 0.5; for (let y = 0; y < h; y++) { for (let x = 0; x < w; x++) { const dx = x - centerX; const dy = y - centerY; const dist = Math.sqrt(dx * dx + dy * dy); const angle = Math.atan2(dy, dx); const warpDist = inverse ? dist * (1 + strength * Math.exp(-dist / radius)) : dist * (1 - strength * Math.exp(-dist / radius)); const sourceX = Math.floor(centerX + Math.cos(angle) * warpDist); const sourceY = Math.floor(centerY + Math.sin(angle) * warpDist); if (sourceX >= 0 && sourceX < w && sourceY >= 0 && sourceY < h) { const targetIdx = (y * w + x) * 4; const sourceIdx = (sourceY * w + sourceX) * 4; for (let c = 0; c < 4; c++) { data[targetIdx + c] = originalImageData.data[sourceIdx + c]; } } } } } }, { name: 'Mirror Quad Twisted', apply: (imgData) => { const data = imgData.data; const w = effectCanvas.width; const h = effectCanvas.height; const splitX = 0.2 + Math.random() * 0.6; const splitY = 0.2 + Math.random() * 0.6; const lineX = Math.floor(w * splitX); const lineY = Math.floor(h * splitY); const modes = [ [false, false, true, true], [true, false, false, true], [true, true, false, false], [false, true, true, false], [true, false, true, false], [false, true, false, true] ]; const mode = modes[Math.floor(Math.random() * modes.length)]; for (let y = 0; y < h; y++) { for (let x = 0; x < w; x++) { let sourceX = x; let sourceY = y; if (y < lineY && x < lineX) { if (mode[0]) { sourceX = lineX - x; sourceY = lineY - y; } } else if (y < lineY && x >= lineX) { if (mode[1]) { sourceX = lineX + (lineX - (x - lineX)); sourceY = lineY - y; } } else if (y >= lineY && x < lineX) { if (mode[2]) { sourceX = lineX - x; sourceY = lineY + (lineY - (y - lineY)); } } else { if (mode[3]) { sourceX = lineX + (lineX - (x - lineX)); sourceY = lineY + (lineY - (y - lineY)); } } sourceX = Math.max(0, Math.min(w - 1, sourceX)); sourceY = Math.max(0, Math.min(h - 1, sourceY)); const targetIdx = (y * w + x) * 4; const sourceIdx = (sourceY * w + sourceX) * 4; for (let c = 0; c < 4; c++) { data[targetIdx + c] = originalImageData.data[sourceIdx + c]; } } } } }, { name: 'Slice Shift Extreme', apply: (imgData) => { const data = imgData.data; const w = effectCanvas.width; const h = effectCanvas.height; const sliceHeight = Math.floor(5 + Math.random() * 50); const direction = Math.random() > 0.5 ? 'horizontal' : 'vertical'; const maxOffset = 50 + Math.random() * 200; if (direction === 'horizontal') { for (let y = 0; y < h; y += sliceHeight) { const offset = (Math.random() - 0.5) * maxOffset * 2; for (let sy = 0; sy < sliceHeight; sy++) { const currentY = y + sy; if (currentY >= h) break; for (let x = 0; x < w; x++) { const sourceX = Math.floor((x + offset + w * 3) % w); const targetIdx = (currentY * w + x) * 4; const sourceIdx = (currentY * w + sourceX) * 4; for (let c = 0; c < 4; c++) { data[targetIdx + c] = originalImageData.data[sourceIdx + c]; } } } } } else { const sliceWidth = sliceHeight; for (let x = 0; x < w; x += sliceWidth) { const offset = (Math.random() - 0.5) * maxOffset * 2; for (let sx = 0; sx < sliceWidth; sx++) { const currentX = x + sx; if (currentX >= w) break; for (let y = 0; y < h; y++) { const sourceY = Math.floor((y + offset + h * 3) % h); const targetIdx = (y * w + currentX) * 4; const sourceIdx = (sourceY * w + currentX) * 4; for (let c = 0; c < 4; c++) { data[targetIdx + c] = originalImageData.data[sourceIdx + c]; } } } } } } }, { name: 'Pixel Scatter', apply: (imgData) => { const data = imgData.data; const w = effectCanvas.width; const h = effectCanvas.height; const iterations = Math.floor(500 + Math.random() * 2000); const scatterRange = 5 + Math.random() * 30; const blockSize = Math.floor(10 + Math.random() * 40); for (let i = 0; i < iterations; i++) { const x1 = Math.floor(Math.random() * w); const y1 = Math.floor(Math.random() * h); const x2 = Math.floor(x1 + (Math.random() - 0.5) * scatterRange * 2); const y2 = Math.floor(y1 + (Math.random() - 0.5) * scatterRange * 2); for (let by = 0; by < blockSize; by++) { for (let bx = 0; bx < blockSize; bx++) { const sx = x1 + bx; const sy = y1 + by; const tx = x2 + bx; const ty = y2 + by; if (sx >= 0 && sx < w && sy >= 0 && sy < h && tx >= 0 && tx < w && ty >= 0 && ty < h) { const sourceIdx = (sy * w + sx) * 4; const targetIdx = (ty * w + tx) * 4; for (let c = 0; c < 4; c++) { data[targetIdx + c] = originalImageData.data[sourceIdx + c]; } } } } } } },