It is currently May 19th, 2021, 12:31 am

Meter to rotate image around an axis

Report bugs with the Rainmeter application and suggest features.
User avatar
Ryuzaki
Posts: 7
Joined: April 1st, 2015, 5:31 pm

Meter to rotate image around an axis

Post by Ryuzaki »

Recently I tried to do a image Meter that rotates the image on its X axis, but that is so hard to do. Can you make a Meter similar to Rotator (or integrate in it) that can do that? I was kinda able to do it, but it's still a little ugly, doesn't flow as nice as it should. It uses TransformationMatrix for it, but it's a pain to configure.

Edit 1

To make it clearer, what I want is a image that rotates along an axis, like a rotating platform. There is a Meter called Rotator, that rotates it in the Z-axis (So it looks like you are looking at it from above). I want to rotate on the X-axis. Here's the current code I'm using to rotate it.

Code: Select all

[Rainmeter]
Update=10
@Include=#@#Variables.inc

[Variables]
ImgH=360
ImgW=260

[SkinBackground]
Meter=Image
X=0
Y=0
H=#ImgH#
W=#imgW#
SolidColor=0,0,0,1

[CalcOffsetX]
Measure=Calc
Formula=#ImgW#/2

[CalcOffsetY]
Measure=Calc
Formula=#ImgH#/2

[CalcIncrement]
Measure=Calc
Formula=CalcIncrement+0.01
IfAboveValue=0.95
IfAboveAction=[!SetOption CalcIncrement Formula "CalcIncrement-0.01"][!SetOption CalcFactor Formula "CalcIncrement**2-0.9"]
IfBelowValue=-0.95
IfBelowAction=[!SetOption CalcIncrement Formula "CalcIncrement+0.01"][!SetOption CalcFactor Formula "(CalcIncrement**2-0.9)*-1"]

[CalcFactor]
Measure=Calc
Formula=(CalcIncrement**2-0.9)*-1
OnUpdateAction=[!SetOption ImageLogo TransformationMatrix "[CalcFactor];0;0;1;[CalcOffsetX]+[CalcOffsetX]*[CalcFactor];[CalcOffsetY]+[CalcOffsetY]*[CalcFactor]"][!Redraw]

[ImageLogo]
Meter=Image
ImageName=#ImgYoRHaLogo#
X=([SkinBackground:W]/-2)
Y=([SkinBackground:H]/-2)
H=[SkinBackground:H]
W=[SkinBackground:W]
AntiAlias=1
Edit 2

Still not clear enough, so here is the image that shows what I want.
Image

Last Edit

I think i failed to explain what I want, people failed to understand what I meant, and no one saw this as a useful measure. I stop here.
This is what the code in edit 1 does.
Untitled.gif
It makes the image spin. You can see it is an asymmetric one as well, but it spins. Not simply flip, not rotating around a point on the screen, not 3D rendering. Simply a trick to make a 2D image 'appears' flipping in the screen, rotating around the Y-axis (not X as I wrongly said many times).
You do not have the required permissions to view the files attached to this post.
Last edited by Ryuzaki on May 7th, 2021, 12:08 pm, edited 3 times in total.
User avatar
SilverAzide
Rainmeter Sage
Posts: 1251
Joined: March 23rd, 2015, 5:26 pm

Re: Meter to flip image

Post by SilverAzide »

Ryuzaki wrote: April 22nd, 2021, 11:12 pm Recently I tried to do a image Meter that rotates the image on its X axis, but that is so hard to do. Can you make a Meter similar to Rotator (or integrate in it) that can do that? I was kinda able to do it, but it's still a little ugly, doesn't flow as nice as it should. It uses TransformationMatrix for it, but it's a pain to configure.
Uhh...:? Maybe I'm missing something, but why can't you just use the ImageFlip option on an Image meter?
Gadgets Wiki GitHub More Gadgets...
User avatar
Ryuzaki
Posts: 7
Joined: April 1st, 2015, 5:31 pm

Re: Meter to flip image

Post by Ryuzaki »

SilverAzide wrote: April 23rd, 2021, 12:22 am Uhh...:? Maybe I'm missing something, but why can't you just use the ImageFlip option on an Image meter?
Maybe I wasn't clear enough. I was trying to make the image rotate around the X-axis, as if it is on a rotating plataform. The ImageFlip will flip the image fully, like inverting it.
User avatar
CyberTheWorm
Posts: 776
Joined: August 22nd, 2016, 11:32 pm
Location: Surrey, B.C., Canada

Re: Meter to flip image

Post by CyberTheWorm »

Ryuzaki wrote: April 27th, 2021, 6:51 pm Maybe I wasn't clear enough. I was trying to make the image rotate around the X-axis, as if it is on a rotating plataform. The ImageFlip will flip the image fully, like inverting it.
https://docs.rainmeter.net/manual/meters/general-options/image-options/ So ImageRotate?
The only source of knowledge is experience. Albert Einstein
Deviant Art Page
User avatar
balala
Rainmeter Sage
Posts: 12670
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Meter to flip image

Post by balala »

