mirror of
https://git.sleeping.town/mirrors/foxy-moxy
synced 2025-06-17 04:40:48 -07:00
Shift the fox heads down a tad.
This commit is contained in:
parent
3e55c8eb7b
commit
3acf93fd81
2 changed files with 12 additions and 1 deletions
|
@ -10,8 +10,19 @@ var renderFox = function (canvas, opts) {
|
|||
renderEyes(ctx, opts.eyes);
|
||||
renderNose(ctx, opts.nose);
|
||||
renderMouth(ctx, opts.mouth);
|
||||
|
||||
shift_canvas(ctx, width, height, 0, 0.06 * height);
|
||||
};
|
||||
|
||||
function shift_canvas(ctx, w, h, dx, dy) {
|
||||
var topImage = ctx.getImageData(0, 0, w, h);
|
||||
var bottomImage = ctx.getImageData(0, h - dy, w, h);
|
||||
|
||||
ctx.clearRect(0, 0, w, h);
|
||||
ctx.putImageData(bottomImage, 0, 0);
|
||||
ctx.putImageData(topImage, dx, dy);
|
||||
}
|
||||
|
||||
function renderHead(ctx, opts) {
|
||||
ctx.save();
|
||||
ctx.translate(ctx.canvas.width/2, ctx.canvas.height/2);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue