demo/editor/rainyday.js
function RainyDay(options) {
    this.img = document.getElementById(options.element);
    this.opacity = options.opacity || 1;
    this.blurRadius = options.blur || 10;
    this.w = this.img.clientWidth;
    this.h = this.img.clientHeight;
    this.drops = [];

    // prepare canvas elements
    this.canvas = this.prepareCanvas(this.img);
    this.prepareBackground(this.w, this.h);
    this.prepareGlass();

    // assume defaults
    this.reflection = this.REFLECTION_MINIATURE;
    this.trail = this.TRAIL_DROPS;
    this.gravity = this.GRAVITY_NON_LINEAR;
    this.collision = this.COLLISION_SIMPLE;
    this.VARIABLE_GRAVITY_THRESHOLD = 3;
    this.VARIABLE_GRAVITY_ANGLE = Math.PI / 2;
    this.VARIABLE_GRAVITY_ANGLE_VARIANCE = 0;
    this.VARIABLE_FPS = options.fps;
    this.VARIABLE_FILL_STYLE = '#8ED6FF';
    this.VARIABLE_COLLISIONS = true;
    this.REFLECTION_SCALEDOWN_FACTOR = 5;
    this.REFLECTION_DROP_MAPPING_WIDTH = 200;
    this.REFLECTION_DROP_MAPPING_HEIGHT = 200;
}
function RainyDay(options) {
    this.img = document.getElementById(options.element);
    this.opacity = options.opacity || 1;
    this.blurRadius = options.blur || 10;
    this.w = this.img.clientWidth;
    this.h = this.img.clientHeight;
    this.drops = [];

    // prepare canvas elements
    this.canvas = this.prepareCanvas(this.img);
    this.prepareBackground(this.w, this.h);
    this.prepareGlass();

    // assume defaults
    this.reflection = this.REFLECTION_MINIATURE;
    this.trail = this.TRAIL_DROPS;
    this.gravity = this.GRAVITY_NON_LINEAR;
    this.collision = this.COLLISION_SIMPLE;
    this.VARIABLE_GRAVITY_THRESHOLD = 3;
    this.VARIABLE_GRAVITY_ANGLE = Math.PI / 2;
    this.VARIABLE_GRAVITY_ANGLE_VARIANCE = 0;
    this.VARIABLE_FPS = options.fps;
    this.VARIABLE_FILL_STYLE = '#8ED6FF';
    this.VARIABLE_COLLISIONS = true;
    this.REFLECTION_SCALEDOWN_FACTOR = 5;
    this.REFLECTION_DROP_MAPPING_WIDTH = 200;
    this.REFLECTION_DROP_MAPPING_HEIGHT = 200;
}
function RainyDay ( options ) { this . img = document . getElementById ( options . element ) ; this . opacity = options . opacity || 1 ; this . blurRadius = options . blur || 10 ; this . w = this . img . clientWidth ; this . h = this . img . clientHeight ; this . drops = [ ] ; // prepare canvas elements this . canvas = this . prepareCanvas ( this . img ) ; this . prepareBackground ( this . w , this . h ) ; this . prepareGlass ( ) ; // assume defaults this . reflection = this . REFLECTION_MINIATURE ; this . trail = this . TRAIL_DROPS ; this . gravity = this . GRAVITY_NON_LINEAR ; this . collision = this . COLLISION_SIMPLE ; this . VARIABLE_GRAVITY_THRESHOLD = 3 ; this . VARIABLE_GRAVITY_ANGLE = Math . PI / 2 ; this . VARIABLE_GRAVITY_ANGLE_VARIANCE = 0 ; this . VARIABLE_FPS = options . fps ; this . VARIABLE_FILL_STYLE = '#8ED6FF' ; this . VARIABLE_COLLISIONS = true ; this . REFLECTION_SCALEDOWN_FACTOR = 5 ; this . REFLECTION_DROP_MAPPING_WIDTH = 200 ; this . REFLECTION_DROP_MAPPING_HEIGHT = 200 ; }
Defines a new instance of the rainyday.js.
@param options options element with script parameters
Defines a new instance of the rainyday . js .