Demo animation improvements: grid visibility, smooth scroll, fluid fill

- Fix grid visibility: show gray background cells always, animate mood
  colors on top with scale 2x->1x effect
- Add smooth auto-scroll for MonthView: starts after first month is 50%
  filled, scrolls at constant speed to match fill rate
- Remove pause between months for fluid continuous animation
- Add currentAnimatingMonthIndex tracking to DemoAnimationManager

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Trey t
2026-01-29 11:46:57 -06:00
parent 8e0f69c29a
commit 15ff52d043
3 changed files with 140 additions and 111 deletions

View File

@@ -29,8 +29,8 @@ final class DemoAnimationManager: ObservableObject {
/// Total animation duration for filling all cells in one month
let monthAnimationDuration: TimeInterval = 1.5
/// Delay between months
let monthDelay: TimeInterval = 0.3
/// Delay between months (0 for fluid continuous animation)
let monthDelay: TimeInterval = 0.0
/// Delay between each cell in year view
let yearCellDelay: TimeInterval = 0.05
@@ -116,6 +116,23 @@ final class DemoAnimationManager: ObservableObject {
return Double(monthIndex) * (monthAnimationDuration + monthDelay)
}
/// Returns the current month index being animated (for auto-scrolling)
var currentAnimatingMonthIndex: Int {
guard animationStarted else { return 0 }
let monthDuration = monthAnimationDuration + monthDelay
return Int(animationProgress / monthDuration)
}
/// Returns the approximate row being animated within current month (0-5 typically)
func currentAnimatingRow(totalRows: Int, totalColumns: Int) -> Int {
guard animationStarted else { return 0 }
let monthDuration = monthAnimationDuration + monthDelay
let progressInMonth = animationProgress.truncatingRemainder(dividingBy: monthDuration)
let normalizedProgress = min(1.0, progressInMonth / monthAnimationDuration)
let cellIndex = Int(normalizedProgress * Double(totalRows * totalColumns))
return cellIndex / totalColumns
}
/// Check if a cell should be visible based on current animation progress
/// For MonthView: animates cells within each month from top-left to bottom-right
/// - Parameters: