Liquid Glass and Apple Music touches for the Spotify iOS app. A GPL-3.0 fork of spoti.pw 0.21.1.
C
fix: Apple Music's tall animated covers fill the redesigned player (#40)
My-Name-Is-Jeffb34944fe33ef
diff --git a/tweak/Sources/Redesigned/Player/PlayerMotion.x b/tweak/Sources/Redesigned/Player/PlayerMotion.xindex 669e2248..09b707dd 100644--- a/tweak/Sources/Redesigned/Player/PlayerMotion.x+++ b/tweak/Sources/Redesigned/Player/PlayerMotion.x@@ -46,8 +46,9 @@static const CGFloat kFootFrom = 0.9;// The share of the poster's height, at its bottom, drawn on down as the foot (one pixel row at least).static const CGFloat kFootRows = 0.01;-// A clip this much taller than wide is a Canvas, drawn to the window's full height.-static const CGFloat kCanvasAspect = 1.5;+// A clip this much taller than wide is drawn to the window's full height and centered, cut at its sides: a Canvas+// (9:16) or Apple Music's tall cover (3:4). A square one keeps its own height, from the top.+static const CGFloat kCanvasAspect = 1.05;// The blur starts at the seam, or this share of the screen down where that is higher, so it is under the// controls whatever the clip's shape; it is whole kBlurRamp points below its start.static const CGFloat kBlurByControls = 0.6, kBlurRamp = 96;@@ -122,6 +123,7 @@ static CGFloat brightEnd(NSData *luminances) {AVPlayerLayer *_clip;CAGradientLayer *_clipMask, *_seamMask;CALayer *_foot;+ CGFloat _footRows; // the share of the poster's height the foot draws, from its bottomCALayer *_dim; // black over the clip and its foot, as dark as the clip is brightNSMutableData *_luminances; // of the frames measured so farBOOL _lyricsUp;@@ -219,6 +221,9 @@ static UIBlurEffect *blurEffect(void) {_clip.frame = _still.bounds;_clipMask.frame = _still.bounds;_foot.frame = CGRectMake(0, seam, width, MAX(0, total - seam));+ // The foot takes the same middle the clip shows when it is drawn taller than its shape and cut at its sides.+ CGFloat shown = _aspect > 0 ? MIN(1, width * _aspect / height) : 1;+ _foot.contentsRect = CGRectMake((1 - shown) / 2, 1 - _footRows, shown, _footRows);_dim.frame = bounds;_seamMask.frame = bounds;_seamMask.locations = @[@(MIN(1, blurFrom / total)), @(MIN(1, (blurFrom + kBlurRamp) / total))];@@ -228,10 +233,10 @@ static UIBlurEffect *blurEffect(void) {- (void)playFile:(NSURL *)file poster:(UIImage *)poster {_aspect = poster.size.height / poster.size.width;// The poster's last rows, stretched from the seam to the bottom: the clip goes on down in its own color.- CGFloat rows = MAX(kFootRows, 1 / MAX(1, poster.size.height * poster.scale));+ _footRows = MAX(kFootRows, 1 / MAX(1, poster.size.height * poster.scale));_foot.contents = (__bridge id)poster.CGImage;_still.contents = (__bridge id)poster.CGImage;- _foot.contentsRect = CGRectMake(0, 1 - rows, 1, rows);+ [self setNeedsLayout];_player = [AVQueuePlayer new];_player.muted = YES;_player.preventsDisplaySleepDuringVideoPlayback = NO;