function set( opacity ) {
	/* eslint-disable no-invalid-this */
	var isNum = isNumber( opacity );
	if ( !isNum && !isFunction( opacity ) ) {
		throw new TypeError( format( 'invalid assignment. `%s` must be a number or a function. Value: `%s`.', 'opacity', opacity ) );
	}
	if ( isNum && (opacity !== opacity || opacity < 0.0 || opacity > 1.0) ) {
		throw new RangeError( format( 'invalid assignment. `%s` must be a number on the interval: [0, 1]. Value: `%f`.', 'opacity', opacity ) );
	}
	if ( opacity !== this._opacity ) {
		debug( 'Current value: %d.', this._opacity );

		this._opacity = opacity;
		debug( 'New Value: %d.', this._opacity );

		this.emit( 'change' );
	}
}
Sets the opacity.

@private
@param {(number|Function)} opacity - opacity
@throws {TypeError} must be a number or a function
@throws {RangeError} must be a number on the interval `[0,1]`