This repository was archived by the owner on Jul 23, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExport iOS App Icon.jsf
More file actions
58 lines (48 loc) · 1.44 KB
/
Export iOS App Icon.jsf
File metadata and controls
58 lines (48 loc) · 1.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
var dom = fw.getDocumentDOM();
var sizes = [
// icon dimensions
// https://developer.apple.com/library/ios/#documentation/UserExperience/Conceptual/MobileHIG/IconsImages/IconsImages.html
//
[22, 29], //
[44, 58], //
//
[29, 29], //
[50, 50], //
[57, 57], //
[58, 58], //
[64, 64], //
[72, 72], //
[100, 100], //
[114, 114], //
[128, 128], //
[144, 144], //
[320, 320], //
[512, 512], //
[640, 640], //
[1024, 1024],
];
var maxSize = sizes[sizes.length - 1];
if (dom.width != maxSize[0] || dom.height != maxSize[1])
{ // Wrong dimensions
// TODO: check all pages for correct size
alert('Error: Master page must be 1024x1024px');
}
else
{
// delete all other pages
while (fw.getDocumentDOM().pagesCount > 1) {
fw.getDocumentDOM().deletePageAt(1);
}
for (var i = 0; i < sizes.length - 1; i++) {
// iterate over all required sizes
var width = sizes[i][0];
var height = sizes[i][1];
// duplicate, resize, rename
dom.duplicatePage(0);
dom.changeCurrentPage(1);
dom.setDocumentImageSize({left:0, top:0, right:width, bottom:height}, {pixelsPerUnit:72, units:'inch'}, true, -1);
dom.setPageName(1, 'icon-' + width + 'x' + height);
}
dom.changeCurrentPage(0);
fw.exportDocumentAs(null, null, null);
}