You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

78 lines
3.9 KiB

2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. // Paper.js does ot operate across different javascript files yet, so your initialization or subways stations needs to be done in the subway.js file.\
  2. // I've seperated the two purely for asthetics.
  3. // initialize some subway lines
  4. MainLine = new Line( '#af1b8b', 'Main'); // (color, name)
  5. BlogLine = new Line( '#b3d529', 'Blogs');
  6. ProjectsLine = new Line('#ababab', 'Projects');
  7. // initalize the subway stations. Note the <i>order</i> of the initilization is important. The subway line will be drawn in order of how they are added
  8. // to the Lines object. Note that I have left the "neighbours" parameter empty for now. They will be initilized later.
  9. homeNode = new SingleNode( MainLine, new Point(30, 100), null, 'Home','http://www.70percentfatfree.com',new Point( 12, -14) );
  10. gitNode = new SingleNode(ProjectsLine, new Point( 182, 100), null, 'GitHub','https://github.com/Valloway',new Point( 19, 0));
  11. projectsNode = new TransitionNode( MainLine, ProjectsLine, 0.79, new Point( 182, Main_height), null, 'Projects', 'http://www.70percentfatfree.com/Projects.html', new Point( 12, -14));
  12. pyProcessNode = new SingleNode( ProjectsLine, new Point( 182+diff, Main_height+diff), null, 'PyProcess Library', 'http://pyprocess.70percentfatfree.com/', new Point( 19, 0));
  13. moreProjectsNode = new SingleNode( ProjectsLine, new Point(100, 200), null, 'More Projects','/', new Point( 12, -14));
  14. researchNode = new SingleNode( MainLine, new Point( 334, Main_height), null, 'Research', 'http://www.70percentfatfree.com/Research.html', new Point( 12, -14));
  15. blogNode = new TransitionNode( MainLine, BlogLine, -0.79, new Point( 486, Main_height), null, 'Blogs', '/blogs', new Point( 18, 26) ) ;
  16. latestBlogNode = new SingleNode( BlogLine, new Point( 486 + 70, 40), null, 'Latest Blog', '/', new Point( 13, -14));
  17. allBlogsNode = new SingleNode( BlogLine, new Point( 690, 40), null,'All Blogs', '/blogs', new Point( 13, -14));
  18. resumeNode = new SingleNode( MainLine, new Point(640, Main_height), null, 'Resume', '/mediaFiles/PDFs/Resume.pdf',new Point( 12, -14));
  19. //populuate neighbours. This is how the stations are mapped to the keyboard.
  20. homeNode.neighbours = {'E':projectsNode};
  21. projectsNode.neighbours = {'W':homeNode, 'N':gitNode, 'E':researchNode, 'S': pyProcessNode};
  22. researchNode.neighbours = {'E':blogNode, 'W':projectsNode};
  23. blogNode.neighbours = {'W': researchNode, 'E':resumeNode, 'N':latestBlogNode };
  24. gitNode.neighbours = {'S': projectsNode, 'E':projectsNode};
  25. resumeNode.neighbours = {'W':blogNode, 'E':twNode, 'S':twNode };
  26. latestBlogNode.neighbours = {'S': blogNode, 'E': allBlogsNode};
  27. allBlogsNode.neighbours = {'S': latestBlogNode, 'W':latestBlogNode };
  28. pyProcessNode.neighbours = {'N':projectsNode, 'W':projectsNode };
  29. moreProjectsNode.neighbours = {'N':projectsNode};
  30. // initialize myself.
  31. current_position = homeNode;
  32. current_position.fillNode();
  33. // form the halo around the current position
  34. halo = new Path.Circle( current_position.position, NODE_SIZE );
  35. halo.strokeColor = current_position.line.color;
  36. halo.strokeWidth = 3;
  37. // Some asthetics.
  38. //construct same dashed paths.
  39. var blogconstructionpath = new DashLine( BlogLine.color, allBlogsNode.position + new Point(14,0), allBlogsNode.position + new Point(100, 0) );
  40. var projectsconstructionpath = new DashLine( ProjectsLine.color, moreProjectsNode.position + new Point(14,0), moreProjectsNode.position + new Point(110, 0) );
  41. //create a legend
  42. var p = new Point(20, 140)
  43. var lgnt = new Point(60,0); //these makes the lines uniformly spread out and even.
  44. var btw = new Point(0,25);
  45. var key = new LegendItem( p, p + lgnt, MainLine );
  46. var key = new LegendItem( p + btw, p + btw + lgnt, BlogLine );
  47. var key = new LegendItem( p + btw+btw, p + btw+btw + lgnt, ProjectsLine );
  48. // create a title
  49. var title = new PointText( new Point(20,55) );
  50. title.content = "Metro";
  51. title.characterStyle = {
  52. fillColor: 'black',
  53. fontSize: 28,
  54. font: TEXT_FONT
  55. };