XWidgetSoft Forum

XWidget & XLaunchpad , Desktop customization
It is currently May 10th, 2025, 6:29 am

All times are UTC - 8 hours




Post new topic Reply to topic  [ 11 posts ] 
Author Message
 Post subject: The Script is ok?
PostPosted: November 8th, 2014, 3:05 pm 
Offline
User avatar

Joined: December 5th, 2012, 5:52 pm
Posts: 4887
I would like to create an animation weather widget like this one:
viewtopic.php?f=11&t=4931&hilit=minions
but this time with only weather icons (I have a number of png for each weather condition, so they will be animpng again).

There will be two differences with the "Despicable Me Weather HD ANIMATED" widget:
1) I will use this tag for current weather "${curWeatherIcon}" so they will be 18 animpngs
2)The animations will have "0" loop count so they will play continuously.

This is the script by @hamid from the minions weather widget:
----------------------------------

var WeatherNames=[sun,cloudy,fog,rain,lightning,snow,moon,moon_cloudy]


function accweathercore1OnUpdate(Sender)
{
var weathertmp=eval(accweathercore1.get("${curSimpleWeatherIcon}"))
if(weathertmp.Visible==false)
{
for(var i in WeatherNames)
{
WeatherNames[i].Visible=0
WeatherNames[i].Src=""
}
var listtmp=""
var imgtmp=GetFileList(WidgetPath+"\\"+weathertmp.Name,"png",0).split("|")
for(var j=1;j<imgtmp.length;j++)
{
listtmp+=weathertmp.Name+"\\"+j+".png"+"|"
}
listtmp+=weathertmp.Name+"\\"+imgtmp.length+".png"
weathertmp.Src=listtmp
weathertmp.OnClick="StartAnimating"
weathertmp.Visible=1
StartAnimating(weathertmp)
}
}
---------------------------------
My question is:
I will need to change only the two parts of the script with the red color..? Or I need to change anything else...

_________________
...and remember: don't take life too seriously...
My profile on Deviantart: http://jimking.deviantart.com/


Top
 Profile  
 
 Post subject: Re: The Script is ok?
PostPosted: November 11th, 2014, 6:36 am 
Offline

Joined: October 26th, 2013, 8:17 am
Posts: 362
i have modified the code to be used with only one pnganimate object,
so you will only need 1 pnganimate Object that named "WeatherObj" in your widget,

i didn't tested it for errors,
so you should test it in debug mode to make sure it works correct,

and don't forget to add the StartAnimating() function code to the code


Code:
//Script Author: Hamid

var oldweather;

function accweathercore1OnUpdate(Sender)
{
var weathertmp=accweathercore1.get("${curWeatherIcon}")
if(weathertmp!=oldweather)
{
oldweather=weathertmp
WeatherObj.Src=""
var listtmp=""
var imgtmp=GetFileList(WidgetPath+"\\"+weathertmp,"png",0).split("|")
for(var j=1;j<imgtmp.length;j++)
{
listtmp+=weathertmp+"\\"+j+".png"+"|"
}
listtmp+=weathertmp+"\\"+imgtmp.length+".png"
weathertmp.Src=listtmp
StartAnimating(WeatherObj)
}
}


Top
 Profile  
 
 Post subject: Re: The Script is ok?
PostPosted: November 11th, 2014, 6:53 am 
Offline
User avatar

Joined: December 5th, 2012, 5:52 pm
Posts: 4887
Ok I will test it as soon as possible.. Thanks mate! :)

_________________
...and remember: don't take life too seriously...
My profile on Deviantart: http://jimking.deviantart.com/


Top
 Profile  
 
 Post subject: Re: The Script is ok?
PostPosted: November 11th, 2014, 5:48 pm 
Offline
User avatar

Joined: December 5th, 2012, 5:52 pm
Posts: 4887
Code:
//Script Author: Hamid

var oldweather;

function accweathercore1OnUpdate(Sender)
{
var weathertmp=accweathercore1.get("${curWeatherIcon}")
if(weathertmp!=oldweather)
{
oldweather=weathertmp
WeatherObj.Src=""
var listtmp=""
var imgtmp=GetFileList(WidgetPath+"\\"+weathertmp,"png",0).split("|")
for(var j=1;j<imgtmp.length;j++)
{
listtmp+=weathertmp+"\\"+j+".png"+"|"
}
listtmp+=weathertmp+"\\"+imgtmp.length+".png"
weathertmp.Src=listtmp
StartAnimating(WeatherObj)
}
}

function StartAnimating(Sender)
{
   Sender.Play=0
   Sender.FrameIndex=0
   Sender.Play=0
}


