It is currently April 27th, 2024, 7:29 pm

Skin-Help - image pan animation

Get help with creating, editing & fixing problems with skins
cpt.failcraft
Posts: 8
Joined: December 11th, 2023, 7:54 pm

Skin-Help - image pan animation

Post by cpt.failcraft »

I'm seeking assistance with a desktop skin project where, upon hovering the mouse over medium-sized image, I want 4 - 12 randomly chosen background images from a specified file path to randomly fade in, pan across the desktop, and then fade out and then repeat the process. Additionally, the images should have a 30% opacity and a fade effect on their outer edges. I've implemented code to limit the number of images on screen, but I'm facing issues as the mouse hover detection is not retrieving the images, despite the indicator showing that the mouse is hovering. Can you suggest a suitable skin as a foundation for my code implementation? Thank you.
cpt.failcraft
Posts: 8
Joined: December 11th, 2023, 7:54 pm

Re: Skin-Help - image pan animation

Post by cpt.failcraft »

Is this even possible, I've browsed a few skins and I've seen some similar functions on animated images, but nothing like my goal
User avatar
balala
Rainmeter Sage
Posts: 16179
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Skin-Help - image pan animation

Post by balala »

cpt.failcraft wrote: December 26th, 2023, 11:59 pm I'm seeking assistance with a desktop skin project where, upon hovering the mouse over medium-sized image, I want 4 - 12 randomly chosen background images from a specified file path to randomly fade in, pan across the desktop, and then fade out and then repeat the process. Additionally, the images should have a 30% opacity and a fade effect on their outer edges. I've implemented code to limit the number of images on screen, but I'm facing issues as the mouse hover detection is not retrieving the images, despite the indicator showing that the mouse is hovering. Can you suggest a suitable skin as a foundation for my code implementation? Thank you.
This sounds like a not-alowed skin request. I think what did you ask is possible, but we won't create the skin for you. So for first, post please the code you have so far and we'll help you to add the further effects and features you want / need.
User avatar
Yincognito
Rainmeter Sage
Posts: 7178
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Skin-Help - image pan animation

Post by Yincognito »

cpt.failcraft wrote: December 26th, 2023, 11:59 pm I'm seeking assistance with a desktop skin project where, upon hovering the mouse over medium-sized image, I want 4 - 12 randomly chosen background images from a specified file path to randomly fade in, pan across the desktop, and then fade out and then repeat the process. Additionally, the images should have a 30% opacity and a fade effect on their outer edges. I've implemented code to limit the number of images on screen, but I'm facing issues as the mouse hover detection is not retrieving the images, despite the indicator showing that the mouse is hovering. Can you suggest a suitable skin as a foundation for my code implementation? Thank you.
Just curious - is this also about (another form of) your desktop icons docker project, or about something else entirely? In either case, if you don't have a suitable skin to start from, why don't you start small, one step at a time, instead of aiming for more than you can chew at once? For example, step one: have 13 image meters in your code and 1 of them toggling the hidden state of the other 12 on hover. Can you write a code for that?
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
cpt.failcraft
Posts: 8
Joined: December 11th, 2023, 7:54 pm

Re: Skin-Help - image pan animation

Post by cpt.failcraft »

No this is not related to any of my previous skins

This skin scripts is based off of different skins code and Rainmeter forums. *but don't worry I didn't copy and paste any I scripted this myself.*
Below is all that I've scripted so far, along with the error logs
(btw the enlargement function is just so I know the hover over action is functioning)

Main.ini

Code: Select all

[Variables]
PathToTestImages="C:\Users\#####\OneDrive\Documents\Rainmeter\Skins\skintest\@Resources\Images\Testimages"

[Include]
@Include=#@#sripts\FetchImages.lua
@Include=ImageAnimation.inc

[IconMeter]
Meter=Image
ImageName=#@#Images\TestImage.png
ImageH=250
ImageAlpha=0
MouseOverAction=[!RainmeterShowMeter TextMeter][!RainmeterShowMeter EnlargedIconMeter][!RainmeterHideMeter NormalIconMeter][!CommandMeasure "ImageAnimationMeterHover" "Run"]
MouseLeaveAction=[!RainmeterHideMeter TextMeter][!RainmeterHideMeter EnlargedIconMeter][!RainmeterShowMeter NormalIconMeter][!CommandMeasure "ImageAnimationMeterHover" "Stop"]

