It is currently April 25th, 2024, 8:14 am

New Container option

General topics related to Rainmeter.
User avatar
SilverAzide
Rainmeter Sage
Posts: 2605
Joined: March 23rd, 2015, 5:26 pm

Re: Test of new Container option

Post by SilverAzide »

jsmorley wrote: November 14th, 2018, 1:18 pmThis does mean that the overall size of the skin is fixed, but in my view, that is how it should be. All in all, I'm all for moving or sliding a "container" in order to move or slide all the content that is in it, but I'm very skeptical of scaling a container in order to simulate sliding it in and out. Aside from the known issues we have with that today, which we will no doubt fix, I'm not convinced it's a good approach. I'm concerned about efficiency and performance with it doing that much work.
Do you have a suggestion/opinion on how you would handle the scenario where the "slider" section is bigger than the skin? Specifically, using this exact skin, how would you completely hide the slider under the main skin area? I know the typical trick of explicitly setting the skin dimensions so the slider is clipped, but that won't work with a skin like this since there is a transparent "border" around the skin.
Gadgets Wiki GitHub More Gadgets...
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Test of new Container option

Post by jsmorley »

SilverAzide wrote: November 15th, 2018, 11:04 pm Do you have a suggestion/opinion on how you would handle the scenario where the "slider" section is bigger than the skin? Specifically, using this exact skin, how would you completely hide the slider under the main skin area? I know the typical trick of explicitly setting the skin dimensions so the slider is clipped, but that won't work with a skin like this since there is a transparent "border" around the skin.
That's the beauty of Container. You don't hide the "slider". A container meter isn't drawn anyway, so there is no need to hide that, or have it be off the skin or anything like that.

You just put the container meter where you want things to end up. It's invisible...

Put the "content" meter(s) anywhere outside of the container meter. They will be invisible as long as they are outside the container. They don't have to be outside the skin.

Slide the "content" meter(s) into the container meter, and done. Remember, you really only have to slide the "first" content meter in a container. Any others that are in the container after the first one will already be relative to the first one, and each other, and will follow automatically.
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Test of new Container option

Post by jsmorley »

Code: Select all

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

[Variables]
OffSet=200
U=[!UpdateMeasure Slider][!UpdateMeter *][!Redraw]

[Slider]
Measure=Plugin
Plugin=ActionTimer
ActionList1=Repeat SlideIn, 5, 40
SlideIn=[!SetVariable OffSet "(Clamp(#OffSet#-5,0,200))"]#U#
ActionList2=Repeat SlideOut, 5, 40
SlideOut=[!SetVariable OffSet "(Clamp(#OffSet#+5,0,200))"]#U#
DynamicVariables=1

[MeterBackground]
Meter=Image
W=250
H=110
SolidColor=0,0,0,255
MouseOverAction=[!CommandMeasure Slider "Stop 2"][!CommandMeasure Slider "Execute 1"]
MouseLeaveAction=[!CommandMeasure Slider "Stop 1"][!CommandMeasure Slider "Execute 2"]

[MeterContainer]
Meter=Image
X=25
Y=25
W=200
H=60
SolidColor=0,0,0,255

[MeterString1]
Meter=String
X=#OffSet#
FontSize=16
FontWeight=400
FontColor=255,255,255,255
AntiAlias=1
DynamicVariables=1
Text=I'm the first item
Container=MeterContainer

[MeterString2]
Meter=String
X=r
Y=10R
FontSize=16
FontWeight=400
FontColor=255,255,255,255
AntiAlias=1
Text=I'm the second item
Container=MeterContainer
GIF.gif
You do not have the required permissions to view the files attached to this post.
User avatar
SilverAzide
Rainmeter Sage
Posts: 2605
Joined: March 23rd, 2015, 5:26 pm

Re: Test of new Container option

Post by SilverAzide »

jsmorley wrote: November 15th, 2018, 11:14 pm You just put the container meter where you want things to end up. It's invisible...
[...]
Slide the "content" meter(s) into the container meter, and done.
Oh, now I see! Say, that *is* pretty sweet.... :)
Gadgets Wiki GitHub More Gadgets...
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Test of new Container option

Post by jsmorley »

SilverAzide wrote: November 15th, 2018, 11:44 pm Oh, now I see! Say, that *is* pretty sweet.... :)
The container meter can be thought of as an invisible "viewport". Anything that belongs to it that is "inside" the viewport is shown, anything that belongs to it that is "outside" the viewport more or less doesn't exist.

You can have a container meter with a bunch of content meter(s) in it, and slide that around, the content will follow the container automatically, but since any content that is "inside" the container will be fully visible, that puts you back to the problem this was really meant to solve. That you have to have the container slide from outside the entire skin, with all the SkinWidth and such hassles. That really wouldn't buy you anything.

The only thing to remember, as it will be tempting to try, is that you CAN'T "nest" a container inside a container. A "content" meter can't also be a "container" meter.
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Test of new Container option

Post by jsmorley »

Code: Select all

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

[Variables]
OffSet=200
U=[!UpdateMeasure Slider][!UpdateMeter *][!Redraw]

