phetsims / color-vision

"Color Vision" is an educational simulation in HTML5, by PhET Interactive Simulations.
http://phet.colorado.edu/en/simulation/color-vision
GNU General Public License v3.0
1 stars 7 forks source link

Should photon attributes be determined in Photon or PhotonBeam? #28

Closed aaronsamuel137 closed 10 years ago

aaronsamuel137 commented 10 years ago

I am noticing that I am setting some attributes of the photon in the Photon's constructorDuplicateFactory method, and some in the PhotonBeam update animation frame method. For instance, the random offset for the y-velocity (fanning) is determined in the Photon class, while the random offset to the x-location is determined in the PhotonBeam class (because it depends of dt). Seems like there is probably a cleaner way to handle this.

samreid commented 10 years ago

Yes, as we discussed, it would be better to pass in the x-offset to the createFromPool function so that the value can be created with the right value initially.

aaronsamuel137 commented 10 years ago

Closing.