Raphaël - JavaScript library is used for drawing SVG image.
Include following files into HTML:
raphael-min.js
gw2emblem-defs.js
gw2emblem.js
Init gw2emblem in empty div with [ID = 'gw2embelm-div']:
// 'gw2embelm-div' is div ID and 256 is size of emblem in pixels
gw2emblem.init('gw2embelm-div', 256);
Display GW2 Emblem with object fatched from GW2 API Docs:
gw2emblem.drawEmblemGw2({
"background_id":2,
"foreground_id":103,
"flags":[],
"background_color_id":673,
"foreground_primary_color_id":443,
"foreground_secondary_color_id":473
});
It's possible to use background color (instead of default image) - it's sent as 3rd argument for init function call, fe:
gw2emblem.init('gw2embelm-div', 128, 'transparent');
or
gw2emblem.init('gw2embelm-div', 128, '#3682a0');
- tweak emblems
- generate less detailed emblems (as option for smaller emblem defintion file)
- add on-demand loading of emblem defintions to reduce initial loading time
Mladen Todorovic [email protected]