Hi guys,
I wasn't sure if I could make a minimap in HTML5 as no libraries are available. so after trial and error I managed to make the map image move accuretly according to player position based on a formula only god knows how I came up with.

The problem is pretty obvious in the screenshot, how can I make the image only visible inside the minimap frame? usually it can be done by playing around Z variable but in this case the tiled map is complicating things.
I'm not sure if a square minimap frame would help me find a solutions to this (by croping the mini map each movement update?) and I think it can be done using CSS but I have no clue how to add CSS style to renderables, some pointers are welcome.
Thanks.
Just in case anyone is curious about the code I can write a short guide about creating accurate minimaps.
game.data.minimap.pos.x=(322-((this.pos.x-610)/4.324))+384;
game.data.minimap.pos.y=(316-((this.pos.y-545)/4.324))-215;