[Rainmeter]
Update=1000

[Metadata]
Name=
Author= 
Description=
License=
Version=

[TextMeter]
Meter=String
StringAlign=Right
FontFace=Ink Draft
FontColor=255,255,255,255
FontSize=35
X=220
Y=250
Text=Test
AntiAlias=1
Hidden=1

[IconBackgroundMeter]
Meter=Image
X=0
Y=0
W=60
H=60
SolidColor=255,255,255,1

[NormalIconMeter]
Meter=Image
ImageName=#@#Images\TestImage.png
X=5
Y=5
H=240

[EnlargedIconMeter]
Meter=Image
ImageName=#@#Images\TestImage.png
X=0
Y=0
H=250
Hidden=1


[LuaScript]
Measure=Script
ScriptFile=FetchImages.lua
UpdateDivider=600  

[ImageAnimation]

ImageAlpha=255 
ImageAnimation.inc

Code: Select all

[Variables]
PathToTestImages="C:\Users\#######\OneDrive\Documents\Rainmeter\Skins\skintest\@Resources\Images\Testimages"

[Include]
@Include=#@#sripts\FetchImages.lua
@Include=ImageAnimation.inc

[IconMeter]
Meter=Image
ImageName=#@#Images\TestImage.png
ImageH=250
ImageAlpha=0
MouseOverAction=[!RainmeterShowMeter TextMeter][!RainmeterShowMeter EnlargedIconMeter][!RainmeterHideMeter NormalIconMeter][!CommandMeasure "ImageAnimationMeterHover" "Run"]
MouseLeaveAction=[!RainmeterHideMeter TextMeter][!RainmeterHideMeter EnlargedIconMeter][!RainmeterShowMeter NormalIconMeter][!CommandMeasure "ImageAnimationMeterHover" "Stop"]

[Rainmeter]
Update=1000

[Metadata]
Name=
Author= 
Description=
License=
Version=

[TextMeter]
Meter=String
StringAlign=Right
FontFace=Ink Draft
FontColor=255,255,255,255
FontSize=35
X=220
Y=250
Text=Test
AntiAlias=1
Hidden=1

[IconBackgroundMeter]
Meter=Image
X=0
Y=0
W=60
H=60
SolidColor=255,255,255,1

[NormalIconMeter]
Meter=Image
ImageName=#@#Images\TestImage.png
X=5
Y=5
H=240

[EnlargedIconMeter]
Meter=Image
ImageName=#@#Images\TestImage.png
X=0
Y=0
H=250
Hidden=1


[LuaScript]
Measure=Script
ScriptFile=FetchImages.lua
UpdateDivider=600  

[ImageAnimation]

ImageAlpha=255 

FetchImages.lua

Code: Select all

-- FetchImages.lua

function Initialize()
    local imagePath = "C:\\Users\\#####\\OneDrive\\Documents\\Rainmeter\\Skins\\skintest\\@Resources\\Images\\TestImages\\"
    local numImages = math.random(4, 8)

    local images = {}
    for i = 1, numImages do
        table.insert(images, imagePath .. "Image" .. i .. ".png")
    end

    SKIN:Bang('!SetOption', 'ImageAnimationMeterFade', 'ImageList', table.concat(images, '|'))
    SKIN:Bang('!UpdateMeter', 'ImageAnimationMeterHover')
    SKIN:Bang('!CommandMeasure', 'ImageAnimationMeterHover', 'Run')
end


Error Logs

Code: Select all

!CommandMeasure: [ImageAnimationMeterHover] not found (skintest\Main.ini)
Last edited by balala on December 27th, 2023, 7:52 pm, edited 1 time in total.
User avatar
Yincognito
Rainmeter Sage
Posts: 7178
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Skin-Help - image pan animation

Post by Yincognito »

cpt.failcraft wrote: December 27th, 2023, 6:32 pm No this is not related to any of my previous skins

This skin scripts is based off of different skins code and Rainmeter forums. *but don't worry I didn't copy and paste any I scripted this myself.*
Below is all that I've scripted so far, along with the error logs
(btw the enlargement function is just so I know the hover over action is functioning)

