It is currently April 26th, 2024, 2:25 am

Album cover animations: Help

Get help with creating, editing & fixing problems with skins
User avatar
balala
Rainmeter Sage
Posts: 16172
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Album cover animations: Help

Post by balala »

fonpaolo wrote:...however, even if I'm sure that TrasformationMatrix is very useful, it's not the easiest option to use.
Definitely you're right, it's not. But neither isn't impossible to be use. Especially that the Transformation Matrix Guide is a very good description.
bernardovs23
Posts: 28
Joined: April 6th, 2017, 2:43 pm

Re: Album cover animations: Help

Post by bernardovs23 »

balala wrote: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.
Here it is
[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.AlbumArt.Rotate]
Measure=Loop
StartValue=0
EndValue=359
Increment=1
LoopCount=0
[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=Rotator
MeasureName=Measure.AlbumArt.Rotate
ImageName=[Measure.AlbumArt]
W=(#Size#*2.5)
H=(#Size#*2.5)
OffsetX=((#Size#*2.5)/2)
OffsetY=((#Size#*2.5)/2)
DynamicVariables=1
LeftMouseUpAction=[!ToggleMeasure Measure.AlbumArt.Rotate]
[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
Btw, I think that transformation matrix is very very hard, I will try to understand as best as I can
User avatar
balala
Rainmeter Sage
Posts: 16172
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Album cover animations: Help

Post by balala »

bernardovs23 wrote:Here it is
What is the value of the Size variable (probably it's placed into the Variables.ini file)?
bernardovs23
Posts: 28
Joined: April 6th, 2017, 2:43 pm

Re: Album cover animations: Help

Post by bernardovs23 »

balala wrote:What is the value of the Size variable (probably it's placed into the Variables.ini file)?
100
User avatar
balala
Rainmeter Sage
Posts: 16172
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Album cover animations: Help

Post by balala »

As I said, I don't use Spotify, so I had to switch to the NowPlaying plugin, which can return almost the same information as the SpotifyPlugin, just for other players. With this plugin I don't have errors at all, the skin is working well with the Rotator meter. However I'd like to mention one problem I see on your code: at least the NowPlaying plugin doesn't return the cover always at the same size. The size of the returned cover is changing, so you can't use the same value for the Size variable. To determine the size of the returned cover I think you should use the ImageSize plugin, made exactly for such things (to determine the width and height of an image).
If you are interested, please let me know to describe you how to do this.
bernardovs23
Posts: 28
Joined: April 6th, 2017, 2:43 pm

Re: Album cover animations: Help

Post by bernardovs23 »

balala wrote:As I said, I don't use Spotify, so I had to switch to the NowPlaying plugin, which can return almost the same information as the SpotifyPlugin, just for other players. With this plugin I don't have errors at all, the skin is working well with the Rotator meter. However I'd like to mention one problem I see on your code: at least the NowPlaying plugin doesn't return the cover always at the same size. The size of the returned cover is changing, so you can't use the same value for the Size variable. To determine the size of the returned cover I think you should use the ImageSize plugin, made exactly for such things (to determine the width and height of an image).
If you are interested, please let me know to describe you how to do this.
I am insterested
User avatar
balala
Rainmeter Sage
Posts: 16172
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Album cover animations: Help

Post by balala »

bernardovs23 wrote:I am insterested
Ok, then first you should install the ImageSize plugin, available here: https://forum.rainmeter.net/viewtopic.php?p=101884#p101884
The easiest way to install the plugin would be to download and run the ImageSize_3.0.rmskin skin installer (from the above link). The installer, beside the skin, will install the appropriate version of the plugin (the 32 or the 64 bit version), to the right folder. Then you can remove the newly installed skin, if you don't need it, however you could take a look to see a very good example how the plugin can (and must) be used.
Now, if you have the plugin installed, add the following two measures to your code:

Code: Select all

[MeasureCoverWidth]
Measure=Plugin
Plugin=ImageSize
ImageName=[Measure.AlbumArt]
Dimension=Width
DynamicVariables=1
Group=ImageSize

[MeasureCoverHeight]
Measure=Plugin
Plugin=ImageSize
ImageName=[Measure.AlbumArt]
Dimension=Height
DynamicVariables=1
Group=ImageSize
This code will cause some errors in the log, but we'll fix the issue later, for now let it so.
The [MeasureCoverWidth] and [MeasureCoverHeight] measures will return the width and the height of the cover, returned by the [Measure.AlbumArt] measure.
Now you can use these values into the rotator meter, to set the center of rotation:

Code: Select all

[Meter.AlbumArt]
Meter=Rotator
MeasureName=Measure.AlbumArt.Rotate
ImageName=[Measure.AlbumArt]
W=[MeasureCoverWidth]
H=[MeasureCoverHeight]
OffsetX=([MeasureCoverWidth]/2)
OffsetY=([MeasureCoverHeight]/2)
DynamicVariables=1
LeftMouseUpAction=[!ToggleMeasure Measure.AlbumArt.Rotate]
The above rotator meter, at least in my opinion, has a great disadvantage: the size of the skin depends on the size of the cover. The rotator meter doesn't let you to resize the rotated image. For a such resize, you will have to use an image meter (which let you to resize the image), then with a properly added TransformationMatrix option, you'll be able to rotate the image.
For this, replace the existing [Meter.AlbumArt] rotator meter, with the following image meter:

Code: Select all

[Meter.AlbumArt]
Meter=Image
MeasureName=Measure.AlbumArt
X=0
Y=0
W=200
H=100
PreserveAspectRatio=1
TransformationMatrix=(Cos(Rad([Measure.AlbumArt.Rotate])));(-Sin(Rad([Measure.AlbumArt.Rotate])));(Sin(Rad([Measure.AlbumArt.Rotate])));(Cos(Rad([Measure.AlbumArt.Rotate])));(([Meter.AlbumArt:X]+[Meter.AlbumArt:W]/2)-((([Meter.AlbumArt:X]+[Meter.AlbumArt:W]/2)*Cos(Rad([Measure.AlbumArt.Rotate]))))-((([Meter.AlbumArt:Y]+[Meter.AlbumArt:H]/2)*Sin(Rad([Measure.AlbumArt.Rotate])))));(([Meter.AlbumArt:Y]+[Meter.AlbumArt:H]/2)+((([Meter.AlbumArt:X]+[Meter.AlbumArt:W]/2)*Sin(Rad([Measure.AlbumArt.Rotate]))))-((([Meter.AlbumArt:Y]+[Meter.AlbumArt:H]/2)*Cos(Rad([Measure.AlbumArt.Rotate])))))
DynamicVariables=1
LeftMouseUpAction=[!ToggleMeasure Measure.AlbumArt.Rotate]
Note the followings:
  • The W and H options of the meter will let you to resize the image to any size. In plus, all covers will be shown at the same size (in this case 200x200 pixels, but obviously you can modify the values of these options), no matter which is the size of the cover.
  • You can move the meter (through its X and Y options). The image will rotate always around its own center.
  • I know that the posted TransformationMatrix option is complicated enough and maybe at first look, you won't understand nothing, but the math behind it, isn't so complicated as it looks at first look. To understand it, you should read first the following description: https://docs.rainmeter.net/tips/transformation-matrix-guide/ (focus on the "Transformations" and the next "What the heck is Rainmeter doing?!" sections).
  • In the [Rainmeter] section of your last code, you've used an Update=1 option. You have to know that the lowest possible value for Update is 16, using a smaller one, will make the skin to work as with Update=16. Read the second paragraph here, then modify that value.
Quasar 07
Posts: 2
Joined: November 12th, 2019, 2:53 pm

Re: Album cover animations: Help

Post by Quasar 07 »

Good afternoon, I am very new, just two days and this transformationmatrix does exactly what I want except a circumstance:
rotating counterclockwise and I want it to turn clockwise. "switch around values b and c and recalculate tx and ty" I get lost. Could you help me turn right?
Thank you. Regards.

Code: Select all

PreserveAspectRatio=1
TransformationMatrix=(Cos(Rad([Measure.AlbumArt.Rotate])));(-Sin(Rad([Measure.AlbumArt.Rotate])));(Sin(Rad([Measure.AlbumArt.Rotate])));(Cos(Rad([Measure.AlbumArt.Rotate])));(([Meter.AlbumArt:X]+[Meter.AlbumArt:W]/2)-((([Meter.AlbumArt:X]+[Meter.AlbumArt:W]/2)*Cos(Rad([Measure.AlbumArt.Rotate]))))-((([Meter.AlbumArt:Y]+[Meter.AlbumArt:H]/2)*Sin(Rad([Measure.AlbumArt.Rotate])))));(([Meter.AlbumArt:Y]+[Meter.AlbumArt:H]/2)+((([Meter.AlbumArt:X]+[Meter.AlbumArt:W]/2)*Sin(Rad([Measure.AlbumArt.Rotate]))))-((([Meter.AlbumArt:Y]+[Meter.AlbumArt:H]/2)*Cos(Rad([Measure.AlbumArt.Rotate])))))
DynamicVariables=1
User avatar
balala
Rainmeter Sage
Posts: 16172
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Album cover animations: Help

Post by balala »

Quasar 07 wrote: November 12th, 2019, 4:51 pm rotating counterclockwise and I want it to turn clockwise. "switch around values b and c and recalculate tx and ty" I get lost. Could you help me turn right?
DynamicVariables=1[/code]
For such a simple thing, you don't have to complicate things with all those variables (b, c, tx and ty). Just have to replace the [Measure.AlbumArt.Rotate] section variable into the TransformationMatrix option with -[Measure.AlbumArt.Rotate]:

Code: Select all

TransformationMatrix=(Cos(Rad(-[Measure.AlbumArt.Rotate])));(-Sin(Rad(-[Measure.AlbumArt.Rotate])));(Sin(Rad(-[Measure.AlbumArt.Rotate])));(Cos(Rad(-[Measure.AlbumArt.Rotate])));(([Meter.AlbumArt:X]+[Meter.AlbumArt:W]/2)-((([Meter.AlbumArt:X]+[Meter.AlbumArt:W]/2)*Cos(Rad(-[Measure.AlbumArt.Rotate]))))-((([Meter.AlbumArt:Y]+[Meter.AlbumArt:H]/2)*Sin(Rad(-[Measure.AlbumArt.Rotate])))));(([Meter.AlbumArt:Y]+[Meter.AlbumArt:H]/2)+((([Meter.AlbumArt:X]+[Meter.AlbumArt:W]/2)*Sin(Rad(-[Measure.AlbumArt.Rotate]))))-((([Meter.AlbumArt:Y]+[Meter.AlbumArt:H]/2)*Cos(Rad(-[Measure.AlbumArt.Rotate])))))
Quasar 07
Posts: 2
Joined: November 12th, 2019, 2:53 pm

Re: Album cover animations: Help

Post by Quasar 07 »

Thank you very much, I was totally lost with TX and TY.
It works very well.
Very thankful.
Regards.