@@ -1196,6 +1196,11 @@ async function createAnimationFrame(
11961196 canvas . width = width + xPadding * 2
11971197 canvas . height = height + yPadding * 2
11981198
1199+ const textCanvas = document . createElement ( 'canvas' )
1200+ const textCtx = textCanvas . getContext ( '2d' , { alpha : true } ) !
1201+ textCanvas . width = width + xPadding - 4
1202+ textCanvas . height = height + yPadding
1203+
11991204 if ( backgroundType === 'linearGradient' ) {
12001205 // Convert angle to match CSS gradient angle (0deg = to top, 90deg = to right)
12011206 const cssAngle = ( backgroundGradientDirection + 90 ) % 360
@@ -1266,13 +1271,15 @@ async function createAnimationFrame(
12661271 [ el . color . start || 'rgba(0,0,0,0)' , el . color . end || 'rgba(0,0,0,0)' ] ,
12671272 )
12681273
1269- ctx . font = `${ fontSize } ${ fontFamily } `
1270- ctx . fillStyle = color
1271- ctx . globalAlpha = opacity
1272- ctx . fillText ( htmlDecode ( el . el . innerHTML ) , x , y , width - x + xPadding / 2 )
1274+ textCtx . font = `${ fontSize } ${ fontFamily } `
1275+ textCtx . fillStyle = color
1276+ textCtx . globalAlpha = opacity
1277+ textCtx . fillText ( htmlDecode ( el . el . innerHTML ) , x , y )
12731278 } )
12741279 await Promise . all ( elementPromises )
12751280
1281+ ctx . drawImage ( textCanvas , 0 , 0 )
1282+
12761283 return ctx . getImageData ( 0 , 0 , canvas . width , canvas . height )
12771284}
12781285
0 commit comments