It is currently March 29th, 2024, 5:27 am

Imitate Roundline with Shape meter

Get help with creating, editing & fixing problems with skins
User avatar
theimmersion
Posts: 55
Joined: November 27th, 2016, 1:51 pm

Imitate Roundline with Shape meter

Post by theimmersion »

Could you imitate the behavior of roundline with shape meter?
I was wondering because the shape meter has more options for diverse and dynamic change via some animations.
Mostly interested in the path shape but i did not have much luck with it. I mean, making a circle is easy, its the non closed loop thats bugging me how to achieve. Im working on an update for one of my skin that is animated and i need the shapes possibility of x scale to make it thinner and thus giving the impression that its rotating. But i cant do that with round line (essentially scewing). The issue is that the ring is starting empty and closing on skins startup. So as a workaround i made a roundline that slowly closes itself and than switch out for a pre-made shape circle (a filled rectangle round shape with another one to exclude to make a ring). I than animate the scale X to smaller and back to 1 to give it the rotating effect. The problem is, thats all i can do and also the switch is noticable because its parallax and relies on mouse location and a bunch of other calculations so the switch is noticable til the calculations catch up. :???: Food for thought. :lol:
I dont know how you guys make gifs out of your desktop to show off examples and probably my laptop couldnt handle it either. :uhuh:
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5384
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: Imitate Roundline with Shape meter

Post by eclectic-tech »

theimmersion wrote:...
I dont know how you guys make gifs out of your desktop to show off examples and probably my laptop couldnt handle it either. :uhuh:
I use GIFCam to capture animated skins. It should work fine, even on a laptop ;-)
User avatar
theimmersion
Posts: 55
Joined: November 27th, 2016, 1:51 pm

Re: Imitate Roundline with Shape meter

Post by theimmersion »

Thanks electic!
So here is it with parallax off. Its quite fine.
GIF.gif
But with parallax, depending on how many skins there are (how slow the executions and calculations get) the ring goes all over the place. Keep in mind my laptop is very old and very bad. xD
But i see the good thing in it, if it works smoothly after i optimize the code on my laptop, it will run amazingly on everyone elses. xDDDDDD
But thats a different issue when i think about it, i somehow need to place it at center as default and than gradually move it to where the parallax effect is. Which isnt going to be easy. :???:
GIF 2.gif
The reason why i wonder if its achievable with shape is because if id want to make a more complex skin with ring effect turning into a different shape and vice versa, i could do it without adding roundline to switch around. Say, i want to make raineter logo evolve from ring to a tear drop but multiple of them. Like 4 tear drops would require 4 roundline meters and 4 shape meters instead of just 4 shape meters that could do it all.
You do not have the required permissions to view the files attached to this post.
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Imitate Roundline with Shape meter

Post by balala »

theimmersion wrote:Could you imitate the behavior of roundline with shape meter?
Yep, it can definitely! Definitely not too easy, but nor impossible isn't. Here is a solution:

Code: Select all

[Rainmeter]
Update=100
LeftMouseUpAction=[!TogglePauseMeasure "Timer"]
DynamicWindowSize=1

[Variables]
CenterX=200
CenterY=150
LineStart=0
LineLength=80
Solid=0
SolidColor=0,0,255,80
LineColor=0,240,0

[Timer]
Measure=Calc
Formula=( COUNTER % 100 + 50 )
MinValue=50
MaxValue=150

