refine heart breathing ripple rhythm

This commit is contained in:
leefer
2026-07-23 20:31:17 +08:00
parent e6db73f9ba
commit fc3e7499d2
4 changed files with 97 additions and 67 deletions
+19 -10
View File
@@ -340,7 +340,7 @@ test("saved daily fortune opens in the reading dialog without regenerating", asy
await expect(page.locator("#heavenReadingHistoryList .heaven-reading-history-item")).toHaveCount(1);
});
test("heart breathing uses five silent eight-second cycles with a fixed enso", async ({ page }) => {
test("heart breathing uses five silent nine-second ripple cycles", async ({ page }) => {
await mockApplication(page, session("user", true));
await page.goto("/index.html");
await page.locator('[data-view="heavenView"]').first().click();
@@ -350,25 +350,34 @@ test("heart breathing uses five silent eight-second cycles with a fixed enso", a
const timing = await page.evaluate(() => ({
remaining: state.heartBreathingEndsAt - Date.now(),
incenseDuration: getComputedStyle(document.querySelector("#heartIncenseEmber")).animationDuration,
inhaleTransform: getComputedStyle(document.querySelector(".heart-breath-enso")).transform,
rippleDuration: getComputedStyle(document.querySelector(".heart-breath-ripple span")).animationDuration,
rippleAnimation: getComputedStyle(document.querySelector(".heart-breath-ripple span")).animationName,
}));
expect(timing.remaining).toBeGreaterThan(39_000);
expect(timing.remaining).toBeLessThanOrEqual(40_000);
expect(timing.incenseDuration).toBe("40s");
expect(timing.remaining).toBeGreaterThan(44_000);
expect(timing.remaining).toBeLessThanOrEqual(45_000);
expect(timing.incenseDuration).toBe("45s");
expect(timing.rippleDuration).toBe("9s");
expect(timing.rippleAnimation).toContain("heart-breath-ripple");
await expect(page.locator("#breathingPhase")).toHaveText("吸气");
await expect(page.locator("#breathingSeconds, #breathingProgress, .breathing-orbit")).toHaveCount(0);
const exhaleTransform = await page.evaluate(() => {
await page.evaluate(() => {
clearInterval(state.heartTimer);
state.heartTimer = null;
state.heartSeconds = 35;
state.heartBreathingEndsAt = Date.now() + 35_000;
state.heartSeconds = 42;
state.heartBreathingEndsAt = Date.now() + 41_500;
updateBreathingDisplay();
});
await expect(page.locator("#breathingScene")).toHaveAttribute("data-phase", "hold");
await expect(page.locator("#breathingPhase")).toHaveText("停驻");
await page.evaluate(() => {
state.heartSeconds = 39;
state.heartBreathingEndsAt = Date.now() + 38_500;
updateBreathingDisplay();
return getComputedStyle(document.querySelector(".heart-breath-enso")).transform;
});
await expect(page.locator("#breathingScene")).toHaveAttribute("data-phase", "exhale");
await expect(page.locator("#breathingPhase")).toHaveText("呼气");
expect(exhaleTransform).toBe(timing.inhaleTransform);
});
test("mobile shell stays within the viewport", async ({ page }) => {