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:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user