Hamid this is the full script when run on debug nothing appears.. :?
I remind you that I have 18 folders for each wth condition, this time all the images have the same dimentions and each png it will play continuously (loop "0").
Here is the widget:
http://www73.zippyshare.com/v/68107773/file.html

_________________
...and remember: don't take life too seriously...
My profile on Deviantart: http://jimking.deviantart.com/


Top
 Profile  
 
 Post subject: Re: The Script is ok?
PostPosted: November 11th, 2014, 7:54 pm 
Offline

Joined: October 26th, 2013, 8:17 am
Posts: 362
i did 1 mistake and you did 2 :D

mine was:
i forget to change the source to "WeatherObj"

yours was:
1. you have changed directory structure without telling me, they're in "Images" directory now, while they're not there in previous widget
2. you have used "Sender.Play=0" at the end :? , as i know, it wasn't this way in original code, where did you get that?


==============

here's the working version:
Attachment:
animated_weather_hd [test2] [2014.11.12]0656.xwp [1.43 KiB]
Downloaded 306 times

Note:
as ever i have removed images from it for easier uploading, don't forget to add them again


==============
Quote:
Important:
the folder names are different from the weather names in my reference,
i don't know which one is correct,
so don't forget to check them:
Code:
cloudy > clouds
lightning > lightening

Edit:
i have tested it and found my reference was wrong,
so no need to change anything


Top
 Profile  
 
 Post subject: Re: The Script is ok?
PostPosted: November 11th, 2014, 8:12 pm 
Offline
User avatar

Joined: December 5th, 2012, 5:52 pm
Posts: 4887
Ok... because I took the weather names from here:
viewtopic.php?f=10&t=4837
I'll reply as soon as possible hamid..

Edit:
All seem to work properly now. 8-)
Thanks man!

_________________
...and remember: don't take life too seriously...
My profile on Deviantart: http://jimking.deviantart.com/


Top
 Profile  
 
 Post subject: Re: The Script is ok?
PostPosted: November 14th, 2014, 8:03 am 
Offline
User avatar

Joined: December 5th, 2012, 5:52 pm
Posts: 4887
I added city name and temp and edited the animpng properties with "inverse on finish" to give the effect of a
continuous movement. ;)

_________________
...and remember: don't take life too seriously...
My profile on Deviantart: http://jimking.deviantart.com/


Top
 Profile  
 
 Post subject: Re: The Script is ok?
PostPosted: November 15th, 2014, 5:34 am 
Offline

Joined: October 26th, 2013, 8:17 am
Posts: 362
i don't think the "inverse on finish" effect will be good for it,
even i'm not sure if the infinite loop would be so good,
but i think adding infinite loop as RightClick option will be fine


Top
 Profile  
 
 Post subject: Re: The Script is ok?
PostPosted: November 15th, 2014, 5:55 am 
Offline
User avatar

Joined: December 5th, 2012, 5:52 pm
Posts: 4887
hamid wrote:
i don't think the "inverse on finish" effect will be good for it,
even i'm not sure if the infinite loop would be so good,
but i think adding infinite loop as RightClick option will be fine

If you still have the widget/files that I sent you edit the pnganim properties with Interval(MS) = 70, Loop Count = 0, Inverse onfinish = activated, and check it.
I like it because gives the effect of the continuous movement like the real sky. The weird indeed is when we have rain, lightning or snow
that the rain will go inverse! So yes the "inverse on finish" maybe is not a good idea, but the "infinite loop" yes and I will keep it like this.
Now if you can add a right click to select the loop from 0<->1 is an extra option so why not..

_________________
...and remember: don't take life too seriously...
My profile on Deviantart: http://jimking.deviantart.com/


Top
 Profile  
 
 Post subject: Re: The Script is ok?
PostPosted: November 17th, 2014, 9:41 pm 
Offline

Joined: October 26th, 2013, 8:17 am
Posts: 362
ok, it's ready:
Attachment:
animated_weather_hd [test3] [2014.11.18]0901.xwp [1.63 KiB]
Downloaded 332 times

===========
Changes:
Added: RightClickMenu for Enable/Disable Animation Loop
==============


Top
 Profile  
 
 Post subject: Re: The Script is ok?
PostPosted: November 18th, 2014, 3:00 am 
Offline
User avatar

Joined: December 5th, 2012, 5:52 pm
Posts: 4887
Thanks man! :)
The widget is ready now:
* Unchecked the "inverse onfinish"
* Added city/temp info

viewtopic.php?f=11&t=5260&p=10634#p10634

_________________
...and remember: don't take life too seriously...
My profile on Deviantart: http://jimking.deviantart.com/


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 11 posts ] 

All times are UTC - 8 hours


Who is online

Users browsing this forum: No registered users and 19 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

Powered by phpBB® Forum Software © phpBB Group