-
-
Notifications
You must be signed in to change notification settings - Fork 429
Closed
Labels
feature requestA neat new idea for this projectA neat new idea for this projecthelp wantedIssue could use a contributorIssue could use a contributor
Description
Example code (limited to more modern browsers):
function path(context, x, y, scaleX, scaleY, rotation, path) {
context.save();
context.translate(x, y);
context.rotate(rotation);
context.scale(scaleX, scaleY);
context.fill(new Path2D(path));
context.restore();
}
...
path(context, fetti.x + fetti.wobble, fetti.y + fetti.wobble, Math.abs(x2 - x1) * 0.2, Math.abs(y2 - y1) * 0.2, Math.PI / 10 * fetti.wobble, fetti.shape.path);
...
confetti({
particleCount: 100,
shapes: ['circle', { type: 'path', path: 'M1 1 h 8 v 8 h -8 Z' }]
});
A path will probably need to provide a width and height or a scale factor, so that the resulting path can be scaled appropriately.
This code has very poor performance. Any acceptable solution will need to solve that.
Metadata
Metadata
Assignees
Labels
feature requestA neat new idea for this projectA neat new idea for this projecthelp wantedIssue could use a contributorIssue could use a contributor