fix
Browse files
src/lib/services/picletExport.ts
CHANGED
|
@@ -60,7 +60,7 @@ export async function generateShareableImage(piclet: PicletInstance): Promise<Bl
|
|
| 60 |
const grassImg = await loadImage('/assets/grass.PNG');
|
| 61 |
const platformSize = 1200; // Larger than piclet for proper positioning
|
| 62 |
const platformX = (canvasWidth - platformSize) / 2;
|
| 63 |
-
const platformY = picletY + picletSize - 300; // Platform
|
| 64 |
ctx.drawImage(grassImg, platformX, platformY, platformSize, platformSize);
|
| 65 |
|
| 66 |
// Draw piclet on top of platform
|
|
@@ -117,9 +117,10 @@ export async function generateShareableImage(piclet: PicletInstance): Promise<Bl
|
|
| 117 |
const containerWidth = canvasWidth - 200;
|
| 118 |
const containerHeight = 150;
|
| 119 |
|
| 120 |
-
// Draw semi-transparent background
|
| 121 |
-
ctx.fillStyle = 'rgba(0, 0, 0, 0.
|
| 122 |
-
ctx.
|
|
|
|
| 123 |
ctx.fill();
|
| 124 |
|
| 125 |
// Draw stats bars
|
|
@@ -144,13 +145,15 @@ export async function generateShareableImage(piclet: PicletInstance): Promise<Bl
|
|
| 144 |
// Draw background bar
|
| 145 |
const barX = containerX + 120;
|
| 146 |
ctx.fillStyle = 'rgba(255, 255, 255, 0.2)';
|
| 147 |
-
ctx.
|
|
|
|
| 148 |
ctx.fill();
|
| 149 |
|
| 150 |
// Draw filled bar
|
| 151 |
const fillWidth = (stat.value / maxStatValue) * barMaxWidth;
|
| 152 |
ctx.fillStyle = stat.color;
|
| 153 |
-
ctx.
|
|
|
|
| 154 |
ctx.fill();
|
| 155 |
|
| 156 |
// Add shine effect
|
|
@@ -159,7 +162,8 @@ export async function generateShareableImage(piclet: PicletInstance): Promise<Bl
|
|
| 159 |
shineGradient.addColorStop(0.5, 'rgba(255, 255, 255, 0.1)');
|
| 160 |
shineGradient.addColorStop(1, 'rgba(255, 255, 255, 0)');
|
| 161 |
ctx.fillStyle = shineGradient;
|
| 162 |
-
ctx.
|
|
|
|
| 163 |
ctx.fill();
|
| 164 |
});
|
| 165 |
|
|
|
|
| 60 |
const grassImg = await loadImage('/assets/grass.PNG');
|
| 61 |
const platformSize = 1200; // Larger than piclet for proper positioning
|
| 62 |
const platformX = (canvasWidth - platformSize) / 2;
|
| 63 |
+
const platformY = picletY + picletSize - 300 - 384; // Platform moved up by 384px
|
| 64 |
ctx.drawImage(grassImg, platformX, platformY, platformSize, platformSize);
|
| 65 |
|
| 66 |
// Draw piclet on top of platform
|
|
|
|
| 117 |
const containerWidth = canvasWidth - 200;
|
| 118 |
const containerHeight = 150;
|
| 119 |
|
| 120 |
+
// Draw semi-transparent background using the polyfilled roundRect
|
| 121 |
+
ctx.fillStyle = 'rgba(0, 0, 0, 0.5)';
|
| 122 |
+
ctx.beginPath();
|
| 123 |
+
(ctx as any).roundRect(containerX, containerY, containerWidth, containerHeight, 20);
|
| 124 |
ctx.fill();
|
| 125 |
|
| 126 |
// Draw stats bars
|
|
|
|
| 145 |
// Draw background bar
|
| 146 |
const barX = containerX + 120;
|
| 147 |
ctx.fillStyle = 'rgba(255, 255, 255, 0.2)';
|
| 148 |
+
ctx.beginPath();
|
| 149 |
+
(ctx as any).roundRect(barX, y - 8, barMaxWidth, barHeight, 8);
|
| 150 |
ctx.fill();
|
| 151 |
|
| 152 |
// Draw filled bar
|
| 153 |
const fillWidth = (stat.value / maxStatValue) * barMaxWidth;
|
| 154 |
ctx.fillStyle = stat.color;
|
| 155 |
+
ctx.beginPath();
|
| 156 |
+
(ctx as any).roundRect(barX, y - 8, fillWidth, barHeight, 8);
|
| 157 |
ctx.fill();
|
| 158 |
|
| 159 |
// Add shine effect
|
|
|
|
| 162 |
shineGradient.addColorStop(0.5, 'rgba(255, 255, 255, 0.1)');
|
| 163 |
shineGradient.addColorStop(1, 'rgba(255, 255, 255, 0)');
|
| 164 |
ctx.fillStyle = shineGradient;
|
| 165 |
+
ctx.beginPath();
|
| 166 |
+
(ctx as any).roundRect(barX, y - 8, fillWidth, barHeight / 2, 8);
|
| 167 |
ctx.fill();
|
| 168 |
});
|
| 169 |
|