Ryuzaki wrote: April 27th, 2021, 6:51 pm Maybe I wasn't clear enough. I was trying to make the image rotate around the X-axis, as if it is on a rotating plataform. The ImageFlip will flip the image fully, like inverting it.
I'm always doing such rotations with TransformationMatrix. It's extremely powerful and can easilly handle rotations. But as always there is a disadvantage as well, namely that if the meter has set a click (or other mouse action), when TransformationMatrix is applied, the clickable surface doesn't rotate (isn't transformed).
If interested, please let me know, to give you an example on how this option can be used.
User avatar
Ryuzaki
Posts: 7
Joined: April 1st, 2015, 5:31 pm

Re: Meter to flip image

Post by Ryuzaki »

No, ImageRotate rotates the image like a pointer in a clock. As I said before, what I want is to simulate what you see if you watch something spin on top of a rotor.
User avatar
Ryuzaki
Posts: 7
Joined: April 1st, 2015, 5:31 pm

Re: Meter to flip image

Post by Ryuzaki »

balala wrote: April 27th, 2021, 7:11 pm I'm always doing such rotations with TransformationMatrix. It's extremely powerful and can easilly handle rotations. But as always there is a disadvantage as well, namely that if the meter has set a click (or other mouse action), when TransformationMatrix is applied, the clickable surface doesn't rotate (isn't transformed).
If interested, please let me know, to give you an example on how this option can be used.
Yes, I found a way to do it using TransformationMatrix, but that is soooo ugly. I mean it's complicated to set up (not now anyways...) If there was a meter that could do this precisely, without so many configurations, it would be better.
User avatar
balala
Rainmeter Sage
Posts: 12670
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Meter to flip image

Post by balala »

Ryuzaki wrote: May 6th, 2021, 2:13 pm Yes, I found a way to do it using TransformationMatrix, but that is soooo ugly. I mean it's complicated to set up (not now anyways...) If there was a meter that could do this precisely, without so many configurations, it would be better.
Yes, might be weird in some cases, but it's not as much as it seems. And TransformationMatrix can do the rotation extremely precisely. In fact the math behind is quite well elborated from now and can be easily used. See the following example (posted a few days ago, here):

Code: Select all

[Rainmeter]
Update=50
BackgroundMode=2
SolidColor=0,0,0,120

[Variables]
ImageW=128
ImageH=128

[MeasureRotate]
Measure=Calc
Formula=(MeasureRotate % 360) + 1
MaxValue=360

[MeterRotate]
Meter=Image
ImageName=#@#Face.png
X=140
Y=250
W=#ImageW#
H=#ImageH#
TransformationMatrix=(Cos(Rad([MeasureRotate])));(-Sin(Rad([MeasureRotate])));(Sin(Rad([MeasureRotate])));(Cos(Rad([MeasureRotate])));([#CURRENTSECTION#:X]+[#CURRENTSECTION#:W]/2)-([#CURRENTSECTION#:X]+[#CURRENTSECTION#:W]/2)*Cos(Rad([MeasureRotate]))-([#CURRENTSECTION#:Y]+[#CURRENTSECTION#:H]/2)*Sin(Rad([MeasureRotate]));([#CURRENTSECTION#:Y]+[#CURRENTSECTION#:H]/2)+([#CURRENTSECTION#:X]+[#CURRENTSECTION#:W]/2)*Sin(Rad([MeasureRotate]))-([#CURRENTSECTION#:Y]+[#CURRENTSECTION#:H]/2)*Cos(Rad([MeasureRotate]))
DynamicVariables=1

[Center]
Meter=Image
SolidColor=255,0,0
X=([MeterRotate:X]+[MeterRotate:W]/2-1)
Y=([MeterRotate:Y]+[MeterRotate:H]/2-1)
W=3
H=3
DynamicVariables=1
I attach the Face.png image used by this code as well, however you can use any image you'd like. It's preferably the image to be a square. You can place the image anywhere and can it resize as you want (setting the X, Y, W and H options of the [MeterRotate] meter).
If you want to use it and have questions, I wait for them.
You do not have the required permissions to view the files attached to this post.
User avatar
SilverAzide
Rainmeter Sage
Posts: 1251
Joined: March 23rd, 2015, 5:26 pm

Re: Meter to flip image

Post by SilverAzide »

Ryuzaki wrote: May 6th, 2021, 2:11 pm No, ImageRotate rotates the image like a pointer in a clock. As I said before, what I want is to simulate what you see if you watch something spin on top of a rotor.
Based on that gif you posted, you do realize that Rainmeter is strictly 2D, right? The image you posted is a 2D rendered image of a 3D object. What you are asking for is not "rotating" or "flipping an image", it is rendering a 2D image from a 3D object.

If you have a flat 2D shape, you can make it appear to be rotating in 3D by skewing (faking perspective) and flipping (to fake the "front" and "back" of the shape) back and forth, but it generally looks pretty lame:
0_wJ65x6TeT8Mk9ATG.gif
The closest thing I've seen to what you are asking is this Hologram skin by user @killall-q, but you would need to supply the 3D model. The main Hologram thread is here.
You do not have the required permissions to view the files attached to this post.
Gadgets Wiki GitHub More Gadgets...