It is currently April 27th, 2024, 3:05 pm

My Animation Button isn't playing.

Get help with creating, editing & fixing problems with skins
User avatar
Thinkr8
Posts: 65
Joined: November 14th, 2020, 2:36 pm
Location: Washington DC

My Animation Button isn't playing.

Post by Thinkr8 »

I was hoping I could get some assistance with my animation button that isn't working. I re-coded it from another animation skin I had to use as a sample.
I think (I know) I messed it up because this is my first attempt at animating an image button.
What did I do wrong?
Rainmeter "About" shows - Error: Unable to open: (USS ENTERPRISE NCC-1701-G\Pulp\Buttons\Shields\B16.ini) ImageName: C:\Users\Me\OneDrive\Documents\Rainmeter\Skins\USS ENTERPRISE NCC-1701-G\@Resources\Images\Buttons\Shields\000.png.
As you can see in the screenshot the image files aren't named from 000.png to 0010.png.
Should they be?
And the files are, "Always keep on this device."
Having the "Shields button animate would be a nice addition to my suite."
Perhaps the Update=-1 needs a new update value? But, I think ["#Action1#"] is wrong?
Everything else with the "Mouse Down Action" works.
Screenshot 2023-12-26 114251.png
I'd like for the ani button to stop at 010.png then activate the shields and then when I deactivate the shields the ani button should go back to 00.png Thank you for helping.

Code: Select all

[Rainmeter]
@Include="#@#Ink\ContextMenu1.inc"
Update=-1
AccurateText=1

[Metadata]
Name=B16.ini
Author=Thinkr8 (AST)
Version=1.0 Build 
License=http://creativecommons.org/licenses/by-nc-sa/3.0 (Creative Commons BY-NC-SA 3.0)
Information=Ship Shields Button.

[Variables]
@IncludeTips="#@#Ink\ToolTips.inc"
@IncludeApps="#@#Ink\Apps.inc"

[MeasureAnimation]
Measure=Calc
Formula=(Counter % 100) +1

[AniImageButtons]
Meter=Image
ImagePath="#@#Images\Buttons\Shields\00[MeasureAnimation].png"
X=0
Y=0
W=48
H=133
PreserveAspectRatio=1
DynamicVariables=1
AntiAlias=1

[1]
Meter=Image
ImageName="#@#Images\Buttons\Shields\00.png"
X=0
Y=0
W=48
H=133
ToolTipText="#AS#"
ToolTipHidden="#HideTips#"
LeftMouseDownAction=[PLAY #@#Sounds\execute.wav]["#Action1#"]["#AppSHTB#"][!ToggleConfig "USS ENTERPRISE NCC-1701-G\Pulp\Shields" "Shield.ini"][!Update][!Redraw]
AntiAlias=1
The below code is what I have as a stand-alone image button.

Code: Select all

; [Image]
; Meter=IMAGE
; ImageName="#@#Images\Buttons\B16.png"
; X=0
; Y=0
; W=48
; H=133
; ToolTipText="#AS#"
; ToolTipHidden="#HideTips#"
; MouseOverAction=[!SetOption #CURRENTSECTION# GreyScale 1][!UpdateMeter #CURRENTSECTION#][!Redraw]
; MouseLeaveAction=[!SetOption #CURRENTSECTION# GreyScale 0][!UpdateMeter #CURRENTSECTION#][!Redraw]
; LeftMouseDownAction=[PLAY #@#Sounds\execute.wav]["#AppSHTB#"][!ToggleConfig "USS ENTERPRISE NCC-1701-G\Pulp\Shields" "Shield.ini"]
; AntiAlias=1
You do not have the required permissions to view the files attached to this post.
Last edited by Thinkr8 on December 27th, 2023, 7:52 am, edited 4 times in total.
Someone said, "Your thinking too much, so I thought more."
User avatar
balala
Rainmeter Sage
Posts: 16176
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: My Animation Button Not Working

Post by balala »

Thinkr8 wrote: December 26th, 2023, 6:22 pm I was hoping I could get some assistance with my animation button that isn't working.
What do you mean by "my animation button that isn't working."? If you meant that the animation is not playing, this is caused by the Update=-1 option of the [Rainmeter] section (as you by yourself did figure out). With this option the skin is never updated excepting the very first moment after refresh. The value of the [MeasureAnimation] measure is not increasing as it should with a "normal" update of the skin. So, replace the Update option with a positive number. How large it should be, depends on how frequently would you like to update the animation. The greater value do you use, the slower the animation goes on.
If on the other hand you don1t even get the images visible, my first question is how do you have named those images? Because it's not entirely clear to me. If they are named as 00.png - 99.png, you have to add a substitution to the [MeasureAnimation] measure, to get the leading zeros, which a Calc measure doesn't add. If this is the case, add the following options, beside the existing ones:

Code: Select all

[MeasureAnimation]
...
RegExpSubstitute=1
Substitute="^(.)$":"0\1"
In any case the above Substitute option adds the leading zeros to the numbers containing one single digit.
Hope these idea help you. If you still can't get the skin working, please let us know what are the exact names of the images.
User avatar
Thinkr8
Posts: 65
Joined: November 14th, 2020, 2:36 pm
Location: Washington DC

Re: My Animation Button Not Working

Post by Thinkr8 »

balala wrote: December 26th, 2023, 7:25 pm f you meant that the animation is not playing,
Yes, that is what I meant.
The Images are named 00.png to 010.png, that's a total of 11 images.
Upon clicking the ani button I'd like for the ani button to play then stop playing at image 010.png, then activate the shields.ini, and then when I deactivate the shields.ini the ani button should play and go back to Image 00.png then stop playing until it is clicked again.
And I still fail to understand what the Value of the Update=? should be. :( I've tried 5, 25, 50, 100, and 1000.

Thank you for,

Code: Select all

[MeasureAnimation]
...
RegExpSubstitute=1
Substitute="^(.)$":"0\1"
I added it to the section and the ani button still isn't playing.
Last edited by balala on December 26th, 2023, 9:34 pm, edited 1 time in total.
Reason: Please use <code> tags whenever are posting codes. It's the </> button.
Someone said, "Your thinking too much, so I thought more."
User avatar
Thinkr8
Posts: 65
Joined: November 14th, 2020, 2:36 pm
Location: Washington DC

Re: My Animation Button Not Working

Post by Thinkr8 »

Yincognito, can you help? We seem to be having a translation issue, lol. The universal translator must be offline. :)
Someone said, "Your thinking too much, so I thought more."
User avatar
balala
Rainmeter Sage
Posts: 16176
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: My Animation Button Not Working

Post by balala »

Thinkr8 wrote: December 26th, 2023, 9:24 pm Yes, that is what I meant.
In this case you should have to use a positive value for the Update option. But if you don't want a continuous play, you have other choices as well. See below.
Thinkr8 wrote: December 26th, 2023, 9:24 pm The Images are named 00.png to 010.png, that's a total of 11 images.
You can replace the previously posted Substitute option by the following one: Substitute="(.{1,2})":"0\1". But if there are only 11 images, the Formula option of the same [MeasureAnimation] measure should also be replaced by the following one: Formula=( Counter % 11 ). The Counter function is updated / increased by itself, no need to add 1.
So, just to be extremely precise, the whole [MeasureAnimation] measure should look this way:

Code: Select all

[MeasureAnimation]
Measure=Calc
Formula=( Counter % 11 )
RegExpSubstitute=1
Substitute="(.{1,2})":"0\1"
Thinkr8 wrote: December 26th, 2023, 9:24 pm Upon clicking the ani button I'd like for the ani button to play then stop playing at image 010.png, then activate the shields.ini, and then when I deactivate the shields.ini the ani button should play and go back to Image 00.png then stop playing until it is clicked again.
If your skin doesn't have other not posted parts, I probably would be tempted to use the Update=-1 option in the [Rainmeter] section (as you did) and add an ActionTimer plugin measure. If want to try this out, do the followings:
  • Add a (let's name it) Ord variable to the [Variables] section (just add this variable, don't remove the existing options):

    Code: Select all

    [Variables]
    ...
    Ord=0
    Obviously the Ord name is arbitrary, you can use any other.
  • Replace the [MeasureAnimation] measure by the following one:

    Code: Select all

    [MeasureAnimation]
    Measure=Calc
    Formula=#Ord#
    RegExpSubstitute=1
    Substitute="(.{1,2})":"0\1"
    DynamicVariables=1
    In fact the only reason why we have to use this measure is to can add the leading zero to the value of the variable. If in the name of those images you could remove the leading zeros, we could completely renounce to the above [MeasureAnimation] measure. Is this possible (I think it is, but am I right)?
  • Add the following measure to your code:

    Code: Select all

    [MeasureOrd]
    Measure=Plugin
    Plugin=ActionTimer
    Group=Sliders
    ActionList1=Repeat Up,20,10 | Wait 500 | ActivConf
    Up=[!SetVariable Ord "(Clamp((#Ord#+1),0,10))"][!UpdateMeasure "MeasureOrd"][!UpdateMeasure "MeasureAnimation"][!UpdateMeter "AniImageButtons"][!Redraw]
    ActivConf=[!ActivateConfig "USS ENTERPRISE NCC-1701-G\Pulp\Shields" "Shield.ini"]
    ActionList2=Repeat Down,20,10 | Wait 500 | DeactivConfig
    Down=[!SetVariable Ord "(Clamp((#Ord#-1),0,10))"][!UpdateMeasure "MeasureOrd"][!UpdateMeasure "MeasureAnimation"][!UpdateMeter "AniImageButtons"][!Redraw]
    DeactivConfig=[!DeactivateConfig "USS ENTERPRISE NCC-1701-G\Pulp\Shields"]
    DynamicVariables=1
    See that I assumed the [AniImageButtons] is the meter which should show the animation (in the posted code this is the meter having the ImageName option related to the [MeasureAnimation] measure: ImagePath="#@#Images\Buttons\Shields\00[MeasureAnimation].png"), so this is the meter I updated into the Up and Down options. I also assumed the meter which you have / want to click to start the animation is [1], not "ani button", as you said in your last reply (this meter has a LeftMouseDownAction option).
  • Replace the ImageName option of the [AniImageButtons] meter by this: ImagePath=#@#Images\Buttons\Shields\[MeasureAnimation].png. Note that I removed the 00 from the path. Also removed the not-needed quotes (less important).
  • Finally replace the LeftMouseDownAction option of the [1] meter, by the following two options:

    Code: Select all

    [1]
    ...
    LeftMouseUpAction=[!CommandMeasure "MeasureOrd" "Execute 1"][!CommandMeasure "MeasureOrd" "Stop 2"]
    RightMouseUpAction=[!CommandMeasure "MeasureOrd" "Stop 1"][!CommandMeasure "MeasureOrd" "Execute 2"]
What is different than what you asked for: when you click the [1] meter, you get starting the animation. When it finishes increasing the variable, after half a second it activates the Shield.ini skin. You did ask to restart the animation to decrease the variable, when you deactivate the skin. Even if possible, this is a little bit more complicated, because we have to use a plugin to can know when you deactivated the config. So for now, when you right-click the [1] meter, the variable get starting decreasing, then when it reaches 0, after half a second the skin is deactivated. For first let's try it this way and let me know if you could get the skin working as expected. If you could, further improvements are definitely possible and we'll do them.
If you can't get this properly working, please repost the whole code of your skin.
Thinkr8 wrote: December 26th, 2023, 9:24 pm And I still fail to understand what the Value of the Update=? should be. :( I've tried 5, 25, 50, 100, and 1000.
Update is the time amount between two consecutive updates of the skin. If it's negative, the skin is never updated excepting the very first moment when is activated. Details here.
User avatar
Thinkr8
Posts: 65
Joined: November 14th, 2020, 2:36 pm
Location: Washington DC

Re: My Animation Button isn't playing.

Post by Thinkr8 »

Thanks, Balala, that's a lot to consume so it'll take me a few days to work with, I'll be back on here to let you know how it went. :)
Someone said, "Your thinking too much, so I thought more."
User avatar
balala
Rainmeter Sage
Posts: 16176
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: My Animation Button isn't playing.

Post by balala »

Thinkr8 wrote: December 26th, 2023, 11:22 pm Thanks, Balala, that's a lot to consume so it'll take me a few days to work with, I'll be back on here to let you know how it went. :)
Alright. Please let me know how does it work, when you tried it out.
User avatar
Thinkr8
Posts: 65
Joined: November 14th, 2020, 2:36 pm
Location: Washington DC

Re: My Animation Button isn't playing.

Post by Thinkr8 »

Hello again, I was able to test this sooner than I thought but before we begin debugging the code I should mention the [AniImageButton] (it wasn't meant to be Buttons, so I removed the S) doesn't close the shields.ini, the button on the shields.ini closes the shields.ini, so I'm pretty sure these lines of code aren't needed here. ActionList2=Repeat Down,20,10 | Wait 500 | DeactivConfig
Down=[!SetVariable Ord "(Clamp((#Ord#-1),0,10))"][!UpdateMeasure "MeasureOrd"][!UpdateMeasure "MeasureAnimation"][!UpdateMeter "AniImageButton"][!Redraw]
DeactivConfig=[!DeactivateConfig "USS ENTERPRISE NCC-1701-G\Pulp\Shields"] and [!CommandMeasure "MeasureOrd" "Stop 2"].


And there will never be a RightMouseUpAction=[!CommandMeasure "MeasureOrd" "Stop 1"][!CommandMeasure "MeasureOrd" "Execute 2"] with the [AniImageButton] meter.

And now this is what I did with the code: (and it still doesn't play the animation. The sound effect, #AppSHTB#, and the ActivateConfig shield.ini does work.)

My best guess is the [MeasureOrd] section needs to be debugged, but I don't where the problem lies.

Code: Select all

[Rainmeter]
@Include="#@#Ink\ContextMenu1.inc"
Update=-1
AccurateText=1

[Metadata]
Name=B16.ini
Author=Thinkr8 (AST)
Version=1.0 Build 
License=http://creativecommons.org/licenses/by-nc-sa/3.0 (Creative Commons BY-NC-SA 3.0)
Information=Ship Shields Button.

[Variables]
@IncludeTips="#@#Ink\ToolTips.inc"
@IncludeApps="#@#Ink\Apps.inc"

Ord=0

[MeasureAnimation]
Measure=Calc
Formula=#Ord#
RegExpSubstitute=1
Substitute="(.{1,2})":"0\1"
DynamicVariables=1

[MeasureOrd]
Measure=Plugin
Plugin=ActionTimer
Group=Sliders
ActionList1=Repeat Up,20,10 | Wait 500 | ActivConf
Up=[!SetVariable Ord "(Clamp((#Ord#+1),0,10))"][!UpdateMeasure "MeasureOrd"][!UpdateMeasure "MeasureAnimation"][!UpdateMeter "AniImageButton"][!Redraw]
ActivConf=[PLAY #@#Sounds\execute.wav]["#AppSHTB#"][!ActivateConfig "USS ENTERPRISE NCC-1701-G\Pulp\Shields" "Shield.ini"]
DynamicVariables=1

[AniImageButton]
Meter=Image
ImagePath=#@#Images\Buttons\Shields\[MeasureAnimation].png
X=0
Y=0
W=48
H=133
PreserveAspectRatio=1
DynamicVariables=1
AntiAlias=1

[1]
Meter=Image
ImageName=#@#Images\Buttons\Shields\00.png
X=0
Y=0
W=48
H=133
ToolTipText="#AS#"
ToolTipHidden="#HideTips#"
LeftMouseUpAction=[!CommandMeasure "MeasureOrd" "Execute 1"]
AntiAlias=1
I didn't re-name the image files by removing the leading zero because It's not required.

If you would like to have a look at the entire suite/skin I shared it to the "Share Your Creations" here in the forum, but I didn't upload the package, it's only available at my DA account. Should I upload it to my forum post for you?

Link- https://forum.rainmeter.net/viewtopic.php?p=220351#p220351

Sorry about that, I don't know how to box what is red :(
Someone said, "Your thinking too much, so I thought more."
User avatar
balala
Rainmeter Sage
Posts: 16176
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: My Animation Button isn't playing.

Post by balala »

Thinkr8 wrote: December 27th, 2023, 7:48 am Hello again, I was able to test this sooner than I thought but before we begin debugging the code I should mention the [AniImageButton] (it wasn't meant to be Buttons, so I removed the S) doesn't close the shields.ini,
This is what you did ask previously:
Thinkr8 wrote: December 26th, 2023, 9:24 pm Upon clicking the ani button I'd like for the ani button to play then stop playing at image 010.png, then activate the shields.ini, and then when I deactivate the shields.ini the ani button should play and go back to Image 00.png then stop playing until it is clicked again.
I understood that you want to use the "ani button" to start the animation. After the animation completes, the shields.ini should be activated. I think this is done. But at this point I thought you want to start the animation from 010.png to 00.png, when you manually close the shield.ini skin. This is why I said this is definitely possible, but have to use the ConfigActive plugin. Being little bit complicated, I added the decreasing feature as a right-click on the same meter ([1]) and described this:
balala wrote: December 26th, 2023, 10:40 pm So for now, when you right-click the [1] meter, the variable get starting decreasing, then when it reaches 0, after half a second the skin is deactivated. For first let's try it this way and let me know if you could get the skin working as expected.
Accordingly to the code, after you get the increasing animation completed, when you right click the meter, the animation goes from 010.png to 00.png and after half a second deactivates the skin. I think this should have been working.
Thinkr8 wrote: December 27th, 2023, 7:48 am so I'm pretty sure these lines of code aren't needed here. ActionList2=Repeat Down,20,10 | Wait 500 | DeactivConfig
Down=[!SetVariable Ord "(Clamp((#Ord#-1),0,10))"][!UpdateMeasure "MeasureOrd"][!UpdateMeasure "MeasureAnimation"][!UpdateMeter "AniImageButton"][!Redraw]
DeactivConfig=[!DeactivateConfig "USS ENTERPRISE NCC-1701-G\Pulp\Shields"] and [!CommandMeasure "MeasureOrd" "Stop 2"].
ActionList2 is the option which when called:
  • Starts the animation (this process is controlled by the Repeat Down,20,10 parameter).
  • Waits half a seconds, so 500 milliseconds (controlled by Wait 500).
  • Finally executes the DeactivConfig parameter, which is posted below. This option deactivates the appropriate skin.
The running of the animation in reverse order (from 010.png to 00.png) is controlled by the Down option.
Thinkr8 wrote: December 27th, 2023, 7:48 am And there will never be a RightMouseUpAction=[!CommandMeasure "MeasureOrd" "Stop 1"][!CommandMeasure "MeasureOrd" "Execute 2"] with the [AniImageButton] meter.
Yep, understood. As said above, I posted this right-click feature just to get a simpler way to let you see how the reversed order animation works.
Thinkr8 wrote: December 27th, 2023, 7:48 am And now this is what I did with the code: (and it still doesn't play the animation. The sound effect, #AppSHTB#, and the ActivateConfig shield.ini does work.)
The most important thing why the animation is not playing is the images don't exist. There are other issues as well:
  • The ImagePath option of the [AniImageButton] meter should be ImageName. ImagePath should stores the path of the images, without their names, while ImageName should store the complete names of images. Other way is to use both options: ImagePath where you add only the path and ImageName, where you add only their names. So replace the ImagePath=#@#Images\Buttons\Shields\[MeasureAnimation].png option of the [AniImageButton] meter either by:
    • ImageName=#@#Images\Buttons\Shields\[MeasureAnimation].png
    or by:
    • Code: Select all

      [AniImageButton]
      ...
      ImagePath=#@#Images\Buttons\Shields
      ImageName=[MeasureAnimation].png
  • Obviously as said above, since these images don1t exist, you have to fix the paths in any of the above two possibilities.
  • Finally both meters, [AniImageButton] and [1] meters are placed in the same position. Not knowing which images do you want to use as animation, I don1T know if it's the case, but if the images are not large enough, the [1] meter might cover [AniImageButton], which in such a case might not be visible. You probably should either move one of those meters, or at least make the covering [1] meter semi-transparent.
Thinkr8 wrote: December 27th, 2023, 7:48 am Sorry about that, I don't know how to box what is red :(
If by "box" you mean snippet, you can do it this way: <Snippet>Image<color=#FF0000>Name</color>=#@#Images\Buttons\Shields\[MeasureAnimation].png</Snippet>.
However you can't color parts of a code, delimitated by <code>...</code> tags.
User avatar
Yincognito
Rainmeter Sage
Posts: 7176
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: My Animation Button Not Working

Post by Yincognito »

Thinkr8 wrote: December 26th, 2023, 10:20 pm Yincognito, can you help? We seem to be having a translation issue, lol. The universal translator must be offline. :)
Sorry for the delay, was probably sleeping / busy with other projects and didn't hear the translation call, lol. Did balala manage to guide you on this, or do you still need my help? In case you do, personally I'd prefer to work with a separate / individual simplified sample of what you're aiming for (which could easily be then integrated in your code), rather than spending time to get familiar with your actual suite scenario as a prerequisite. It would be faster that way, that's all. ;-)
I'd like for the ani button to stop at 010.png then activate the shields and then when I deactivate the shields the ani button should go back to 00.png
I guess the main question here is do you want the last part to happen when you deactivate the shields skin from the button skin, or regardless of where you deactivate the shields skin from (e.g. externally of the button skin, from the Rainmeter context menu or otherwise). By the way, even in the last case, you won't necessarily need the ConfigActive plugin, you could simply send some variable from the shields skin to the button skin on the former's refresh and close, and have your shields skin status at your disposal in the button skin (of course, assuming the button skin is loaded first, so the variable can get to it).
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth