snap.js implemenatation