It is currently September 1st, 2024, 1:29 am

Container issues with an 'Arc Slider'

Get help with creating, editing & fixing problems with skins
User avatar
Strydr
Posts: 3
Joined: May 7th, 2024, 2:22 pm

Container issues with an 'Arc Slider'

Post by Strydr »

As part of another project I'm trying to get this arc to appear in a sliding movement. Everything works great until I add the line about a container. At that point the 2 graphics (arc and half circle) get misaligned and I can't figure out how to get them aligned properly to save my but! When I do get them aligned, the top of the arc is cut off and I have no idea why. I understand that the Arc graphic's position will be relative to the mask's position but things don't seem to work as I would expect.

If there's a better way to do this might be nice, too, but I'm really curious as to what I'm missing on this!
The zip file is included because it has the arc png. The icon is simply there for the next step, which will be to trigger the action. For now I've been using it to help see the boundaries of the skin, but it's irrelevant atm. Included in the zip file anyway.
Note that I'm not worried about the speed of the animation at this stage.

What am I missing?!

Any help would be appreciated, thank you!

Code: Select all

[Rainmeter]
Update=50
AccurateText=1
DynamicWindowSize=1
;SkinWidth=600
;SkinHeight=500

[Metadata]
Name=
Author=
Information=
Version=
License=Creative Commons Attribution - Non - Commercial - Share Alike 3.0

[Variables]
;ImageW=600
;ImageH=250

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

[MeasureLoop]
Measure=Loop
StartValue=0
Increment=1
EndValue=100
MaxValue=100
LoopCount=1

[MeterRoundlineContainer]
Meter=Roundline
MeasureName=MeasureLoop
;X=0
Y=250
W=600
H=250
StartAngle=(Rad(180))
RotationAngle=(Rad(180))
LineStart=304
LineLength=96
Solid=1
AntiAlias=1

[Meter_Arc]
Meter=Image
ImageName=#@#Images\Arc.png
x=0
y=-125
w=600
h=250
ImageAlpha=180
;DynamicVariables=1
Container=MeterRoundlineContainer


[Meter_Base]
Meter=Image
ImageName=#@#Images\Global.png
x=100
y=240
;MouseOverAction= [!CommandMeasure Measure_AT_Angle1 "Execute #State#"]  ;extraneous code, just a placeholder for now
AntiAlias=1
DynamicVariables=1
You do not have the required permissions to view the files attached to this post.
User avatar
balala
Rainmeter Sage
Posts: 16485
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Container issues with an 'Arc Slider'

Post by balala »

I see two problems with your code:
  • The width of the image used into the [Meter_Arc] meter (Arc.png) is much larger than its height. Accordingly a Roundline meter ([MeterRoundlineContainer]), which should cover it if used as container, can't do this.
  • The same image (arc.png) has to be enlarged, because it is smaller than what you want to show in the Image meter. This also can give an issue.
Not entirely sure, because I had no enough time to try finding a solution so far, however I'd be tempted to use a Shape meter as container for the [Meter_Arc] meter, instead of a Roundline.
User avatar
Strydr
Posts: 3
Joined: May 7th, 2024, 2:22 pm

Re: Container issues with an 'Arc Slider'

Post by Strydr »

Ok, thanks! I'll look into all three areas. Much appreciated!
User avatar
Yincognito
Rainmeter Sage
Posts: 8003
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Container issues with an 'Arc Slider'

Post by Yincognito »

Strydr wrote: May 16th, 2024, 1:05 pmWhat am I missing?!
I'm not 100% sure about it, since I got the misalignment too with your code, but I think what you were missing was that:
- the Roundline's outer edges are ... well, round, i.e. the shape of a circle, not an ellipse, so W and H need to be the same and twice the LineLength, if specified
- the LineStart / LineLength must be set right (the former = distance from the center to the inner edge, the latter = the one from the center to the outer edge)
- the Arc, being basically half of the Roundline, must be sized accordingly

With the 3 points above properly configured, no misalignment occurs, and everything is logical in terms of coordinates and dimensions:

Code: Select all

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

---Measures---

[Loop]
Measure=Loop
StartValue=0
Increment=1
EndValue=100
MaxValue=100
LoopCount=1

---Meters---

[Roundline]
Meter=Roundline
MeasureName=Loop
X=0
Y=0
W=530
H=530
StartAngle=(Rad(180))
RotationAngle=(Rad(180))
LineStart=100
LineLength=265
Solid=1
AntiAlias=1

[Arc]
Meter=Image
ImageName=#@#Images\Arc.png
X=0
Y=0
W=530
H=265
ImageAlpha=180
Container=Roundline

[Base]
Meter=Image
ImageName=#@#Images\Global.png
X=228
Y=45
AntiAlias=1
The above works with the same images as the ones in your attached .zip earlier, no photoshopping needed. Now you can move the Roundline container as desired and the Arc will follow it accordingly, since the latter's coordinates are indeed relative to the former's. You can set SkinHeight=265 in [Rainmeter] to cut off the empty space corresponding to the bottom half of the Roundline - it's not ideal, but since you cannot have nested containers... :confused:

As balala mentioned, a Shape offers greater flexibility, if done right.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
balala
Rainmeter Sage
Posts: 16485
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Container issues with an 'Arc Slider'

Post by balala »

Strydr wrote: May 16th, 2024, 1:05 pm What am I missing?!
What could be the magic in Yincognito's above code, to get a "flattened" image, is a proper TransformationMateix, applied to both, the container and the contained meter ([Roundline] and [Arc] in this case). Here is how this can be done:
  • Add a Flat variable to the [Variables] section (the section doesn't exist, but obviously can be created). Use any value between 0 and 1, for instance: Flat=0.75.
  • Add the following option to the [Roundline] and [Arc] meters: TransformationMatrix=1;0;0;#Flat#;0;0.
This is all. By this, you get the meter flattened and properly aligned with the container (I hope).
If any the meters is moved, the above TransformationMatrix has to be rewritten. If you need this, please let me know, to help you to rewrite the option.
User avatar
Strydr
Posts: 3
Joined: May 7th, 2024, 2:22 pm

Re: Container issues with an 'Arc Slider'

Post by Strydr »

Wow! So simple and so obvious when I have someone point it out to me!

Balala, that transformation works great, thanks! I don't do well with transformations, lol. I don't know if I will need it or not as I still want to play with Shapes and see what that's about but this is a great example of using a 'simple' transformation. Thank you.

Thank you both very much!!!
User avatar
balala
Rainmeter Sage
Posts: 16485
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Container issues with an 'Arc Slider'

Post by balala »

Strydr wrote: May 18th, 2024, 1:56 am Balala, that transformation works great, thanks! I don't do well with transformations, lol. I don't know if I will need it or not as I still want to play with Shapes and see what that's about but this is a great example of using a 'simple' transformation.
TransformationMatrix might help in some cases, however it has its own disadvantages as well (same way as everything else). Obviously was just a possible solution, working with shapes might be another. Glad if you got it working so far, but this time (again!) Yincognito gave the working solution.
User avatar
Yincognito
Rainmeter Sage
Posts: 8003
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Container issues with an 'Arc Slider'

Post by Yincognito »

Strydr wrote: May 18th, 2024, 1:56 am Thank you both very much!!!
balala wrote: May 18th, 2024, 5:28 am but this time (again!) Yincognito gave the working solution.
We're happy to help. Doesn't matter much who gave the solution, but yeah, some of them can indeed be refined. :great:
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth