Skip to content

Commit

Permalink
Merge pull request #200 from poap-xyz/release/v1.12.1
Browse files Browse the repository at this point in the history
Release v1.12.1
  • Loading branch information
jm42 authored Apr 28, 2024
2 parents a2a5777 + b605b9d commit d639fce
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 12 deletions.
16 changes: 8 additions & 8 deletions netlify/edge-functions/frame.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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%',
Expand All @@ -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])
)
}

Expand All @@ -87,7 +87,7 @@ export default async function handler(request, context) {
style={{
display: 'flex',
position: 'relative',
width: '512px',
width: '978px',
height: '512px',
}}
>
Expand All @@ -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%',
}}
Expand All @@ -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%)',
}}
Expand All @@ -123,7 +123,7 @@ export default async function handler(request, context) {
position: 'relative',
left: '0',
top: '0',
width: '512px',
width: '978px',
height: '512px',
}}
>
Expand All @@ -146,7 +146,7 @@ export default async function handler(request, context) {
</div>
),
{
width: 512,
width: 978,
height: 512,
fonts: [
{
Expand Down
16 changes: 13 additions & 3 deletions netlify/utils/image.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@poap-xyz/poap-family",
"version": "1.12.0",
"version": "1.12.1",
"author": {
"name": "POAP",
"url": "https://poap.xyz"
Expand Down

0 comments on commit d639fce

Please sign in to comment.