From 283288d40bfb71135afc294e553a344641199866 Mon Sep 17 00:00:00 2001 From: Juan M Date: Sun, 28 Apr 2024 04:49:41 -0300 Subject: [PATCH 1/2] Frame landscape --- netlify/edge-functions/frame.jsx | 16 ++++++++-------- netlify/utils/image.js | 16 +++++++++++++--- 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/netlify/edge-functions/frame.jsx b/netlify/edge-functions/frame.jsx index 43ae9b9..0d4ef8d 100644 --- a/netlify/edge-functions/frame.jsx +++ b/netlify/edge-functions/frame.jsx @@ -59,7 +59,7 @@ export default async function handler(request, context) { display: 'flex', position: 'absolute', top: '0', - left: '0', + left: '233px', width: '512px', height: '512px', borderRadius: '50%', @@ -68,11 +68,11 @@ export default async function handler(request, context) { ) } else if (eventsInfo.length < 6) { images.push( - ...renderEventsImages(eventsInfo.map((eventInfo) => eventInfo.event), 512, 224, 0) + ...renderEventsImages(eventsInfo.map((eventInfo) => eventInfo.event), 512, 224, [233, 0]) ) } else { images.push( - ...renderEventsImages(eventsInfo.slice(0, 8).map((eventInfo) => eventInfo.event), 512, 192, 0) + ...renderEventsImages(eventsInfo.slice(0, 8).map((eventInfo) => eventInfo.event), 512, 192, [233, 0]) ) } @@ -87,7 +87,7 @@ export default async function handler(request, context) { style={{ display: 'flex', position: 'relative', - width: '512px', + width: '978px', height: '512px', }} > @@ -97,7 +97,7 @@ export default async function handler(request, context) { position: 'absolute', top: '0', left: '0', - width: '512px', + width: '978px', height: '512px', borderRadius: '50%', }} @@ -110,7 +110,7 @@ export default async function handler(request, context) { position: 'absolute', top: '0', left: '0', - width: '512px', + width: '978px', height: '512px', background: 'linear-gradient(180deg, transparent, rgba(255, 255, 255, 0.9) 80%)', }} @@ -123,7 +123,7 @@ export default async function handler(request, context) { position: 'relative', left: '0', top: '0', - width: '512px', + width: '978px', height: '512px', }} > @@ -146,7 +146,7 @@ export default async function handler(request, context) { ), { - width: 512, + width: 978, height: 512, fonts: [ { diff --git a/netlify/utils/image.js b/netlify/utils/image.js index baced7e..1cfda34 100644 --- a/netlify/utils/image.js +++ b/netlify/utils/image.js @@ -3,16 +3,26 @@ export function renderEventsImages(events, canvas, size, pos) { return [] } + let posX = 0 + let posY = 0 + if (typeof pos === 'number') { + posX = pos + posY = pos + } else if (Array.isArray(pos) && pos.length === 2) { + [posX, posY] = pos + } + const angle = 360 / events.length const offset = size / 2 const radius = (canvas - size) / 2 - const center = pos + offset + radius + const centerX = posX + offset + radius + const centerY = posY + offset + radius const images = [] events.forEach((event, i) => { - const x = center + radius * Math.cos(angle * i * Math.PI / 180) - const y = center + radius * Math.sin(angle * i * Math.PI / 180) + const x = centerX + radius * Math.cos(angle * i * Math.PI / 180) + const y = centerY + radius * Math.sin(angle * i * Math.PI / 180) images.push({ type: 'img', From b605b9d281330cc3a0ff0d7926127317ea332c6e Mon Sep 17 00:00:00 2001 From: Juan M Date: Sun, 28 Apr 2024 04:50:35 -0300 Subject: [PATCH 2/2] Version 1.12.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 3b19cf9..43c0fe5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@poap-xyz/poap-family", - "version": "1.12.0", + "version": "1.12.1", "author": { "name": "POAP", "url": "https://poap.xyz"