Rotate a meter?

Help with creating, editing & fixing problems with skins

Rotate a meter?

February 15th, 2017, 3:58 pm
baerdric
   [11 posts]

I have an image that I want to rotate but I think I need it to be on a meter so that it can counter-rotate. I'm trying to make an Orrery, with the planets rotating around the Sun (I haven't found an example of that yet). So far if I do an image ROTATE, I can't then change the size or orientation of the image.

I'm very new, but have some scripting experience, I read the Docs, and searched the forum. I'm using W7 and this should be the current Rainmaker.

My whole code is a mess, but the relevant and nonworking portion is borrowed from the example of an analog clock in the docs:

Code: Select all

[MeterSecondsHandball]
Meter=ROTATOR
MeasureName=MeasureTime
X=10
Y=10
ImageName = #@#Images\Moonhalf.jpg
W=10
H=10
PreserveAspectRatio=1
AntiAlias=1
StartAngle=4.7124
RotationAngle=6.2832
ValueRemainder=60

Is it possible to rotate a meter? Can I go to sin/cos in the meter position? I read somewhere about TransformationMatrix but I don't think I have the math for that.
User avatar

Re: Rotate a meter?

February 15th, 2017, 4:03 pm
balala
Rainmeter Sage   [4593 posts]

TransformationMatrix is very good in such things. It can be used, but its math is indeed not very easy.
Please post the whole code and the involved images, or even better pack the whole config you have so far and I'll try to help you with the appropriate TransformationMatrix option(s).

Re: Rotate a meter?

February 15th, 2017, 4:18 pm
baerdric
   [11 posts]

Oh! Fast reply! Thanks!

I will cut it down to the part I'm working on (it's got extraneous things all over) and post it soon.

Re: Rotate a meter?

February 15th, 2017, 4:29 pm
baerdric
   [11 posts]

OK, this is kind of embarrassing, I'm really new, like yesterday new. There's not much here but I've tried referencing the "MeterPlanet" inside the "MeterSecondsHandMoon" various ways and it doesn't even seem to see it. The image now spins on a corner, but I can't size it or get it to go around the "MeterSun". I can get the positions from Wolfram once a day, but right now I am just using the clock to see if I can get it to work.

Code: Select all

[Rainmeter]
Update=1000
AccurateText=1

[MeterSun]
Meter=Shape
Shape=Ellipse 50,50,50

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

[MeasureTime]
Measure=Time

[MeterSecondsHandMoon]
Meter=ROTATOR
MeasureName=MeasureTime
X=10
Y=10
ImageName = #@#Images\Moonhalf.jpg
W=10
H=10
PreserveAspectRatio=1
AntiAlias=1
StartAngle=4.7124
RotationAngle=6.2832
ValueRemainder=60

[MeterSecondsHand]
Meter=ROUNDLINE
MeasureName=MeasureTime
X=0
Y=0
W=110
H=116
LineLength=52
LineColor=247,220,129,255
LineWidth=2
AntiAlias=1
StartAngle=4.7124
RotationAngle=6.2832
ValueRemainder=60
Attachments
Moonhalf.jpg

Re: Rotate a meter?

February 15th, 2017, 4:45 pm
baerdric
   [11 posts]

My plan (and the problem may be in my plan) was to place the planetary objects once a day with a 3:am call to Wolfram, then just rotate them all around the sky over the 24 hours. The divergence would not be enough to matter, even for the moon.
User avatar

Re: Rotate a meter?

February 15th, 2017, 7:14 pm
balala
Rainmeter Sage   [4593 posts]

I'm not sure I understood and it's not clear at all to me what you mean by
baerdric wrote:referencing the "MeterPlanet" inside the "MeterSecondsHandMoon"

and also what would be the Wolfram.
However here is a first attempt:

Code: Select all

[Rainmeter]
Update=1000
AccurateText=1

[Variables]
Radius=200
MoonDiameter=25

[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

[MeasureTime]
Measure=Time
Format=%#S

[MeasureAngle]
Measure=Calc
Formula=( -1 * (( 2 * PI * MeasureTime ) / 60 ))

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

This code introduces two variables:
  • Radius is the radius of the path of Moon, around the central object (which should be the Earth, because the Moon is rotating around the Earth, not around the Sun).
  • MoonDiameter is the diameter of the image of the Moon. Here I also would say it would be a good idea to create a .png image from the moonhalf.jpg, to can remove the black background. You even can use some online tool for this, like http://www.ezimba.com/index-ln.html
Please let me know if this code has started to look like what you asked for.

Re: Rotate a meter?

February 15th, 2017, 10:23 pm
baerdric
   [11 posts]

YES, thank you and I think I understand how you did it. Thanks so much! Lots of adapting to do but it's at least moving properly!
User avatar

Re: Rotate a meter?

February 16th, 2017, 3:32 pm
balala
Rainmeter Sage   [4593 posts]

Glad to help. If you have any further question, please let me know.

Re: Rotate a meter?

February 16th, 2017, 10:21 pm
baerdric
   [11 posts]

Still parsing through the matrix transformation. But you asked about Wolfram, they have an API that included a lot of astronomical data which I hope to chop up and use in my skin.
For Example. https://www.wolframalpha.com/input/?i=p ... se+and+set
When you have an API key you can get plain text in xml format. They do all kinds of data and computational stuff, plus they are trying to aggregate a full knowledge base for use via API. Quite a thing.
User avatar

Re: Rotate a meter?

February 17th, 2017, 3:20 pm
balala
Rainmeter Sage   [4593 posts]

baerdric wrote:Still parsing through the matrix transformation. But you asked about Wolfram, they have an API that included a lot of astronomical data which I hope to chop up and use in my skin.
For Example. https://www.wolframalpha.com/input/?i=p ... se+and+set
When you have an API key you can get plain text in xml format. They do all kinds of data and computational stuff, plus they are trying to aggregate a full knowledge base for use via API. Quite a thing.

Probably useful. I'll take a deeper look, to see what they have.
However I'm a older fashion guy and I like to do some (astronomical) calculations locally, without downloading the results. Just two examples:
For sure an online tool can give much more information. But I also like the "offline" tools.

Return to “Help: Rainmeter Skins”



Who is online

Users browsing this forum: balala and 1 guest