// The SONG PLAYING as a RECORD ON A TURNTABLE AT A PARTY (the coordinator's // pick, 4 Nov 2026; the picture `music9-worlds/party-player`, the proof // `music12-faces/composite-party`): the fourth player face of Music's // Listening deck (beside the hi-fi, the turntable and the amp; the `player` // face setting picks one). It IS the turntable (`SongTurntableFace`, drawn in // `TurntableLook.party`): the same slipmat, record, spindle, arm and jewel, // the record turning at 33⅓ and coasting to rest upright, the arm the clock // and lifted while paused, the same tagged parts and gestures — on the // party's dark wood dance floor (`FaceGround.partyFloor`) under its warm // lights, which the ground drifts slowly, with no lamp. // // What the party draws of its own: // - its LABEL, black paper with a red and a cream ring, turning with the // record: the song's name big in red condensed capitals, two lines at // most, above the spindle; the artist and the album in cream capitals // under it; the time played, the time left and the song's length small at // its foot, typed. Where the album has a cover, the cover goes round // behind the rings, veiled, the words over it (the person chose a party, // not a label); // - the one warm REFLECTION streak, lying still over the record as it turns // (`party-glow`), where the proof lays it; // - the album's COVER lying flat on the floor at the upper left, where it // has one (the `picture` part). // // PAINTED (`Media.xcassets`, `scripts/import-music-materials.py party`): // the floor, the lights, the reflection and the blank label, Round 12, laid // where `music12-faces/layout.json` places them in the turntable's 1420 x // 1450 box; the rest are the turntable's, Round 11, already imported. // // Every word is the card's (`title`, `artist`, `album`, `duration`), the // player's or a line (the turntable's). import CottonPaper import CottonValues import SwiftUI enum SongPartyFaceKnobs { // THE WHOLE DRAWING, in the box's pixels (`layout.json`'s `party`): the // cover lying above the mat at the upper left (`sampleCoverRect`), down // to the box's foot. The mat, the record, the arm, the spindle and the // jewel lie where the turntable's do (`SongTurntableFaceKnobs`): the // layout reuses them unmoved. static let whole = CGRect(x: 0, y: -200, width: 1420, height: 1650) static let cover = CGRect(x: 100, y: -200, width: 330, height: 330) // THE REFLECTION, laid at the size its layout declares (`phoneMaxSize` // 341 points, three pixels a point, so 1365 of the box's four a point) // and placed so its streak lies where the proof has it: down the // record's left, from above the record to under the label. static let glow = CGRect(x: -332, y: 0, width: 1365, height: 1365) // THE LABEL over the record's middle: laid larger than the layout's 390, // as the turntable's is, its round (radius 250) inside the run-out // groove (260). Its painting's pixels (`painted`), every place on it // below being in them, about its centre (512, 512); the painted round // (508, measured off `party-label-blank`, not the layout's 450, which is // inside its red ring), a cover's round, just inside the red ring (its // inner edge 456), and the spindle hole (30). static let label = CGRect(x: 348, y: 498, width: 504, height: 504) static let painted: CGFloat = 1024 static let round: CGFloat = 508 static let coverRound: CGFloat = 452 static let hole: CGFloat = 30 /// The veil over a cover, darker than the dark room's: the red name /// reads on a bright cover only over a deep shade. static let veil: Double = 0.62 // THE LABEL'S WORDS, in the label painting's pixels, on the layout's // `labelTextRects` drawn larger with the label and held inside its rings: // the name above the spindle (two lines at most), the artist and the // album under it, the times at the foot. static let titleBox = CGRect(x: 222, y: 150, width: 580, height: 290) static let titleSize: CGFloat = 116 /// The name's sizes, largest first, each on two lines at most; past the /// last, two lines shrinking. static let titleSteps: [CGFloat] = [1, 0.8] static let artistBox = CGRect(x: 170, y: 600, width: 684, height: 74) static let albumBox = CGRect(x: 180, y: 680, width: 664, height: 70) static let artistSize: CGFloat = 64 static let albumSize: CGFloat = 58 static let timesBox = CGRect(x: 262, y: 790, width: 500, height: 64) static let timeSize: CGFloat = 50 static let timesGap: CGFloat = 34 } /// What the party's label says, in its order: the song's name in capitals, /// red, above the spindle; its artist and its album in capitals, cream, under /// it. public enum PartyLabel { public static func title(_ card: DeckCard) -> String? { card.text("title")?.uppercased() } public static func artist(_ card: DeckCard) -> String? { card.text("artist")?.uppercased() } public static func album(_ card: DeckCard) -> String? { card.text("album")?.uppercased() } } /// The party label's printed words, laid on a square the label's side: the /// song's name in red condensed capitals, two lines at most, the artist and /// the album in cream capitals. The same over a cover: the cover is veiled. struct PartyLabelWords: View { let card: DeckCard let side: CGFloat var body: some View { let knobs = SongPartyFaceKnobs.self let k = side / knobs.painted ZStack(alignment: .topLeading) { if let title = PartyLabel.title(card) { PartyTitle(words: title, s: k) .frame(width: knobs.titleBox.width * k, height: knobs.titleBox.height * k, alignment: .bottom) .offset(x: knobs.titleBox.minX * k, y: knobs.titleBox.minY * k) } if let artist = PartyLabel.artist(card) { capitals(Text(artist).font(.system(size: knobs.artistSize * k, weight: .bold).width(.condensed))) .frame(width: knobs.artistBox.width * k, height: knobs.artistBox.height * k) .offset(x: knobs.artistBox.minX * k, y: knobs.artistBox.minY * k) } if let album = PartyLabel.album(card) { capitals(Text(album).font(CottonFonts.sleeve(knobs.albumSize * k))) .frame(width: knobs.albumBox.width * k, height: knobs.albumBox.height * k) .offset(x: knobs.albumBox.minX * k, y: knobs.albumBox.minY * k) } } .foregroundStyle(MusicMaterial.partyCream.colour) .frame(width: side, height: side, alignment: .topLeading) } /// One line at its size while it fits, else shrinking. private func capitals(_ line: Text) -> some View { ViewThatFits(in: .horizontal) { line.lineLimit(1).fixedSize() line.lineLimit(1).minimumScaleFactor(0.45) } } } /// The song's name (in capitals already) in the party's red condensed type: at its size on one /// line or two, else a step smaller on one or two, else two lines shrinking. private struct PartyTitle: View { let words: String let s: CGFloat var body: some View { let knobs = SongPartyFaceKnobs.self ViewThatFits(in: .vertical) { ForEach(knobs.titleSteps, id: \.self) { step in line(knobs.titleSize * step).fixedSize(horizontal: false, vertical: true) } line(knobs.titleSize * knobs.titleSteps[knobs.titleSteps.count - 1]) .lineLimit(2) .minimumScaleFactor(0.4) } .foregroundStyle(MusicMaterial.partyRed.colour) } private func line(_ size: CGFloat) -> some View { Text(words) .font(CottonFonts.sleeve(size * s)) .multilineTextAlignment(.center) } } /// The party's face, and the songs it is reviewed playing: the turntable's /// songs, under the player the app installs (`faceTrackPlayer`), else paused. public enum SongPartyFaceCatalogue { public static let stock: FaceStock = .own public static let ground: FaceGround = .partyFloor public static let face = Face(id: "song.party", specimens: [ Specimen("playing", harbour, picture: "poster-ferry", play: TrackPlay(held: true, playing: true, elapsed: 134, duration: 242)), Specimen("paused", harbour, picture: "poster-ferry", play: TrackPlay(held: true, playing: false, elapsed: 134, duration: 242)), Specimen("no cover", train, play: TrackPlay(held: true, playing: true, elapsed: 61, duration: 197)), Specimen("largest", largest, play: TrackPlay(held: true, playing: false, elapsed: 312, duration: 669)), ]) { card, picture, _ in TrackPlaying(card: card) { player in SongTurntableFace(card: card, cover: picture, play: player.play, toggle: player.toggle, seek: player.seek, look: .party) } } /// An invented song off an invented album, 4:02 long. public static let harbour = DeckCard(face: .songParty, fields: [ "title": .text("Harbour Lights"), "artist": .text("The Low Tide"), "album": .text("Night Ferry"), "duration": .number(242), ]) /// Another album's song, no cover, 3:17 long. public static let train = DeckCard(face: .songParty, fields: [ "title": .text("Slow Train"), "artist": .text("Mara Vance"), "album": .text("Common Ground"), "duration": .number(197), ]) /// The longest words, no cover, drawn at every text size Loom has, the /// largest among them. public static let largest = DeckCard(face: .songParty, fields: [ "title": .text("The Slow Train Home Through Sixteen Lanterns"), "artist": .text("Mara Vance and The Low Tide"), "album": .text("Sixteen Lanterns and the Blue Hour Sessions"), "duration": .number(669), ]) }