Star class - sonataFarm/lost_in_wiki GitHub Wiki

Star handles the display logic for each individual star in StarField. Stylistic properties are defined by the util files get-material.js and star-style.js.

Instance Methods

  • constructor: Takes an options hash representing the initial state of the star being generated. E.g new Star(isLink: true, isFocus: false). Then assigns a material based on the state, then renders the star.

  • focus, unfocus, makeLink, unmakeLink: Assigns/unassigns the isFocus and isLink properties on the state and refreshes the material to reflect the new state.

Utility methods

  • getMaterial: Takes a star's state, returns a three.js material object for rendering. The radius and color properties of the material are defined in star-style.js.