[MeasureVal]
Measure=Calc
Formula=(( 360 * ( Timer - [Timer:MinValue] )) / ( [Timer:MaxValue] - [Timer:MinValue] ))
IfCondition=(#CURRENTSECTION#<=180)
IfTrueAction=[!SetOption MeterShapeRoundline Shape "Path MyPath1 | Extend MyModifiers1 | Fill Color #LineColor#"][!UpdateMeter "MeterShapeRoundline"][!Redraw]
IfFalseAction=[!SetOption MeterShapeRoundline Shape "Path MyPath2 | Extend MyModifiers1 | Fill Color #LineColor#"][!UpdateMeter "MeterShapeRoundline"][!Redraw]
DynamicVariables=1

[MeterCircle]
Meter=Shape
X=1
Y=1
Shape=Ellipse #CenterX#,#CenterY#,#LineLength#,#LineLength# | Fill Color #SolidColor# | StrokeWidth 2 | Stroke Color 46,115,31,255
Hidden=(1-#Solid#)

[MeterShapeRoundline]
Meter=Shape
X=0r
Y=0r
Shape2=Ellipse #CenterX#,#CenterY#,#LineLength#,#LineLength# | Extend MyModifiers1 | Fill Color #LineColor#
Shape3=Ellipse #CenterX#,#CenterY#,#LineStart#,#LineStart# | Fill Color 0,0,0,0 | StrokeWidth 0 | Stroke Color 46,115,31,0
Shape4=Combine Shape | Intersect Shape2 | Exclude Shape3
MyPath1=#CenterX#,#CenterY# | LineTo #CenterX#,(#CenterY#-#LineLength#) | ArcTo (#CenterX#+#LineLength#*sin(rad([MeasureVal]))), (#CenterY#-#LineLength#*cos(rad([MeasureVal]))) | LineTo #CenterX#,#CenterY#
MyPath2=#CenterX#,#CenterY# | LineTo #CenterX#,(#CenterY#-#LineLength#) | ArcTo #CenterX#,(#CenterY#+#LineLength#) | ArcTo (#CenterX#+#LineLength#*sin(rad([MeasureVal]))), (#CenterY#-#LineLength#*cos(rad([MeasureVal]))) | LineTo #CenterX#,#CenterY#
MyModifiers1=StrokeWidth 2 | Stroke Color 46,115,31,255
DynamicVariables=1
The meaning of the variables:
  • CenterX and CenterY are the coordinates of the center of the "roundline".
  • LineStart and LineLength have the same meaning as the similar options of the Roundline meter.
  • Solid tells if a SolidColor is used, to fill the background (if Solid=1 the SolidColor is used, otherwise it's not).
  • SolidColor is used to fill the background of the meter. If Solid is set to 0, this variable has no meaning.
  • LineColor is the color of the roundline. It has the same meaning as the similar option of a RoundLine meter.
Also note that [Timer] is the measure which returns the represented values. Same as on the Roundline meter, it has to have set the MinValue and MaxValue options (to can be used as percentual values).
Probably the involved math is not too easy. Please feel free to ask if something isn't clear enough.
User avatar
theimmersion
Posts: 55
Joined: November 27th, 2016, 1:51 pm

Re: Imitate Roundline with Shape meter

Post by theimmersion »

Its literally imitating a round line, now if i could do that with path. Ill fiddle around with it. Sure gives a smart example. Thanks balala! :great:
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Imitate Roundline with Shape meter

Post by balala »

theimmersion wrote:Its literally imitating a round line
This was my intention, as you asked.
theimmersion wrote:now if i could do that with path.
I think it is done with path, isn't it? I mean that the Shape option of the [MeterShapeRoundline] meter (which is set by the IfTrueAction and IfFalseAction options of the [MeasureVal] measure) is a path shape.
User avatar
theimmersion
Posts: 55
Joined: November 27th, 2016, 1:51 pm

Re: Imitate Roundline with Shape meter

Post by theimmersion »

Working on a skin so didnt look close enough to this example, i saved it of course for later. First thing i noticed was the Ellipse so didnt even notice MyPath1 and MyPath2. Ill have to dissect it when i got time and see the inner working. xD
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Imitate Roundline with Shape meter

Post by balala »

theimmersion wrote:Working on a skin so didnt look close enough to this example, i saved it of course for later. First thing i noticed was the Ellipse so didnt even notice MyPath1 and MyPath2. Ill have to dissect it when i got time and see the inner working. xD
Ok. Come back and ask, if you have any question.