Skip to content

Commit

Permalink
Add all layers to template
Browse files Browse the repository at this point in the history
  • Loading branch information
Dinuks committed Apr 27, 2015
1 parent 133f130 commit 3f48997
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 4 deletions.
65 changes: 63 additions & 2 deletions templates/mobile_multiple/metadata.js
@@ -1,8 +1,9 @@
(function() {
var metadata = {
mockup: {
width: 897,
height: 468
width: 1140,
height: 480,
name: 'mobile_multiple'
},
layers: [
{
Expand Down Expand Up @@ -34,6 +35,66 @@
width: 320,
height: 568
}
},
{
type: 'mobile3',
topLeft: {
x: 416,
y: 122
},
bottomRight: {
x: 549,
y: 359
},
viewport: {
width: 320,
height: 568
}
},
{
type: 'mobile4',
topLeft: {
x: 591,
y: 122
},
bottomRight: {
x: 724,
y: 359
},
viewport: {
width: 320,
height: 568
}
},
{
type: 'mobile5',
topLeft: {
x: 766,
y: 122
},
bottomRight: {
x: 899,
y: 359
},
viewport: {
width: 320,
height: 568
}
},
{
type: 'mobile6',
topLeft: {
x: 941,
y: 122
},
bottomRight: {
x: 1074,
y: 359
},
viewport: {
width: 320,
height: 568
}
}
]
};
Expand Down
8 changes: 6 additions & 2 deletions templates/mobile_multiple/render.js
@@ -1,4 +1,4 @@
var screenshotDir = '../../screenshots/chrome-fold';
var screenshotDir = '../../screenshots/' + metadata.mockup.name;

var canvas = document.createElement('canvas');
canvas.width = metadata.mockup.width;
Expand Down Expand Up @@ -47,14 +47,18 @@ function drawScreenshot(options) {
};

img.src = screenshotDir + '/' + layerType + '.png';
console.log(img.src);

}

var tasks = [
function() { drawLayer({ src: 'template.png' }); },
function() { drawScreenshot({ layer: 'desktop' }); }
];

metadata.layers.forEach(function(l){
tasks.push(function() { drawScreenshot({ layer: l.type }); })
});

function tick() {
var task = tasks.shift();

Expand Down

0 comments on commit 3f48997

Please sign in to comment.