It is currently April 30th, 2024, 3:18 pm

Album cover animations: Help

Get help with creating, editing & fixing problems with skins
bernardovs23
Posts: 28
Joined: April 6th, 2017, 2:43 pm

Album cover animations: Help

Post by bernardovs23 »

Hi! :welcome:

I am making a Spotify player and I wanted to make the rotate when Spotify is playing and when it's not, the rotation would stop but when I try to code that there are too many errors, can you help me out?
User avatar
FreeRaider
Posts: 826
Joined: November 20th, 2012, 11:58 pm

Re: Album cover animations: Help

Post by FreeRaider »

Post your code please
bernardovs23
Posts: 28
Joined: April 6th, 2017, 2:43 pm

Re: Album cover animations: Help

Post by bernardovs23 »

FreeRaider wrote:Post your code please
I deleted my try to rotate. If you want it, send me a private message -> https://forum.rainmeter.net/ucp.php?i=pm&mode=compose&u=40211

Code: Select all

[Rainmeter]
Update=1
DynamicWindowSize=1
[Metadata]
Name=			Rainify
Author=			@bernardovs23
Information=	Spotify player with the spotify style
Version=		1.0
[Variables]
@Include=#@#Variables.ini
[Measure.AlbumArt]
Measure=Plugin
Plugin=SpotifyPlugin.dll
Type=AlbumArt
DefaultPath=#@#Default.png
CoverPath=#@#Cover.png
[Measure.Progress]
Measure=Plugin
Plugin=SpotifyPlugin.dll
Type=Progress
[Measure.TrackName]
Measure=Plugin
Plugin=SpotifyPlugin.dll
Type=TrackName
[Measure.ArtistName]
Measure=Plugin
Plugin=SpotifyPlugin.dll
Type=ArtistName
[Measure.AlbumName]
Measure=Plugin
Plugin=SpotifyPlugin.dll
Type=AlbumName
[Meter.AlbumArt]
Meter=Image
ImageName=[Measure.AlbumArt]
W=(#Size#*2.5)
DynamicVariables=1
[Meter.Progress]
Meter=Bar
MeasureName=Measure.Progress
Y=R
W=(#Size#*2.5)
H=(#Size#*0.05)
BarColor=29,185,84
SolidColor=40,40,40
BarOrientation=Horizontal
DynamicVariables=1
[Meter.TrackName]
Meter=String
MeasureName=Measure.TrackName
Y=R
X=125
W=(#Size#*2.5)
SolidColor=23,23,23
FontFace=#Font#
FontSize=15
FontColor=255,255,255
StringStyle=Bold
StringAlign=Center
AntiAlias=1
DynamicVariables=1
[Meter.ArtistName]
Meter=String
MeasureName=Measure.ArtistName
Y=R
X=r
W=(#Size#*2.5)
SolidColor=23,23,23
FontFace=#Font#
FontSize=15
FontColor=255,255,255
StringAlign=Center
AntiAlias=1
DynamicVariables=1
[Meter.AlbumName]
Meter=String
MeasureName=Measure.AlbumName
Y=R
X=r
W=(#Size#*2.5)
SolidColor=23,23,23
FontFace=#Font#
FontSize=10
FontColor=255,255,255
StringAlign=Center
AntiAlias=1
DynamicVariables=1
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5407
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: Album cover animations: Help

Post by eclectic-tech »

I do not use Spotify, but can provide a simple example that might help.

I added the missing #Size# variable, and added variables for the cover width and height (set these values to your cover image size).
Added a loop measure [MeasureLoop360] to control rotation.
Modified [Measure.AlbumArt] to substitute images if none are found.
And changed your [Meter.AlbumArt] to Meter=Rotator

Here is the code I added and changed:

Code: Select all

[Variables]
@Include=#@#Variables.ini
Size=1
CoverWidth=134
CoverHeight=134

[MeasureLoop360]
Measure=Loop
StartValue=0
EndValue=359
Increment=1
LoopCount=0

[Measure.AlbumArt]
Measure=Plugin
Plugin=SpotifyPlugin.dll
Type=AlbumArt
Substitute="":"#@#default.png","0":"#@#default.png"

[Meter.AlbumArt]
Meter=Rotator
MeasureName=MeasureLoop360
ImageName=[Measure.AlbumArt]
W=#CoverWidth#
H=#CoverHeight#
OffsetX=(#CoverWidth#/2)
OffsetY=(#CoverHeight#/2)
; Next line used to simulate Spotify play/pause 
; You will need to create a measure for that
LeftMouseUpAction=[!ToggleMeasure MeasureLoop360]

;....
You will need to create a measure to determine Spotify's current state (Play/Pause/Stop) and use that to toggle the rotation; I used a mouse action to simulate.

Hope this helps get you closer...
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5407
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: Album cover animations: Help

Post by eclectic-tech »

Aside: If your cover image is not square, then you may want to use a slightly different formula for the meter width and height, to avoid clipping the image during rotation:

Code: Select all

[Meter.AlbumArt]
Meter=Rotator
MeasureName=MeasureLoop360
ImageName=[Measure.AlbumArt]
W=(Sqrt(#CoverWidth#**2+#CoverHeight#**2))
H=(Sqrt(#CoverWidth#**2+#CoverHeight#**2))
OffsetX=(#CoverWidth#/2)
OffsetY=(#CoverHeight#/2)
; Next line used to simulate Spotify not play/pause 
; You will need to create a measure for that
LeftMouseUpAction=[!ToggleMeasure MeasureLoop360]
bernardovs23
Posts: 28
Joined: April 6th, 2017, 2:43 pm

Re: Album cover animations: Help

Post by bernardovs23 »

eclectic-tech wrote:I do not use Spotify, but can provide a simple example that might help.

I added the missing #Size# variable, and added vari...
Ummm... So this happened

https://i.imgur.com/dvxlzvG.png

I tried to fix it but nope, just didn't made sense
User avatar
balala
Rainmeter Sage
Posts: 16190
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Album cover animations: Help

Post by balala »

bernardovs23 wrote:Ummm... So this happened
I didn't understand from the posted image what's happened, but if you still have errors using the rotator meter(s), you could try to switch to a simple image meter and rotate it with a TransformationMatrix (well, I have to admit that since the moment I understood how this option works, I became a huge "fan" of it).
If you're interested, please post the last code you have. Additionally I just mention that I don't use Spotify, but just post your code, as it is right now.
User avatar
fonpaolo
Moderator
Posts: 1387
Joined: April 11th, 2013, 8:08 pm
Location: Italy

Re: Album cover animations: Help

Post by fonpaolo »

No, balala, nooo!
...not TransformationMatrix!!!
I think I could hear his head exploding from here.
;-) :rolmfao:
User avatar
balala
Rainmeter Sage
Posts: 16190
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Album cover animations: Help

Post by balala »

fonpaolo wrote:No, balala, nooo!
...not TransformationMatrix!!!
I think I could hear his head exploding from here.
;-) :rolmfao:
Why? I think TransformationMatrix is a very cool tool.
User avatar
fonpaolo
Moderator
Posts: 1387
Joined: April 11th, 2013, 8:08 pm
Location: Italy

Re: Album cover animations: Help

Post by fonpaolo »

Obviously it was only a joke.
...however, even if I'm sure that TrasformationMatrix is very useful, it's not the easiest option to use.