Fraser commited on
Commit
d60484d
·
1 Parent(s): 51ded8d
Files changed (1) hide show
  1. src/lib/services/picletExport.ts +18 -4
src/lib/services/picletExport.ts CHANGED
@@ -16,8 +16,22 @@ export async function generateShareableImage(piclet: PicletInstance): Promise<Bl
16
  canvas.width = canvasWidth;
17
  canvas.height = canvasHeight;
18
 
19
- // Clear canvas for transparency (no background fill)
20
- ctx.clearRect(0, 0, canvasWidth, canvasHeight);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21
 
22
  // Load piclet image first
23
  const picletImg = await loadImage(piclet.imageData || piclet.imageUrl);
@@ -27,9 +41,9 @@ export async function generateShareableImage(piclet: PicletInstance): Promise<Bl
27
 
28
  // Load and draw grass platform positioned under the piclet
29
  const grassImg = await loadImage('/assets/grass.PNG');
30
- const platformSize = picletSize + 100; // Slightly larger than piclet
31
  const platformX = (canvasWidth - platformSize) / 2;
32
- const platformY = picletY;
33
  ctx.drawImage(grassImg, platformX, platformY, platformSize, platformSize);
34
 
35
  // Draw piclet on top of platform
 
16
  canvas.width = canvasWidth;
17
  canvas.height = canvasHeight;
18
 
19
+ // Fill with striped background like battle view
20
+ ctx.fillStyle = '#f8f9fa';
21
+ ctx.fillRect(0, 0, canvasWidth, canvasHeight);
22
+
23
+ // Create striped pattern
24
+ const stripeHeight = 10;
25
+ ctx.fillStyle = 'rgba(76, 175, 80, 0.2)'; // Light green
26
+ for (let y = 0; y < canvasHeight; y += stripeHeight * 2) {
27
+ ctx.fillRect(0, y, canvasWidth, stripeHeight);
28
+ }
29
+
30
+ // Add alternating darker stripes
31
+ ctx.fillStyle = 'rgba(76, 175, 80, 0.1)'; // Lighter green
32
+ for (let y = stripeHeight; y < canvasHeight; y += stripeHeight * 2) {
33
+ ctx.fillRect(0, y, canvasWidth, stripeHeight);
34
+ }
35
 
36
  // Load piclet image first
37
  const picletImg = await loadImage(piclet.imageData || piclet.imageUrl);
 
41
 
42
  // Load and draw grass platform positioned under the piclet
43
  const grassImg = await loadImage('/assets/grass.PNG');
44
+ const platformSize = 1024; // Slightly larger than piclet
45
  const platformX = (canvasWidth - platformSize) / 2;
46
+ const platformY = picletY + 512;
47
  ctx.drawImage(grassImg, platformX, platformY, platformSize, platformSize);
48
 
49
  // Draw piclet on top of platform