Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
loadComplete (file) {
const ctx = GetContext(this.canvas);
Fill(ctx, 120, 0, 120);
// Draw the image at 400x300
// DrawImage(ctx, file.data, { x: 400, y: 300 });
// Draw the image at 400x300 centered (anchor 0.5)
DrawImage(ctx, file.data, { x: 400, y: 300, anchorX: 0.5, anchorY: 0.5 });
}draw (i) {
DrawImage(this.ctx, this.image, { x: this.sprite1.x, y: this.sprite1.y, rotate: this.sprite1.rotation, scaleX: this.sprite1.scaleX, scaleY: this.sprite1.scaleY, anchorX: 0.5, anchorY: 0.5 });
}Smoothing.disable(ctx);
Fill(ctx, 120, 0, 120);
DrawImage(ctx, file.data, {
x: 200, y: 200,
scaleX: 2, scaleY: 2
});
DrawImage(ctx, file.data, {
x: 350, y: 200,
scaleX: 2, scaleY: 2,
blendMode: 'lighter'
});
DrawImage(ctx, file.data, {
x: 500, y: 200,
scaleX: 2, scaleY: 2,
blendMode: 'overlay'
});
}loadComplete (file) {
const ctx = GetContext(this.canvas);
Smoothing.disable(ctx);
Fill(ctx, 120, 0, 120);
DrawImage(ctx, file.data, {
x: 400, y: 300,
width: 16,
anchorX: 0.5, anchorY: 0.5,
scaleX: 4, scaleY: 4,
rotate: DegToRad(45)
});
}draw (i) {
DrawImage(this.ctx, this.image, { x: this.sprite1.x, y: this.sprite1.y, rotate: this.sprite1.rotation, anchorX: 0.5, anchorY: 0.5 });
}draw (i) {
DrawImage(this.ctx, this.image, { x: this.sprite1.x, y: this.sprite1.y, rotate: this.sprite1.rotation, scaleX: this.sprite1.scaleX, scaleY: this.sprite1.scaleY, anchorX: 0.5, anchorY: 0.5 });
}drawStar (layer, x, y) {
DrawImage(this.ctx, this.image, { x, y });
}