It is currently March 28th, 2024, 2:22 pm

Rotate a meter?

Get help with creating, editing & fixing problems with skins
baerdric
Posts: 11
Joined: February 15th, 2017, 3:34 pm

Re: Rotate a meter?

Post by baerdric »

That's very cool! I used to do a calculation for length of day, but yes, it got very easy to depend on tools online (however, I am having trouble making rainmeter see the wolfram page).

So is there any way of externalizing the matrix calculations so I can call them with different parameters for different planets?
User avatar
balala
Rainmeter Sage
Posts: 16109
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Rotate a meter?

Post by balala »

baerdric wrote:I used to do a calculation for length of day,
Also done. The skin is saving the length of each new day, since you've installed the skin, into the @Resources\DayLength.inc file. To open this file, just click the date on the skin.
baerdric wrote:(however, I am having trouble making rainmeter see the wolfram page).
If that page needs logon, Rainmeter can't parse it. The WebParser plugin can't retrieve information from web sites requiring a login. Read the second paragraph here.
baerdric wrote:So is there any way of externalizing the matrix calculations so I can call them with different parameters for different planets?
Actually it is. I modified a bit my previous code, adding a second planet. I used the same image for this second planet, probably you'll want to use another one. I replace the angle calculation formulas (the new formulas don't use the [MeasureTime] measure, so I removed it), renamed the variables and added a few new ones:

Code: Select all

[Rainmeter]
Update=100
AccurateText=1

[Variables]
Radius1=100
Radius2=200
PlanetDiameter1=15
PlanetDiameter2=30
Period1=30
Period2=45

[MeterSun]
Meter=Shape
Shape=Ellipse 50,50,50
X=300
Y=200

[MeterPlanet]
Meter=Image
Shape=Ellipse 175,175,5
ImageName=#@#Images\Moonhalf.jpg
H=10
W=10

[MeasureAngle1]
Measure=Calc
Formula=(( -2 * ( COUNT % #Period1# ) * PI ) / #Period1# )

[MeasureAngle2]
Measure=Calc
Formula=(( -2 * ( COUNT % #Period2# ) * PI ) / #Period2# )

[MeterPlanet1]
Meter=Image
ImageName=#@#Images\Moonhalf.jpg
X=([MeterSun:X]+[MeterSun:W]/2-#Radius1#*Cos(-[MeasureAngle1])-([MeterPlanet1:W]/2))
Y=([MeterSun:Y]+[MeterSun:H]/2-#Radius1#*Sin(-[MeasureAngle1])-([MeterPlanet1:H]/2))
W=#PlanetDiameter1#
H=#PlanetDiameter1#
PreserveAspectRatio=1
TransformationMatrix=(Cos([MeasureAngle1]));(-Sin([MeasureAngle1]));(Sin([MeasureAngle1]));(Cos([MeasureAngle1]));(([MeterPlanet1:X]+([MeterPlanet1:W]/2))-([MeterPlanet1:X]+([MeterPlanet1:W]/2))*Cos([MeasureAngle1])-([MeterPlanet1:Y]+([MeterPlanet1:H]/2))*Sin([MeasureAngle1]));(([MeterPlanet1:Y]+([MeterPlanet1:H]/2))+([MeterPlanet1:X]+([MeterPlanet1:W]/2))*Sin([MeasureAngle1])-([MeterPlanet1:Y]+([MeterPlanet1:H]/2))*Cos([MeasureAngle1]))
DynamicVariables=1

[MeterPlanet2]
Meter=Image
ImageName=#@#Images\Moonhalf.jpg
X=([MeterSun:X]+[MeterSun:W]/2-#Radius2#*Cos(-[MeasureAngle2])-([MeterPlanet2:W]/2))
Y=([MeterSun:Y]+[MeterSun:H]/2-#Radius2#*Sin(-[MeasureAngle2])-([MeterPlanet2:H]/2))
W=#PlanetDiameter2#
H=#PlanetDiameter2#
PreserveAspectRatio=1
TransformationMatrix=(Cos([MeasureAngle2]));(-Sin([MeasureAngle2]));(Sin([MeasureAngle2]));(Cos([MeasureAngle2]));(([MeterPlanet2:X]+([MeterPlanet2:W]/2))-([MeterPlanet2:X]+([MeterPlanet2:W]/2))*Cos([MeasureAngle2])-([MeterPlanet2:Y]+([MeterPlanet2:H]/2))*Sin([MeasureAngle2]));(([MeterPlanet2:Y]+([MeterPlanet2:H]/2))+([MeterPlanet2:X]+([MeterPlanet2:W]/2))*Sin([MeasureAngle2])-([MeterPlanet2:Y]+([MeterPlanet2:H]/2))*Cos([MeasureAngle2]))
DynamicVariables=1
Now you can set different radius for the paths and different diameters for the planets. Also you can set the revolution period of both planets. You have to be careful, in the case of the Solar System, the inner planets are moving quickly than the external ones, so Period2 (the period of the external planet) should be greater than Period1 (the period of the inner planet). Also be careful that if you increase the values of the two Radius variables, you probably will have to increase the X and Y options of the [MeterSun] meter (moving the Sun).
If you want, you can add further planets, just have to add the new variables, the new [MeasureAngleX] measures and the appropriate [MeterPlanetX] meters.
baerdric
Posts: 11
Joined: February 15th, 2017, 3:34 pm

Re: Rotate a meter?

Post by baerdric »

Sorry, I didn't see the notification for your previous reply. I've been working on getting Tasker to send messages to RainMeter.

I'm going to dig into what you posted in the morning and set up some things. Thanks for the time and effort you put into this, I hope it's also useful for you in some way.
baerdric
Posts: 11
Joined: February 15th, 2017, 3:34 pm

Re: Rotate a meter?

Post by baerdric »

Can you send me your preferred citation metadata info? I would be pleased to credit you (as if anyone but me would ever see it).
User avatar
balala
Rainmeter Sage
Posts: 16109
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Rotate a meter?

Post by balala »

baerdric wrote:Can you send me your preferred citation metadata info? I would be pleased to credit you (as if anyone but me would ever see it).
I'm glad if I could help. And don't worry, if you want, just mention me somewhere as helper.
Post Reply