Skip to content

Commit

Permalink
Merge pull request #177 from FroostyCodes/feat/new-factory-method
Browse files Browse the repository at this point in the history
feat: added new factory method
  • Loading branch information
twlite committed Oct 31, 2023
2 parents 685f340 + 99382d5 commit f6805c1
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions src/assets/TemplateFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -703,5 +703,44 @@ export const TemplateFactory = {
}
]
};
}),
Shit: createTemplate((image: ImageSource) => {
const clipCircle = (ctx: SKRSContext2D, width: number, height: number) => {
ctx.save();
ctx.globalCompositeOperation = 'destination-in';
ctx.beginPath();
ctx.arc(width / 2, height / 2, width / 2, 0, Math.PI * 2);
ctx.closePath();
ctx.fill();
ctx.restore();
};

return {
steps: [
{
image: [
{
source: new TemplateImage(ImageFactory.SHIT),
x: 0,
y: 0
}
]
},
{
image: [
{
source: new TemplateImage(image),
x: 210,
y: 700,
width: 170,
height: 170,
preprocess(_canvas, ctx) {
clipCircle(ctx, 170, 170);
}
}
]
}
]
};
})
};

0 comments on commit f6805c1

Please sign in to comment.