2016-12-15 20:06:02 +00:00
|
|
|
// TODO: use query params for these
|
|
|
|
var gen = require('random-seed');
|
|
|
|
|
|
|
|
// move to helper function
|
2016-12-15 20:21:43 +00:00
|
|
|
var genBetween = function (min, max) {
|
|
|
|
return min + (max - min) * gen();
|
|
|
|
}
|
2016-12-15 20:06:02 +00:00
|
|
|
|
2016-12-15 21:23:38 +00:00
|
|
|
var Fox = function (IMG_WIDTH, IMG_HEIGHT) {
|
2016-12-15 20:06:02 +00:00
|
|
|
|
|
|
|
// head top left corner
|
2016-12-15 21:23:38 +00:00
|
|
|
var origin = {x: IMG_WIDTH / 4, y: IMG_HEIGHT / 4};
|
|
|
|
// TODO: head headWidth and height
|
|
|
|
var headWidth = IMG_WIDTH / 2;
|
|
|
|
var headHeight = IMG_HEIGHT / 2;
|
2016-12-15 20:06:02 +00:00
|
|
|
|
|
|
|
var ears = (function () {
|
2016-12-15 21:23:38 +00:00
|
|
|
var offsetX = genBetween(0, headWidth/2);
|
2016-12-15 20:23:21 +00:00
|
|
|
// TODO: size, angle?
|
2016-12-15 20:06:02 +00:00
|
|
|
return {
|
|
|
|
left: {
|
2016-12-15 21:23:38 +00:00
|
|
|
x: origin.x + (headWidth/2) - offsetX,
|
2016-12-15 20:21:43 +00:00
|
|
|
y: origin.y
|
2016-12-15 20:06:02 +00:00
|
|
|
},
|
|
|
|
right: {
|
2016-12-15 21:23:38 +00:00
|
|
|
x: origin.x + (headWidth/2) + offsetX,
|
2016-12-15 20:21:43 +00:00
|
|
|
y: origin.y
|
2016-12-15 20:06:02 +00:00
|
|
|
}
|
|
|
|
};
|
2016-12-15 20:21:43 +00:00
|
|
|
}());
|
|
|
|
|
|
|
|
var eyes = (function () {
|
2016-12-15 20:23:21 +00:00
|
|
|
// TODO: y, offsetX, color
|
2016-12-15 21:23:38 +00:00
|
|
|
return null;
|
2016-12-15 20:21:43 +00:00
|
|
|
}());
|
2016-12-15 20:06:02 +00:00
|
|
|
|
|
|
|
return {
|
2016-12-15 21:23:38 +00:00
|
|
|
canvas: {
|
|
|
|
height: IMG_HEIGHT,
|
|
|
|
width: IMG_WIDTH
|
|
|
|
},
|
|
|
|
head: {
|
2016-12-15 20:21:43 +00:00
|
|
|
origin: origin,
|
2016-12-15 21:39:02 +00:00
|
|
|
width: headWidth,
|
|
|
|
height: headHeight
|
2016-12-15 20:21:43 +00:00
|
|
|
},
|
2016-12-15 20:06:02 +00:00
|
|
|
ears: ears,
|
|
|
|
eyes: eyes,
|
2016-12-15 21:23:38 +00:00
|
|
|
// nose: nose,
|
|
|
|
// mouth: mouth
|
2016-12-15 20:06:02 +00:00
|
|
|
};
|
2016-12-15 21:23:38 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
module.exports = Fox;
|