From fcd6dbad41f698e500f121f00e597168b2d7314f Mon Sep 17 00:00:00 2001 From: Jeffrey Sun Date: Thu, 15 Dec 2016 11:50:37 -0800 Subject: [PATCH 1/2] include random-seed package --- package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 1444644..0a57a0a 100644 --- a/package.json +++ b/package.json @@ -19,6 +19,7 @@ "dependencies": { "canvas": "^1.6.2", "express": "^4.14.0", - "node-gyp": "^3.4.0" + "node-gyp": "^3.4.0", + "random-seed": "^0.3.0" } } From fc79fddac4d1217234fcf47e244d2f44969fa4ea Mon Sep 17 00:00:00 2001 From: Jeffrey Sun Date: Thu, 15 Dec 2016 12:06:02 -0800 Subject: [PATCH 2/2] skeleton of Fox class --- js/fox.js | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 js/fox.js diff --git a/js/fox.js b/js/fox.js new file mode 100644 index 0000000..c3a70b2 --- /dev/null +++ b/js/fox.js @@ -0,0 +1,40 @@ +// TODO: use query params for these +var gen = require('random-seed'); +var IMG_WIDTH = 64; +var IMG_HEIGHT = 64; + +// move to helper function +var Point = function (x, y) { + return { + x: x, + y: y + }; +}; + +var randomFox = (function () { + + // head top left corner + var origin = Point(IMG_WIDTH / 4, IMG_HEIGHT / 4); + // head width and height + var width = IMG_WIDTH / 2; + var height = IMG_HEIGHT / 2; + + var ears = (function () { + // TODO: generate stuff + return { + left: { + x: null + }, + right: { + x: null + } + }; + }); + + return { + ears: ears, + eyes: eyes, + nose: nose, + mouth: mouth + }; +}());