Skip to content

Instantly share code, notes, and snippets.

@derekblank
Last active December 18, 2015 09:19
Show Gist options
  • Save derekblank/5760586 to your computer and use it in GitHub Desktop.
Save derekblank/5760586 to your computer and use it in GitHub Desktop.
Initialize constructor and init functions for map.js.coffee
class WorldMap
constructor: ->
@baseColor = '#f5f3e6' # set the base fill color of the vector shapes
@hoverColor = '#053a5a' # set hover color
@R = Raphael('map', 960, 543) # create the canvas element #map and define dimensions
@defaultAttr =
fill: @baseColor # define default attributes for all paths
@init()
init: =>
# initialize array (path data is loaded in separate file)
worldRaphael = {}
# draw region paths
for region of world
worldRaphael[region] = @R.path(world[region].path)
.attr(@defaultAttr) # apply default transformations
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment