It is currently April 16th, 2024, 2:30 pm

Cutting image

Get help with creating, editing & fixing problems with skins
MiamiCenter
Posts: 3
Joined: December 31st, 2018, 7:03 pm

Cutting image

Post by MiamiCenter »

Hello, I am trying to make a custom button in unFold ( https://www.deviantart.com/devilrev/art/unFold-A-Launcher-618503449 ) skin,
but right-sided, something like this;
http://prntscr.com/m1p6kd
However, when I hover my mouse on top of the 2 icon, it'll move to the left as I want, but it's also cutting the image like this;
http://prntscr.com/m1p6sn

imagehttps://media.discordapp.net/attachments/463420283546763265/529376780763529237/payday.png
My code;

Code: Select all

[Rainmeter]
Update=1000
BackgroundMode=2
SolidColor=0,0,0,1

[Metadata]
Name=unFold
Author=DevilRev

[Variables]
X1=-150
U=[!UpdateMeasureGroup Sliders][!UpdateMeterGroup Items][!Redraw]

[PAYDAY]
Meter=Image
Group=Items
ImageName=#@#Buttons\Transparent\payday.png
H=50
X=#X1#
DynamicVariables=1
MouseOverAction=[!CommandMeasure MeasureSlide "Stop 1"][!CommandMeasure MeasureSlide "Execute 2"]
MouseLeaveAction=[!CommandMeasure MeasureSlide "Stop 2"][!CommandMeasure MeasureSlide "Execute 1"]
LeftMouseDownAction=[!SetOption "#CURRENTSECTION#" "ImageAlpha" "150"][!Update]
LeftMouseUpAction=[!SetOption "#CURRENTSECTION#" "ImageAlpha" "255"][!Update]["payday2.exe"]
RightMouseDownAction=[!Update]

[MeasureSlide]
Measure=Plugin
Plugin=ActionTimer
Group=Sliders
ActionList1=Repeat Left,5,30
Left=[!SetVariable X1 "(Clamp(#X1#-5,150,0))"]#U#
ActionList2=Repeat Right,5,30
Right=[!SetVariable X1 "(Clamp(#X1#+5,150,0))"]#U#
DynamicVariables=1
2nd problem is - when I turn on Rainmeter it'll be like on the 2nd screen, I have to hover on top of the icon for a white to get the 1st screenshot setup.

Any idea how can I avoid and/or fix this?
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5391
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: Cutting image

Post by eclectic-tech »

Try this:

Code: Select all

[Rainmeter]
Update=1000
BackgroundMode=2
SolidColor=0,0,0,1

[Metadata]
Name=unFold
Author=DevilRev

[Variables]
X1=-50
U=[!UpdateMeasureGroup Sliders][!UpdateMeterGroup Items][!Redraw]

[PAYDAY]
Meter=Image
Group=Items
ImageName=#@#Buttons\Transparent\payday.png
H=50
X=(#ScreenAreaWidth#+#X1#)
DynamicVariables=1
MouseOverAction=[!CommandMeasure MeasureSlide "Stop 2"][!CommandMeasure MeasureSlide "Execute 1"]
MouseLeaveAction=[!CommandMeasure MeasureSlide "Stop 1"][!CommandMeasure MeasureSlide "Execute 2"]
LeftMouseUpAction=[!SetOption "#CURRENTSECTION#" "ImageAlpha" "150"][!Update]
LeftMouseDownAction=[!SetOption "#CURRENTSECTION#" "ImageAlpha" "255"][!Update]["payday2.exe"]
RightMouseDownAction=[!Update]

[MeasureSlide]
Measure=Plugin
Plugin=ActionTimer
Group=Sliders
ActionList1=Repeat Left,5,30
Left=[!SetVariable X1 "(Clamp(#X1#-5,-200,-50))"]#U#
ActionList2=Repeat Right,5,30
Right=[!SetVariable X1 "(Clamp(#X1#+5,-200,-50))"]#U#
DynamicVariables=1
I changed the X value in [PAYDAY] to align to the right screen edge + the negative starting value of X1.
The Mouseover actions in that section were also reversed (so it slides to the left instead on hover).
And the minimum and maximum values in the action timer were changed to provide the necessary movement.

If you have a second monitor to the right, the last 3/4 of the image will appear on that screen. One way to correct that, would be to use a container meter positioned at the right side, and align this content with it.
User avatar
balala
Rainmeter Sage
Posts: 16142
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Cutting image

Post by balala »

EDIT: Sorry eclectic-tech, for my late reply.

Related to the first question: there is a small mistake in the Left and Right options of the [MeasureSlide] measure: the limits of the Clamp function are wrong. Instead of 150,0 you should have to have -150,0 in both options. Updating the measure, it would be:

Code: Select all

[MeasureSlide]
Measure=Plugin
Plugin=ActionTimer
Group=Sliders
ActionList1=Repeat Left,5,30
Left=[!SetVariable X1 "(Clamp(#X1#-5,-150,0))"]#U#
ActionList2=Repeat Right,5,30
Right=[!SetVariable X1 "(Clamp(#X1#+5,-150,0))"]#U#
DynamicVariables=1
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5391
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: Cutting image

Post by eclectic-tech »

balala wrote: December 31st, 2018, 8:26 pm Related to the first question: there is a small mistake in the Left and Right options of the [MeasureSlide] measure: the limits of the Clamp function are wrong. Instead of 150,0 you should have to have -150,0 in both options. Updating the measure, it would be:

Code: Select all

[MeasureSlide]
Measure=Plugin
Plugin=ActionTimer
Group=Sliders
ActionList1=Repeat Left,5,30
Left=[!SetVariable X1 "(Clamp(#X1#-5,-150,0))"]#U#
ActionList2=Repeat Right,5,30
Right=[!SetVariable X1 "(Clamp(#X1#+5,-150,0))"]#U#
DynamicVariables=1
Yes, I modified those values in order to get the requested action, but forgot to mention the original ones were incorrect.
It can get confusing when using negative number values; but it is always this syntax:
(Clamp({Formula},{MinimumValue},{MaximumValue}))
User avatar
balala
Rainmeter Sage
Posts: 16142
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Cutting image

Post by balala »

eclectic-tech wrote: December 31st, 2018, 8:31 pm It can get confusing when using negative number values; but it is always this syntax:
(Clamp({Formula},{MinimumValue},{MaximumValue}))
Exactly. The first value always MUST to be smaller then the second one. This is extremely important!
MiamiCenter
Posts: 3
Joined: December 31st, 2018, 7:03 pm

Re: Cutting image

Post by MiamiCenter »

eclectic-tech wrote: December 31st, 2018, 8:24 pm Try this:

Code: Select all

[Rainmeter]
Update=1000
BackgroundMode=2
SolidColor=0,0,0,1

[Metadata]
Name=unFold
Author=DevilRev

[Variables]
X1=-50
U=[!UpdateMeasureGroup Sliders][!UpdateMeterGroup Items][!Redraw]

[PAYDAY]
Meter=Image
Group=Items
ImageName=#@#Buttons\Transparent\payday.png
H=50
X=(#ScreenAreaWidth#+#X1#)
DynamicVariables=1
MouseOverAction=[!CommandMeasure MeasureSlide "Stop 2"][!CommandMeasure MeasureSlide "Execute 1"]
MouseLeaveAction=[!CommandMeasure MeasureSlide "Stop 1"][!CommandMeasure MeasureSlide "Execute 2"]
LeftMouseUpAction=[!SetOption "#CURRENTSECTION#" "ImageAlpha" "150"][!Update]
LeftMouseDownAction=[!SetOption "#CURRENTSECTION#" "ImageAlpha" "255"][!Update]["payday2.exe"]
RightMouseDownAction=[!Update]

[MeasureSlide]
Measure=Plugin
Plugin=ActionTimer
Group=Sliders
ActionList1=Repeat Left,5,30
Left=[!SetVariable X1 "(Clamp(#X1#-5,-200,-50))"]#U#
ActionList2=Repeat Right,5,30
Right=[!SetVariable X1 "(Clamp(#X1#+5,-200,-50))"]#U#
DynamicVariables=1
I changed the X value in [PAYDAY] to align to the right screen edge + the negative starting value of X1.
The Mouseover actions in that section were also reversed (so it slides to the left instead on hover).
And the minimum and maximum values in the action timer were changed to provide the necessary movement.

If you have a second monitor to the right, the last 3/4 of the image will appear on that screen. One way to correct that, would be to use a container meter positioned at the right side, and align this content with it.
Working perfectly, thanks <3
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5391
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: Cutting image

Post by eclectic-tech »

Happy to help! :thumbup:

Happy New Year! 8-)
MiamiCenter
Posts: 3
Joined: December 31st, 2018, 7:03 pm

Re: Cutting image

Post by MiamiCenter »

I see just one small mistake here;

Code: Select all

LeftMouseUpAction=[!SetOption "#CURRENTSECTION#" "ImageAlpha" "150"][!Update]
LeftMouseDownAction=[!SetOption "#CURRENTSECTION#" "ImageAlpha" "255"][!Update]["payday2.exe"]
It stays gray all the time when I click on it, the solution is to write it like this;

Code: Select all

LeftMouseDownAction=[!SetOption "#CURRENTSECTION#" "ImageAlpha" "150"][!Update]
LeftMouseUpAction=[!SetOption "#CURRENTSECTION#" "ImageAlpha" "255"][!Update]["payday2.exe"]
Just switching the up and down command :)

Happy new year everyone, and thanks for helping me out :D
User avatar
balala
Rainmeter Sage
Posts: 16142
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Cutting image

Post by balala »

When you're setting the ImageAlpha option, doesn't worth to update the whole skin. It would enough to update the current section (this time the [PAYDAY] meter). According to this, the above LeftMouseDownAction and LeftMouseUpAction options would be:

Code: Select all

LeftMouseDownAction=[!SetOption "#CURRENTSECTION#" "ImageAlpha" "150"][!UpdateMeter "#CURRENTSECTION#"][!Redraw]
LeftMouseUpAction=[!SetOption "#CURRENTSECTION#" "ImageAlpha" "255"][!UpdateMeter "#CURRENTSECTION#"][!Redraw]["payday2.exe"]