Files
Pete/internal/web/season.go
prosolis 24103394ae Canvas-based seasonal weather effects + demo page
Server picks variant from Lisbon-local date (rain/petals/jacaranda/motes/leaves)
and renders behind content via a canvas particle layer. Each variant has a
hand-drawn silhouette so shapes are recognizable. /weather demo route exposes
variant + intensity + phase pickers, locking the time-of-day phase override.
2026-05-25 09:20:35 -07:00

40 lines
1.2 KiB
Go

package web
import "time"
// Weather is the seasonal effect rendered behind the page. Tuned for Lisbon:
// winter is rainy (not snowy), May gets its own jacaranda variant since the
// city turns purple for a few weeks each year, and September stays in summer
// because Portugal's dry spell runs all the way through it.
type Weather struct {
Season string // "winter" | "spring" | "summer" | "autumn"
Variant string // "rain" | "petals" | "jacaranda" | "motes" | "leaves"
Intensity string // "light" | "medium" | "heavy"
}
var lisbon = func() *time.Location {
loc, err := time.LoadLocation("Europe/Lisbon")
if err != nil {
return time.UTC
}
return loc
}()
func currentWeather(now time.Time) Weather {
t := now.In(lisbon)
var season, variant string
switch t.Month() {
case time.December, time.January, time.February:
season, variant = "winter", "rain"
case time.March, time.April:
season, variant = "spring", "petals"
case time.May:
season, variant = "spring", "jacaranda"
case time.June, time.July, time.August, time.September:
season, variant = "summer", "motes"
default: // Oct, Nov
season, variant = "autumn", "leaves"
}
return Weather{Season: season, Variant: variant, Intensity: "heavy"}
}