[...]

Error Logs
!CommandMeasure: [ImageAnimationMeterHover] not found (skintest\Main.ini)
Nah, you can't just take some code, put it together, and expect it to work. It has to be precise. You don't have a measure named ImageAnimationMeterHover (name says it's a meter, you use it both as a measure and a meter in the .lua file, which doesn't make much sense) in your codes (by the way, Main.ini is the same as ImageAnimation.inc, which again is kind of pointless), and this is why you get the said error. Not even the .lua code is doing something useful here, though it does have some potential. In short, besides showing the TestImage.png (and having it hidden afterwards), these codes don't do anything that may serve your objective.

By the way, you don't absolutely need Lua for the random stuff, a Calc measure can do it too:
https://docs.rainmeter.net/manual/measures/calc/

So, I reiterate, how about quickly writing a simple skin with 1 image meter which on hover shows another 12 image meters, so we can have something to start with and progress from there? ;-)
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
balala
Rainmeter Sage
Posts: 16179
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Skin-Help - image pan animation

Post by balala »

cpt.failcraft wrote: December 27th, 2023, 6:32 pm This skin scripts is based off of different skins code and Rainmeter forums.
In addition to what Yincognito wrote, note that:
  • !Rainmeter... as bang prefix has been deprecated long time ago. You shouldn't use it anymore.
  • I recommend not to add the whole path when you want to use any file from the @Resources folder. The PathToTestImages variable is this way used (in the [Variables] section): PathToTestImages="C:\Users\#######\OneDrive\Documents\Rainmeter\Skins\skintest\@Resources\Images\Testimages". This should be used as PathToTestImages=#@#Images\Testimages. Rainmeter always knows where to get this file from. If you're writing the whole path, your skin can't be used on other computers then yours.
  • I also removed the quotes from the above variable. Quotes are never required in options (however you can use them, they don't give errors in log).
  • Not sure what the [ImageAnimation] section is used for in your code. Unless I'm missing something, this section makes no sense. It has only an ImageAlpha=255 option.This section could be used as a meter style, but you didn't use it this way, so I'm not sure what is it meant for.
  • Including a .lua script file into your code with an @Include... option doesn't really make sense either. You can use such a file into the ScriptFile option of a Script measure, but adding it to a [Include] section, doesn't make sense.
  • A code can't have more same-named sections. You've used for instance two [Metadata] and two [Rainmeter] sections, but in such cases Rainmeter simply ignores the second occurrence of the same-named section (same applies for variables, options on a single section and so on).
  • The [Metadata] and [Rainmeter] sections don't really make sense on a .inc file. The elements of these section are taken from the .ini file, which includes the .inc file.
  • In the code of a .lua script file the folder separator character is //, not \\. This is why the local imagePath = "C:\\Users\\#####\\OneDrive\\Documents\\Rainmeter\\Skins\\skintest\\@Resources\\Images\\TestImages\\" line of the Initialize() function of your FetchImages.lua file should look this way: local imagePath = "C://Users//#####//OneDrive//Documents//Rainmeter//Skins//skintest//@Resources//Images//TestImages//".
User avatar
Yincognito
Rainmeter Sage
Posts: 7178
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Skin-Help - image pan animation

Post by Yincognito »

balala wrote: December 27th, 2023, 8:27 pm In addition to what Yincognito wrote [...]
There is a problem with your edit of the OP's post. The code of Main.ini incorrectly has both Main.ini AND ImageAnimation.inc codes, i.e. 2 different files (even if their code is the same!) - not that it would matter much anyway. Look after the first [ImageAnimation] section and you'll understand what I mean. :???:
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
balala
Rainmeter Sage
Posts: 16179
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Skin-Help - image pan animation

Post by balala »

Yincognito wrote: December 27th, 2023, 8:56 pm There is a problem with your edit of the OP's post.
Yep, indeed. You are right. Once again. Sorry for my mistake. Just fixed it...
User avatar
Yincognito
Rainmeter Sage
Posts: 7178
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Skin-Help - image pan animation

Post by Yincognito »

balala wrote: December 27th, 2023, 9:05 pm Yep, indeed. You are right. Once again. Sorry for my mistake. Just fixed it...
:thumbup:
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth