It is currently April 24th, 2024, 10:41 pm

Alternating Rotator

Get help with creating, editing & fixing problems with skins
NyanNyan
Posts: 4
Joined: February 1st, 2015, 9:59 pm

Alternating Rotator

Post by NyanNyan »

Newbie here, after consulting the FAQ, is it possible to make rotator that spins clockwise whilst accelrating, then decelerate, then rotate in the opposite direction, and repeat.

Skip to 8:09, watch for 20 secs.
[youtube]m-wZ5GRIHUE[/youtube]

Currently trying to create "Psycho Pass Dominator Hud" as seen in the video, ive gathered all the materials and created all the graphics needed, i just need to write the rainmeter scripts for them. Here is a preview of all the stuff together
Image
Any help is much appreciated! :welcome:
User avatar
balala
Rainmeter Sage
Posts: 16168
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Alternating Rotator

Post by balala »

NyanNyan wrote:Newbie here, after consulting the FAQ, is it possible to make rotator that spins clockwise whilst accelrating, then decelerate, then rotate in the opposite direction, and repeat.
I think it is. You should use a sine function to determine the angle:

Code: Select all

[Rainmeter]
Update=100
BackgroundMode=2
SolidColor=80,80,80,220

[Metadata]
Name=RotatorExample
Author=balala
Version=1.0

[Variables]
ImageName=Plane.jpg

[MeasureAngle]
Measure=Calc
Formula=( 60 * sin ((( Counter % 60 ) * PI ) / 30 ))

[MeterImage]
Meter=ROTATOR
MeasureName=MeasureAngle
X=0
Y=0
W=200
H=200
ImageName=#ImageName#
OffsetX=77
OffsetY=55
StartAngle=0
RotationAngle=6.2832
ValueRemainder=60
In the MeterImage meter you should enter for the OffsetX and OffsetY the half of the width and height of the image used.
You can try to play with the value of the ValueRemainder option on the MeterImage.
You do not have the required permissions to view the files attached to this post.
NyanNyan
Posts: 4
Joined: February 1st, 2015, 9:59 pm

Re: Alternating Rotator

Post by NyanNyan »

Thanks for your help balala!, I tried your code and it works, however, its spins a bit too fast and not very smooth either... It spins for around 3 full rotations before rotating back too...
Could you possible explain which part of the code does what, ie which part controls the acceleration/deceleration and which part controls rate/speed of rotation??
User avatar
balala
Rainmeter Sage
Posts: 16168
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Alternating Rotator

Post by balala »

NyanNyan wrote:Thanks for your help balala!, I tried your code and it works, however, its spins a bit too fast and not very smooth either... It spins for around 3 full rotations before rotating back too...
Could you possible explain which part of the code does what, ie which part controls the acceleration/deceleration and which part controls rate/speed of rotation??
The most important option is the ValueRemainder. Try to play with it (for a certain ValueRemainder you should have to change the StartAngle value too). Eg for a ValueRemainder=120 the image will turnaround once. The acceleration/deceleration and the rate/speed of rotation are controled by the sine function. You can try to change the constants on the [MeasureAngle] section until you achive the desired effect. It's a bit difficult for me to say what values would be the best. How many rotations would you like to achive before the back rotation?
NyanNyan
Posts: 4
Joined: February 1st, 2015, 9:59 pm

Re: Alternating Rotator

Post by NyanNyan »

Not much, as seen in the video its very subtle, i was hoping to create something that rotated this ring: http://imgur.com/p1SvR69

From the position in the image, maybe rotate clockwise slowly, accelerating and turning about 20 or 30 degrees before decelerating to a halt and going in the opposite direction, back to the starting position and repeat, turning anti clockwise. So no full rotation, but 20/30 degrees either way.
User avatar
balala
Rainmeter Sage
Posts: 16168
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Alternating Rotator

Post by balala »

NyanNyan wrote:Not much, as seen in the video its very subtle, i was hoping to create something that rotated this ring: http://imgur.com/p1SvR69

From the position in the image, maybe rotate clockwise slowly, accelerating and turning about 20 or 30 degrees before decelerating to a halt and going in the opposite direction, back to the starting position and repeat, turning anti clockwise. So no full rotation, but 20/30 degrees either way.
Try a ValueRemainder=960 or even bigger. Also, to modify the speed, you can multiply or divide the Counter on the [MeasureAngle] section: Formula=( 60 * sin (((( Counter / 12 ) % 60 ) * PI ) / 30 ))
And here's another tip: if you want to use this code for any image, you must determine the size of the image. To do that, use the ImageSize plugin. Download the plugin (or easier, download and install the skin available on the above link, this will also install the plugin, then you can delete the skin, because the plugin will remain), then add these measures to the code:

Code: Select all

[MeasureWidth]
Measure=Plugin
Plugin=ImageSize
ImageName=#ImageName#
Dimension=Width
UpdateDivider=1

[MeasureHeight]
Measure=Plugin
Plugin=ImageSize
ImageName=#ImageName#
Dimension=Height
UpdateDivider=1
Also modify the [MeterImage]:

Code: Select all

[MeterImage]
Meter=ROTATOR
MeasureName=MeasureAngle
X=0
Y=0
W=(2*[MeasureWidth])
H=(2*[MeasureHeight])
ImageName=#ImageName#
OffsetX=([MeasureWidth]/2)
OffsetY=([MeasureHeight]/2)
StartAngle=0
RotationAngle=6.2832
ValueRemainder=...
DynamicVariables=1
And use for the image name either the #CURRENTPATH# variable:

Code: Select all

[Variables]
ImageName=#CURRENTPATH#Plane.jpg
either move the image into the resourrce folder and use this:

Code: Select all

[Variables]
ImageName=#@#Plane.jpg
NyanNyan
Posts: 4
Joined: February 1st, 2015, 9:59 pm

Re: Alternating Rotator

Post by NyanNyan »

Ive managed to make it work after playing with the numbers a bit, whilst we are on this, any way of making a "hovering" effect? ie, moving an object slowly in all directions, ie move up, down, left, right, diagonal in an set area??
User avatar
balala
Rainmeter Sage
Posts: 16168
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Alternating Rotator

Post by balala »

NyanNyan wrote:Ive managed to make it work after playing with the numbers a bit, whilst we are on this, any way of making a "hovering" effect? ie, moving an object slowly in all directions, ie move up, down, left, right, diagonal in an set area??
Maybe you could try Slideshow 3.1 skin. It has some similar effects.
User avatar
pul53dr1v3r
Posts: 442
Joined: July 30th, 2014, 10:30 am

Re: Alternating Rotator

Post by pul53dr1v3r »

just to make sure as i didn't see the possiblity as yet.
Is there a way to use string or shape in a Rotator meter instead of image?
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Alternating Rotator

Post by jsmorley »

Pul53dr1v3r wrote: November 22nd, 2019, 3:13 pm just to make sure as i didn't see the possiblity as yet.
Is there a way to use string or shape in a Rotator meter instead of image?
There really is not. You can use any meter as a Container for a Rotator meter, or any meter as content for a Rotator Container, more or less "replacing the image" the container uses, but the contents of the meter you use won't rotate along with the Rotator meter. So the answer is really "no".

You would need to build your own rotator meter using a Shape meter with Rotate, or a String meter with Angle. Both of these approaches are probably doable, but likely hideously complicated.

Code: Select all

[Rainmeter]
Update=32
DynamicWindowSize=1
AccurateText=1

[Variables]
ScaleFactor=1.0

[MeasureRotate]
Measure=Loop
StartValue=0
EndValue=359
Increment=3

[MeterSunAndEarth]
Meter=Shape
W=(152 * #ScaleFactor#)
H=(152 * #ScaleFactor#)
X=(52 * #ScaleFactor#)
Y=(52 * #ScaleFactor#)
Shape=Ellipse 50,50,50 | StrokeWidth 0 | Fill RadialGradient SunGrad
SunGrad=0,0 | 252,239,151,255 ; 0.0 | 171,43,43,255 ; 1.5
Shape2=Ellipse 110,110,15 | StrokeWidth 0 | Fill RadialGradient EarthGrad | Rotate [MeasureRotate], -45, -45
EarthGrad=0,0,-20,-20,30,30 | 200,226,250,255 ; 0.0 | 36,93,145,255 ; 1.0
DynamicVariables=1
TransformationMatrix=#ScaleFactor#;0;0;#ScaleFactor#;0;0

; Rotate degree, (CenterBigX - CenterSmallX + CenterSmallRadiusX), (CenterBigY - CenterSmallY + CenterSmallRadiusY)
; 50 - 110 + 15" = -45

; Remember that TransformmationMatrix does not change the size of the meter, and so DynamicWindowSize won't be effective when you scale up a shape meter with TransformationMatrix. You need to dynamically set the meter size large enough, so DynamicWindowSize can enlarge the overall skin as needed.

GIF.gif


I am really hopeless at trigonometry, so I can't go there with you. Have a nice trip down the rabbit hole... ;-)
You do not have the required permissions to view the files attached to this post.