Sfoglia il codice sorgente

Rename pingPong to pingpong

Marco Fugaro 4 anni fa
parent
commit
38fd1144f3

+ 3 - 3
docs/api/en/math/MathUtils.html

@@ -64,10 +64,10 @@
 		Linear mapping of [page:Float x] from range [[page:Float a1], [page:Float a2]] to range [[page:Float b1], [page:Float b2]].
 		</p>
 
-		<h3>[method:Float pingPong]( [param:Float x], [param:Float length] )</h3>
+		<h3>[method:Float pingpong]( [param:Float x], [param:Float length] )</h3>
 		<p>
-		[page:Float x] — The value to pingPong.<br />
-		[page:Float length] — The positive value the function will pingPong to. Default is 1.<br /><br />
+		[page:Float x] — The value to pingpong.<br />
+		[page:Float length] — The positive value the function will pingpong to. Default is 1.<br /><br />
 
 		Returns a value that alternates between 0 and [param:Float length].</p>
 

+ 3 - 3
docs/api/zh/math/MathUtils.html

@@ -61,10 +61,10 @@
 		x从范围[[page:Float a1], [page:Float a2]] 到范围[[page:Float b1], [page:Float b2]]的线性映射。
 		</p>
 
-		<h3>[method:Float pingPong]( [param:Float x], [param:Float length] )</h3>
+		<h3>[method:Float pingpong]( [param:Float x], [param:Float length] )</h3>
 		<p>
-		[page:Float x] — The value to pingPong.<br />
-		[page:Float length] — The positive value the function will pingPong to. Default is 1.<br /><br />
+		[page:Float x] — The value to pingpong.<br />
+		[page:Float length] — The positive value the function will pingpong to. Default is 1.<br /><br />
 
 		Returns a value that alternates between 0 and [param:Float length].</p>
 

+ 3 - 3
src/math/MathUtils.d.ts

@@ -88,11 +88,11 @@ export namespace MathUtils {
 	/**
 	 * Returns a value that alternates between 0 and length.
 	 *
-	 * @param x The value to pingPong.
-	 * @param length The positive value the function will pingPong to. Default is 1.
+	 * @param x The value to pingpong.
+	 * @param length The positive value the function will pingpong to. Default is 1.
 	 * @return {number}
 	 */
-	export function pingPong( x: number, length?: number ): number;
+	export function pingpong( x: number, length?: number ): number;
 
 	/**
 	 * @deprecated Use {@link Math#floorPowerOfTwo .floorPowerOfTwo()}

+ 1 - 1
src/math/MathUtils.js

@@ -64,7 +64,7 @@ const MathUtils = {
 
 	// https://www.desmos.com/calculator/vcsjnyz7x4
 
-	pingPong: function ( x, length = 1 ) {
+	pingpong: function ( x, length = 1 ) {
 
 		return length - Math.abs( MathUtils.euclideanModulo( x, length * 2 ) - length );
 

+ 4 - 4
test/unit/src/math/MathUtils.tests.js

@@ -153,11 +153,11 @@ export default QUnit.module( 'Maths', () => {
 		} );
 
 
-		QUnit.test( "pingPong", ( assert ) => {
+		QUnit.test( "pingpong", ( assert ) => {
 
-			assert.strictEqual( MathUtils.pingPong( 2.5 ), 0.5, "Value at 2.5 is 0.5" );
-			assert.strictEqual( MathUtils.pingPong( 2.5, 2 ), 1.5, "Value at 2.5 with length of 2 is 1.5" );
-			assert.strictEqual( MathUtils.pingPong( - 1.5 ), 0.5, "Value at -1.5 is 0.5" );
+			assert.strictEqual( MathUtils.pingpong( 2.5 ), 0.5, "Value at 2.5 is 0.5" );
+			assert.strictEqual( MathUtils.pingpong( 2.5, 2 ), 1.5, "Value at 2.5 with length of 2 is 1.5" );
+			assert.strictEqual( MathUtils.pingpong( - 1.5 ), 0.5, "Value at -1.5 is 0.5" );
 
 		} );