Source: app01a/model/ModelCircle.js

/**
 * @author    Wolfgang Kowarschick <kowa@hs-augsburg.de>
 * @copyright 2017 - 2018
 * @license   CC-BY-NC-SA-4.0
 */

/**
 * @module app01a/model/ModelCircle
 */

/**
 * @property {number} r  - the radius of the circle
 * @property {number} x  - the x position of the circle
 * @property {number} y  - the y position of the circle
 * @property {number} vx - the x velocity of the circle
 * @property {number} vy - the y velocity of the circle
 */
class ModelCircle
{ /**
   * @param {Object} [p_config]
   * @param {number} [p_config.r = 0]
   * @param {number} [p_config.x = 0]
   * @param {number} [p_config.y = 0]
   * @param {number} [p_config.vx = 0]
   * @param {number} [p_config.vy = 0]
   */
  constructor({ r: p_r  = 0,
                x: p_x  = 0,  y: p_y  = 0,
               vx: p_vx = 0, vy: p_vy = 0
              } = {}
             )
  { this.r  = p_r;
    this.x  = p_x;  this.y  = p_y;
    this.vx = p_vx; this.vy = p_vy;
  }

  /**
   * @param {number} p_delta_s - time in seconds since last call (max 1/60)
   */
  update(p_delta_s)
  { this.x += this.vx * p_delta_s;
    this.y += this.vy * p_delta_s;
  }
}

export default ModelCircle;