-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
417 additions
and
296 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { EMITTER_WIDTH, EMITTER_X_POSITION_MULTIPLIER } from "./constants"; | ||
import { getEmitterPositions, getGenerateDynamicYZPosition, getTangleDistances, randomIntFromInterval } from "./utils"; | ||
|
||
const generateYZPositions = getGenerateDynamicYZPosition(); | ||
|
||
interface IPos { | ||
x: number; | ||
y: number; | ||
z: number; | ||
} | ||
export function getBlockTargetPosition(initPosition: IPos, bps: number): IPos { | ||
const { y, z } = generateYZPositions(bps, initPosition); | ||
|
||
const emitterMinX = initPosition.x - EMITTER_WIDTH / 2; | ||
const emitterMaxX = initPosition.x + EMITTER_WIDTH / 2; | ||
|
||
const minX = emitterMinX - (emitterMaxX - emitterMinX) * EMITTER_X_POSITION_MULTIPLIER; | ||
const maxX = emitterMaxX + (emitterMaxX - emitterMinX) * EMITTER_X_POSITION_MULTIPLIER; | ||
|
||
const x = randomIntFromInterval(minX, maxX); | ||
|
||
return { x, y, z }; | ||
} | ||
|
||
export function getBlockInitPosition(currentAnimationTime: number): IPos { | ||
const { xTangleDistance } = getTangleDistances(); | ||
const { x: xEmitterPos, y, z } = getEmitterPositions(currentAnimationTime); | ||
const x = xEmitterPos + xTangleDistance / 2; | ||
|
||
return { x, y, z }; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.