refactor: 별 속도 조정
This commit is contained in:
@@ -51,7 +51,8 @@ export function FlightStarfieldCanvas({
|
|||||||
|
|
||||||
const setCanvasSize = () => {
|
const setCanvasSize = () => {
|
||||||
const viewportWidth = window.visualViewport?.width ?? window.innerWidth;
|
const viewportWidth = window.visualViewport?.width ?? window.innerWidth;
|
||||||
const viewportHeight = window.visualViewport?.height ?? window.innerHeight;
|
const viewportHeight =
|
||||||
|
window.visualViewport?.height ?? window.innerHeight;
|
||||||
width = Math.max(1, Math.floor(viewportWidth));
|
width = Math.max(1, Math.floor(viewportWidth));
|
||||||
height = Math.max(1, Math.floor(viewportHeight));
|
height = Math.max(1, Math.floor(viewportHeight));
|
||||||
canvas.style.width = `${width}px`;
|
canvas.style.width = `${width}px`;
|
||||||
@@ -113,12 +114,15 @@ export function FlightStarfieldCanvas({
|
|||||||
const deltaX = toX - fromX;
|
const deltaX = toX - fromX;
|
||||||
const deltaY = toY - fromY;
|
const deltaY = toY - fromY;
|
||||||
const movementLength = Math.hypot(deltaX, deltaY);
|
const movementLength = Math.hypot(deltaX, deltaY);
|
||||||
const tailLineWidth = clamp(star.radius * 0.9, 0.65, 1.6);
|
const tailLineWidth = clamp(star.radius * 0.9, 0.78, 1.6);
|
||||||
const canDrawTail =
|
const canDrawTail =
|
||||||
star.tailLength >= FLIGHT_STARFIELD_TUNING.tail.cleanup.minTailLengthToDraw &&
|
star.tailLength >=
|
||||||
movementLength >= FLIGHT_STARFIELD_TUNING.tail.cleanup.minMovementToDraw &&
|
FLIGHT_STARFIELD_TUNING.tail.cleanup.minTailLengthToDraw &&
|
||||||
|
movementLength >=
|
||||||
|
FLIGHT_STARFIELD_TUNING.tail.cleanup.minMovementToDraw &&
|
||||||
visibleAlpha >= FLIGHT_STARFIELD_TUNING.tail.cleanup.minAlphaToDraw &&
|
visibleAlpha >= FLIGHT_STARFIELD_TUNING.tail.cleanup.minAlphaToDraw &&
|
||||||
tailLineWidth >= FLIGHT_STARFIELD_TUNING.tail.cleanup.minLineWidthToDraw;
|
tailLineWidth >=
|
||||||
|
FLIGHT_STARFIELD_TUNING.tail.cleanup.minLineWidthToDraw;
|
||||||
|
|
||||||
if (!canDrawTail) {
|
if (!canDrawTail) {
|
||||||
const snappedToX = snapToDevicePixel(toX);
|
const snappedToX = snapToDevicePixel(toX);
|
||||||
@@ -174,13 +178,14 @@ export function FlightStarfieldCanvas({
|
|||||||
const veil = context.createRadialGradient(
|
const veil = context.createRadialGradient(
|
||||||
vp.x,
|
vp.x,
|
||||||
vp.y,
|
vp.y,
|
||||||
centerProtectRadius * 0.18,
|
centerProtectRadius * 0.12,
|
||||||
vp.x,
|
vp.x,
|
||||||
vp.y,
|
vp.y,
|
||||||
centerProtectRadius * 1.35,
|
centerProtectRadius * 1.35,
|
||||||
);
|
);
|
||||||
veil.addColorStop(0, "rgba(160, 185, 235, 0.08)");
|
veil.addColorStop(0, "rgba(176, 201, 242, 0.11)");
|
||||||
veil.addColorStop(0.55, "rgba(90, 114, 170, 0.03)");
|
veil.addColorStop(0.22, "rgba(138, 164, 216, 0.06)");
|
||||||
|
veil.addColorStop(0.55, "rgba(90, 114, 170, 0.025)");
|
||||||
veil.addColorStop(1, "rgba(0, 0, 0, 0)");
|
veil.addColorStop(1, "rgba(0, 0, 0, 0)");
|
||||||
|
|
||||||
context.fillStyle = veil;
|
context.fillStyle = veil;
|
||||||
|
|||||||
@@ -7,20 +7,20 @@ export const FLIGHT_STARFIELD_TUNING = {
|
|||||||
},
|
},
|
||||||
vanishXJitter: { min: 10, max: 25 },
|
vanishXJitter: { min: 10, max: 25 },
|
||||||
speedTiers: {
|
speedTiers: {
|
||||||
slow: { chance: 0.9, min: 0.003, max: 0.007 },
|
slow: { chance: 0.9, min: 0.00255, max: 0.00595 },
|
||||||
medium: { chance: 0.99, min: 0.007, max: 0.011 },
|
medium: { chance: 0.99, min: 0.00595, max: 0.00935 },
|
||||||
fast: { min: 0.011, max: 0.014 },
|
fast: { min: 0.00935, max: 0.0119 },
|
||||||
},
|
},
|
||||||
tail: {
|
tail: {
|
||||||
pointChance: 0.82,
|
pointChance: 0.82,
|
||||||
shortChance: 0.86,
|
shortChance: 0.86,
|
||||||
pointRange: { min: 0, max: 2.5 },
|
pointRange: { min: 0.5, max: 2.5 },
|
||||||
shortRange: { min: 2.5, max: 3.8 },
|
shortRange: { min: 2.5, max: 3.8 },
|
||||||
longRange: { min: 4, max: 10 },
|
longRange: { min: 4, max: 10 },
|
||||||
cleanup: {
|
cleanup: {
|
||||||
minAlphaToDraw: 0.09,
|
minAlphaToDraw: 0.08,
|
||||||
minMovementToDraw: 0.18,
|
minMovementToDraw: 0.12,
|
||||||
minLineWidthToDraw: 1,
|
minLineWidthToDraw: 0.86,
|
||||||
minTailLengthToDraw: 1,
|
minTailLengthToDraw: 1,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user