Shift the fox heads down a tad.

This commit is contained in:
lucaswadedavis 2016-12-16 11:51:16 -08:00
parent 3e55c8eb7b
commit 3acf93fd81
2 changed files with 12 additions and 1 deletions

View file

@ -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);