[Slider]
Measure=Plugin
Plugin=ActionTimer
ActionList1=Repeat SlideIn, 5, 40
SlideIn=[!SetVariable OffSet "(Clamp(#OffSet#-5,0,200))"]#U#
ActionList2=Repeat SlideOut, 5, 40
SlideOut=[!SetVariable OffSet "(Clamp(#OffSet#+5,0,200))"]#U#
DynamicVariables=1

[MeterBackground]
Meter=Shape
Shape=Rectangle 1,1,250,110 | StrokeWidth 1.5 | Stroke Color 0,0,0,255 | Fill Color 0,0,0,1
MouseOverAction=[!CommandMeasure Slider "Stop 2"][!CommandMeasure Slider "Execute 1"]
MouseLeaveAction=[!CommandMeasure Slider "Stop 1"][!CommandMeasure Slider "Execute 2"]

[MeterContainer]
Meter=Image
; Note I'm "solid", with an opacity of 255, but I won't be "drawn". I'm "invisible".
; Any solid pixels of my "content" meters will be drawn on any of my solid pixels.
X=25
Y=25
W=200
H=60
SolidColor=0,0,0,255

[MeterString1]
Meter=String
X=#OffSet#
FontSize=16
FontWeight=400
FontColor=255,255,255,255
AntiAlias=1
DynamicVariables=1
Text=I'm the first item
Container=MeterContainer

[MeterString2]
Meter=String
X=r
Y=10R
FontSize=16
FontWeight=400
FontColor=255,255,255,255
AntiAlias=1
Text=I'm the second item
Container=MeterContainer
GIF.gif

That's the "container" bit. The first of the two purposes for this functionality. The second bit is the "masking", which is also very powerful, but a slightly different discussion.

It's all one simple idea that has two powerful results. The idea is:

Any "content" meter(s) will be positioned relative to the "container", and the "content" will only be drawn on solid pixels of the container. Any content that is positioned outside the container, or that is on a transparent pixel in the container, will not be drawn. Content outside the container is truncated, and in effect doesn't exist. It will not impact the size of the skin.
You do not have the required permissions to view the files attached to this post.
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Test of new Container option

Post by jsmorley »

Code: Select all

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

[Variables]

[MeasureLoop]
Measure=Loop
StartValue=0
EndValue=24
Increment=1

[MeterRainyShadow]
Meter=String
; The actual text of this meter will be overlaid by the
; string we are using as mask, but the shadow will
; be displayed around it.
FontSize=120
FontWeight=700
FontColor=255,255,255,255
InlineSetting=Shadow | 2 | 2 | 3.5 | 0,0,0,255
AntiAlias=1
Text=RAINY

[MeterRainyMask]
Meter=String
FontSize=120
FontWeight=700
; Note that no FontColor is needed, as long as it is fully opaque,
; which the default FontColor for a String meter is.
AntiAlias=1
Text=RAINY

[MeterWeatherMasked]
Meter=Image
ImageName=#@#Images\Rain\Rain-[MeasureLoop].png
DynamicVariables=1
; Use X and Y to position to image in the String meter.
X=0
Y=-140
W=540
PreserveAspectRatio=1
Container=MeterRainyMask

Click to Animate
RainyWeather.gif


Animation frames:
Rain.zip
You do not have the required permissions to view the files attached to this post.
oZone
Posts: 154
Joined: May 14th, 2018, 4:46 pm

Re: Test of new Container option

Post by oZone »

This is great, just be careful when using meterstyle or @include option to not accidentally create something like this

Code: Select all

[MeterStyle]
Container=MeterContainer

[MeterContainer]
Meter=Shape
MeterStyle=MeterStyle

[MeterContent]
Meter=Shape
MeterStyle=MeterStyle
MeterContainer will became content itself resulting in rainmeter crash.
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Test of new Container option

Post by jsmorley »

oZone wrote: November 17th, 2018, 6:35 pm This is great, just be careful when using meterstyle or @include option to not accidentally create something like this

Code: Select all

[MeterStyle]
Container=MeterContainer

[MeterContainer]
Meter=Shape
MeterStyle=MeterStyle

[MeterContent]
Meter=Shape
MeterStyle=MeterStyle
MeterContainer will became content itself resulting in rainmeter crash.
Correct, attempting to make a container content for itself is currently fatal... Obviously, this will never be possible or even desirable, but we will ensure it at least isn't suicide.
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Test of new Container option

Post by jsmorley »

dvo wrote: November 18th, 2018, 4:57 pm @Js Morley rainy doesn't work with me i only see the rain instead of rainy in rain..... :-(
copied script and put anim in the right folder if loaded i see only the rain updated to the latest version....
You quite sure you have installed this?

https://builds.rainmeter.net/Rainmeter-4.3-Container5.exe

As of this writing, this is still in "alpha", and is not included in the "beta" versions available on the main site. It is only distributed here in the forums, in the first post of this thread.

Edit: I added RainyWeather to the .rmskin in the first post, so you don't have to create it from scratch.