@@ -708,25 +708,28 @@ var Camera = new Class({
708708 } ,
709709
710710 /**
711- * [description]
711+ * Fades the Camera to the given color over the duration specified.
712712 *
713713 * @method Phaser.Cameras.Scene2D.Camera#fade
714714 * @since 3.0.0
715715 *
716- * @param {number } duration - [description]
717- * @param {number } red - [description]
718- * @param {number } green - [description]
719- * @param {number } blue - [description]
720- * @param {number } force - [description]
721- * @param {function } callback - [description]
716+ * @param {number } duration - The duration of the effect in milliseconds.
717+ * @param {number } [ red=0] - The value to fade the red channel to. A value between 0 and 1.
718+ * @param {number } [ green=0] - The value to fade the green channel to. A value between 0 and 1.
719+ * @param {number } [ blue=0] - The value to fade the blue channel to. A value between 0 and 1.
720+ * @param {boolean } [ force=false] - Force the fade effect to start immediately, even if already running.
721+ * @param {function } [ callback] - An optional callback to invoke when the fade completes. Will be sent one argument - a reference to this camera.
722722 *
723723 * @return {Phaser.Cameras.Scene2D.Camera } This Camera instance.
724724 */
725725 fade : function ( duration , red , green , blue , force , callback )
726726 {
727+ if ( ! duration ) { duration = 0 ; }
727728 if ( red === undefined ) { red = 0 ; }
728729 if ( green === undefined ) { green = 0 ; }
729730 if ( blue === undefined ) { blue = 0 ; }
731+ if ( force === undefined ) { force = false ; }
732+ if ( callback === undefined ) { callback = null ; }
730733
731734 if ( ! force && this . _fadeAlpha > 0 )
732735 {
@@ -736,77 +739,71 @@ var Camera = new Class({
736739 this . _fadeRed = red ;
737740 this . _fadeGreen = green ;
738741 this . _fadeBlue = blue ;
739- this . _fadeCallback = callback || null ;
740-
741- if ( duration <= 0 )
742- {
743- duration = Number . MIN_VALUE ;
744- }
745-
742+ this . _fadeCallback = callback ;
746743 this . _fadeDuration = duration ;
747- this . _fadeAlpha = Number . MIN_VALUE ;
744+ this . _fadeAlpha = 0 ;
748745
749746 return this ;
750747 } ,
751748
752749 /**
753- * [description]
750+ * Flashes the Camera to the given color over the duration specified.
754751 *
755752 * @method Phaser.Cameras.Scene2D.Camera#flash
756753 * @since 3.0.0
757754 *
758- * @param {number } duration - [description]
759- * @param {number } red - [description]
760- * @param {number } green - [description]
761- * @param {number } blue - [description]
762- * @param {number } force - [description]
763- * @param {function } callback - [description]
755+ * @param {number } duration - The duration of the effect in milliseconds.
756+ * @param {number } [ red=1] - The value to flash the red channel to. A value between 0 and 1.
757+ * @param {number } [ green=1] - The value to flash the green channel to. A value between 0 and 1.
758+ * @param {number } [ blue=1] - The value to flash the blue channel to. A value between 0 and 1.
759+ * @param {boolean } [ force=false] - Force the flash effect to start immediately, even if already running.
760+ * @param {function } [ callback] - An optional callback to invoke when the flash completes. Will be sent one argument - a reference to this camera.
764761 *
765762 * @return {Phaser.Cameras.Scene2D.Camera } This Camera instance.
766763 */
767764 flash : function ( duration , red , green , blue , force , callback )
768765 {
769- if ( ! force && this . _flashAlpha > 0.0 )
766+ if ( ! duration ) { duration = 0 ; }
767+ if ( red === undefined ) { red = 1 ; }
768+ if ( green === undefined ) { green = 1 ; }
769+ if ( blue === undefined ) { blue = 1 ; }
770+ if ( force === undefined ) { force = false ; }
771+ if ( callback === undefined ) { callback = null ; }
772+
773+ if ( ! force && this . _flashAlpha > 0 )
770774 {
771775 return this ;
772776 }
773777
774- if ( red === undefined ) { red = 1.0 ; }
775- if ( green === undefined ) { green = 1.0 ; }
776- if ( blue === undefined ) { blue = 1.0 ; }
777-
778778 this . _flashRed = red ;
779779 this . _flashGreen = green ;
780780 this . _flashBlue = blue ;
781- this . _flashCallback = callback || null ;
782-
783- if ( duration <= 0 )
784- {
785- duration = Number . MIN_VALUE ;
786- }
787-
781+ this . _flashCallback = callback ;
788782 this . _flashDuration = duration ;
789- this . _flashAlpha = 1.0 ;
783+ this . _flashAlpha = 1 ;
790784
791785 return this ;
792786 } ,
793787
794788 /**
795- * [description]
789+ * Shakes the Camera by the given intensity over the duration specified.
796790 *
797791 * @method Phaser.Cameras.Scene2D.Camera#shake
798792 * @since 3.0.0
799793 *
800- * @param {number } duration - [description]
801- * @param {number } intensity - [description]
802- * @param {number } force - [description]
803- * @param {function } callback - [description]
794+ * @param {number } duration - The duration of the effect in milliseconds.
795+ * @param {number } [ intensity=0.05] - The intensity of the shake.
796+ * @param {boolean } [ force=false] - Force the shake effect to start immediately, even if already running.
797+ * @param {function } [ callback] - An optional callback to invoke when the shake completes. Will be sent one argument - a reference to this camera.
804798 *
805799 * @return {Phaser.Cameras.Scene2D.Camera } This Camera instance.
806800 */
807801 shake : function ( duration , intensity , force , callback )
808802 {
803+ if ( ! duration ) { duration = 0 ; }
809804 if ( intensity === undefined ) { intensity = 0.05 ; }
805+ if ( force === undefined ) { force = false ; }
806+ if ( callback === undefined ) { callback = null ; }
810807
811808 if ( ! force && ( this . _shakeOffsetX !== 0 || this . _shakeOffsetY !== 0 ) )
812809 {
@@ -817,7 +814,7 @@ var Camera = new Class({
817814 this . _shakeIntensity = intensity ;
818815 this . _shakeOffsetX = 0 ;
819816 this . _shakeOffsetY = 0 ;
820- this . _shakeCallback = callback || null ;
817+ this . _shakeCallback = callback ;
821818
822819 return this ;
823820 } ,
@@ -1087,7 +1084,7 @@ var Camera = new Class({
10871084 * @since 3.0.0
10881085 *
10891086 * @param {number } x - [description]
1090- * @param {number } y - [description]
1087+ * @param {number } [y=x] - [description]
10911088 *
10921089 * @return {Phaser.Cameras.Scene2D.Camera } This Camera instance.
10931090 */
@@ -1107,7 +1104,7 @@ var Camera = new Class({
11071104 * @method Phaser.Cameras.Scene2D.Camera#setRotation
11081105 * @since 3.0.0
11091106 *
1110- * @param {number } value - [description]
1107+ * @param {number } [ value=0] - [description]
11111108 *
11121109 * @return {Phaser.Cameras.Scene2D.Camera } This Camera instance.
11131110 */
@@ -1161,7 +1158,7 @@ var Camera = new Class({
11611158 * @since 3.0.0
11621159 *
11631160 * @param {number } x - [description]
1164- * @param {number } y - [description]
1161+ * @param {number } [y=x] - [description]
11651162 *
11661163 * @return {Phaser.Cameras.Scene2D.Camera } This Camera instance.
11671164 */
@@ -1182,7 +1179,7 @@ var Camera = new Class({
11821179 * @since 3.0.0
11831180 *
11841181 * @param {number } width - [description]
1185- * @param {number } height - [description]
1182+ * @param {number } [ height=width] - [description]
11861183 *
11871184 * @return {Phaser.Cameras.Scene2D.Camera } This Camera instance.
11881185 */
@@ -1225,7 +1222,7 @@ var Camera = new Class({
12251222 * @method Phaser.Cameras.Scene2D.Camera#setZoom
12261223 * @since 3.0.0
12271224 *
1228- * @param {float } value - [description]
1225+ * @param {float } [ value=1] - [description]
12291226 *
12301227 * @return {Phaser.Cameras.Scene2D.Camera } This Camera instance.
12311228 */
@@ -1244,19 +1241,18 @@ var Camera = new Class({
12441241 * @method Phaser.Cameras.Scene2D.Camera#startFollow
12451242 * @since 3.0.0
12461243 *
1247- * @param {Phaser.GameObjects.GameObject|object } gameObjectOrPoint - [description]
1244+ * @param {Phaser.GameObjects.GameObject|object } target - [description]
12481245 * @param {boolean } roundPx - [description]
12491246 *
12501247 * @return {Phaser.Cameras.Scene2D.Camera } This Camera instance.
12511248 */
1252- startFollow : function ( gameObjectOrPoint , roundPx )
1249+ startFollow : function ( target , roundPx )
12531250 {
1254- this . _follow = gameObjectOrPoint ;
1251+ if ( roundPx === undefined ) { roundPx = false ; }
12551252
1256- if ( roundPx !== undefined )
1257- {
1258- this . roundPixels = roundPx ;
1259- }
1253+ this . _follow = target ;
1254+
1255+ this . roundPixels = roundPx ;
12601256
12611257 return this ;
12621258 } ,
@@ -1326,8 +1322,8 @@ var Camera = new Class({
13261322 {
13271323 this . _flashAlpha = 0 ;
13281324 this . _fadeAlpha = 0 ;
1329- this . _shakeOffsetX = 0.0 ;
1330- this . _shakeOffsetY = 0.0 ;
1325+ this . _shakeOffsetX = 0 ;
1326+ this . _shakeOffsetY = 0 ;
13311327 this . _shakeDuration = 0 ;
13321328
13331329 return this ;
@@ -1344,50 +1340,55 @@ var Camera = new Class({
13441340 */
13451341 update : function ( time , delta )
13461342 {
1347- if ( this . _flashAlpha > 0.0 )
1343+ if ( this . _flashAlpha > 0 )
13481344 {
13491345 this . _flashAlpha -= delta / this . _flashDuration ;
13501346
1351- if ( this . _flashAlpha < 0. 0)
1347+ if ( this . _flashAlpha <= 0 )
13521348 {
1353- this . _flashAlpha = 0.0 ;
1354- }
1355- if ( this . _flashCallback !== null && this . _flashAlpha === 0.0 )
1356- {
1357- this . _flashCallback ( ) ;
1358- this . _flashCallback = null ;
1349+ this . _flashAlpha = 0 ;
1350+
1351+ if ( this . _flashCallback )
1352+ {
1353+ this . _flashCallback ( this ) ;
1354+
1355+ this . _flashCallback = null ;
1356+ }
13591357 }
13601358 }
13611359
1362- if ( this . _fadeAlpha > 0.0 && this . _fadeAlpha < 1.0 )
1360+ if ( this . _fadeAlpha > 0 && this . _fadeAlpha < 1 )
13631361 {
13641362 this . _fadeAlpha += delta / this . _fadeDuration ;
13651363
1366- if ( this . _fadeAlpha >= 1.0 )
1367- {
1368- this . _fadeAlpha = 1.0 ;
1369- }
1370- if ( this . _fadeCallback !== null && this . _fadeAlpha === 1.0 )
1364+ if ( this . _fadeAlpha >= 1 )
13711365 {
1372- this . _fadeCallback ( ) ;
1373- this . _fadeCallback = null ;
1366+ this . _fadeAlpha = 1 ;
1367+
1368+ if ( this . _fadeCallback )
1369+ {
1370+ this . _fadeCallback ( this ) ;
1371+
1372+ this . _fadeCallback = null ;
1373+ }
13741374 }
13751375 }
13761376
1377- if ( this . _shakeDuration > 0.0 )
1377+ if ( this . _shakeDuration > 0 )
13781378 {
13791379 var intensity = this . _shakeIntensity ;
13801380
13811381 this . _shakeDuration -= delta ;
13821382
1383- if ( this . _shakeDuration <= 0.0 )
1383+ if ( this . _shakeDuration <= 0 )
13841384 {
1385- this . _shakeOffsetX = 0.0 ;
1386- this . _shakeOffsetY = 0.0 ;
1385+ this . _shakeOffsetX = 0 ;
1386+ this . _shakeOffsetY = 0 ;
13871387
1388- if ( this . _shakeCallback !== null )
1388+ if ( this . _shakeCallback )
13891389 {
1390- this . _shakeCallback ( ) ;
1390+ this . _shakeCallback ( this ) ;
1391+
13911392 this . _shakeCallback = null ;
13921393 }
13931394 }
0 commit comments