<commit_before>// Copyright 2016-2018, University of Colorado Boulder

/**
 * model of a cloud that can block energy coming from the sun
 *
 * @author  <NAME>
 * @author  <NAME>
 */
define( function( require ) {
  'use strict';

  // modules
  var energyFormsAndChanges = require( 'ENERGY_FORMS_AND_CHANGES/energyFormsAndChanges' );
  var inherit = require( 'PHET_CORE/inherit' );
  var NumberProperty = require( 'AXON/NumberProperty' );
  var Shape = require( 'KITE/Shape' );

  // constants
  var WIDTH = 0.035; // In meters, though obviously not to scale.  Empirically determined.
  var HEIGHT = WIDTH * 0.55; // determined from the approximate aspect ratio of the image

  /**
   * @param {Vector2} offsetFromParent
   * @param {Property.<Vector2>} parentPositionProperty
   * @constructor
   */
  function Cloud( offsetFromParent, parentPositionProperty ) {
    var self = this;

    // @public {NumberProperty} - existence strength, which basically translates to opacity, of the cloud
    this.existenceStrengthProperty = new NumberProperty( 1.0 );

    // @public (read-only) {number} - offset position for this cloud
    this.offsetFromParent = offsetFromParent;

    // @private {number} - used to calculate this cloud's position
    this.parentPositionProperty = parentPositionProperty;

    this.cloudEllipse = null;

    this.parentPositionProperty.link( function( parentPosition ) {
      var center = parentPosition.plus( self.offsetFromParent );
      self.cloudEllipse = Shape.ellipse( center.x, center.y, WIDTH / 2, HEIGHT / 2, 0, 0, 0, false );
    } );
  }

  energyFormsAndChanges.register( 'Cloud', Cloud );

  return inherit( Object, Cloud, {

    /**
     * return ellipse with size of this cloud
     * @returns {Shape.ellipse} - ellipse with axes sized to width and height of cloud
     * @public
     */
    getCloudAbsorptionReflectionShape: function() {
      return this.cloudEllipse;
    },

    /**
     * @returns {Vector2} Center position of cloud
     * @public
     */
    getCenterPosition: function() {
      return this.parentPositionProperty.get().plus( this.offsetFromParent );
    }

  }, {

    // statics
    WIDTH: WIDTH,
    HEIGHT: HEIGHT
  } );
} );
<commit_msg>Convert to ES6, see https://github.com/phetsims/energy-forms-and-changes/issues/211<commit_after>// Copyright 2016-2019, University of Colorado Boulder

/**
 * model of a cloud that can block energy coming from the sun
 *
 * @author  <NAME>
 * @author  <NAME>
 */
define( require => {
  'use strict';

  // modules
  const energyFormsAndChanges = require( 'ENERGY_FORMS_AND_CHANGES/energyFormsAndChanges' );
  const NumberProperty = require( 'AXON/NumberProperty' );
  const Shape = require( 'KITE/Shape' );

  // constants
  const WIDTH = 0.035; // In meters, though obviously not to scale.  Empirically determined.
  const HEIGHT = WIDTH * 0.55; // determined from the approximate aspect ratio of the image

  class Cloud {

    /**
     * @param {Vector2} offsetFromParent
     * @param {Property.<Vector2>} parentPositionProperty
     */
    constructor( offsetFromParent, parentPositionProperty ) {

      // @public {NumberProperty} - existence strength, which basically translates to opacity, of the cloud
      this.existenceStrengthProperty = new NumberProperty( 1.0 );

      // @public (read-only) {number} - offset position for this cloud
      this.offsetFromParent = offsetFromParent;

      // @private {number} - used to calculate this cloud's position
      this.parentPositionProperty = parentPositionProperty;

      this.cloudEllipse = null;

      this.parentPositionProperty.link( parentPosition => {
        const center = parentPosition.plus( this.offsetFromParent );
        this.cloudEllipse = Shape.ellipse( center.x, center.y, WIDTH / 2, HEIGHT / 2, 0, 0, 0, false );
      } );
    }

    /**
     * return ellipse with size of this cloud
     * @returns {Shape.ellipse} - ellipse with axes sized to width and height of cloud
     * @public
     */
    getCloudAbsorptionReflectionShape() {
      return this.cloudEllipse;
    }

    /**
     * @returns {Vector2} Center position of cloud
     * @public
     */
    getCenterPosition() {
      return this.parentPositionProperty.get().plus( this.offsetFromParent );
    }

  }

  // statics
  Cloud.WIDTH = WIDTH;
  Cloud.HEIGHT = HEIGHT;

  return energyFormsAndChanges.register( 'Cloud', Cloud );
} );

{'fraction_non_alphanumeric': 0.10906193078324226, 'fraction_numerical': 0.012295081967213115, 'mean_word_length': 3.075139146567718, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 11, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2455239', 'n_tokens_mistral': 1360, 'n_tokens_neox': 1248, 'n_words': 370}