Merry DXmas!
Holiday-themed tutorials
Friday, December 19, 2008 by sViz | Discussion: DesktopX Tutorials
![]()
It's the holidays and I feel like sharing. Below are four quick, do-it-yourself tutorials based on my all-time favorite Christmas DesktopX widgets. Enjoy!
Is It Christmas Yet?
I absolutely love RomanDA's Christmas Countdown Snowglobe widget. It's practical, compact, and the graphics are stellar. Did I mention it has animated snow?
You might be wondering, "How can I make a countdown widget to New Year's" or "How can I make a countdown widget to Uncle Bob's birthday--no screw Uncle Bob (he gives lousy gifts)--how 'bout a countdown to the Superbowl?!"
Well, I'm pleased to say, it's not hard at all.
Concept
The concept is pretty straightforward. You need to mark what day it is, mark what day you're counting down to, and calculate how much time remains between the two dates.
Dday - Today = time remaining. It's simple and there's actually a vbscript function that does this. It's called DATEDIFF (google it.)
Execution
Keeping it simple, we'll create a display text, which will show us the days remaining (or hours, minutes, and seconds if that's what floats your boat.)
Insert this script into your text object:
Dim Ddaytxt, Dday
Sub Object_OnScriptEnter
Dday = "1/1/2009"
Ddaytxt = "New Year's Day"
Object.settimer 1, 1000 ' -one-second timer
End Sub
Sub Object_OnTimer1
Sremain = DateDiff("s", Now(), Dday) '—seconds
Minremain = DateDiff("n", Now(), Dday) '--minutes
Hremain = DateDiff("h", Now(), Dday) '--hours
Dremain = DateDiff("d", Now(), Dday) '--days
Mremain = DateDiff("m", Now(), Dday) '--months
Yremain = DateDiff("y", Now(), Dday) '--years
Newmsg = Dremain & " day(s) until " & Ddaytxt
If Newmsg <> object.text Then Object.text = Newmsg
End Sub
To display hours, seconds, or minutes instead, you'd simply change the 'Newmsg' variable like so: Newmsg = Hremain & " hours until " & Ddaytxt
Now this is a pretty static example of how to do a countdown where the dates and display text are hardcoded into the widget, but you get the basic idea. Optimally, you'd have the option to change the date and display format on demand--and, ideally, have it stop counting after Dday has passed. But hey, that's why we have RomanDA's Holiday Countdown and Holiday Countdown Pro widgets!
Twinkle, Twinkle!
Island Dog has made some incredible Christmas light widgets (check out his gallery), but Icicle Christmas Lights is my absolute fave. They just look so realistic.
Mesmerized by those blinking lights? You can make them, too. Here we'll see just how to make animated twinkling.
Execution
We need to create and animated PNG. Oh, look! HERE is a tutorial by yours truly that shows you how. Now, for these lights we need to make the colors alternate in each frame. Then, we'll just loop it and watch them twinkle.
Here are the three images I combined to make the animated PNG:
1)
2)
3) ![]()
And here's the combined image:
![]()
There's no scripting necessary; it's all done in the appearance tab. See the image below for the settings.
![]()
Clone 'em, line 'em up, group 'em, and you'll have a whole string. (Now they may not be in sync until you restart DXBuilder, but once you've done that they should alternate in order.)
Jingle Bells!
I actually have three favorite Christmas weather widgets--including Christmas Time Weather by Martin and Christmas Snow Globe Weather by RomanDA-- but if I had to pick one, it would be White Christmas by Richard Mohler. I like it because it's uniquely low-key and I can use it all year round.
I don't know about you but I just see the words "white christmas" and I hear Bing Crosby's crooning. Now, wouldn't it be swell if you could have your favorite jingles and carols play on demand in a tiny widget in the corner of your screen? You can, goshdarnit, and you don't have to load up a media player either.
This one's really a 'did you know' but I thought I'd put it out there anyways.
Concept
Have a seasonal icon in the corner of your screen like, say, this:
![]()
Or this:
![]()
And when you mouse over the object, it begins to play a jingle.
Execution
Create the mouse away and mouse over states. Find the jingle you want. Go to the mouse over state and in the sounds tab load up your song. See image below.
![]()
It plays the entire song, once, as long as your mouse remains over the object, and it stops when you move away. 'Async sound loop' repeats the song as long as your mouse is over the object.
Let it snow! Let it snow! Let it snow!
There's just one word to describe Realistic Snowflakes by GreenReaper: awesome! Watch as the snowflakes drift and float, sway and fall, heavily, lightly, fast, slow--just beautiful!
No, I can't show you how to do the cool effects GreenReaper did with his widget, but I can show you how to make objects fall randomly down your screen. I originally made this script for a birthday surprise widget (where balloons fell down the unsuspecting user's screen), but it works just as well for snowflakes.
Concept
Pick a random spot across the top of your screen, put an object there, then let it move all the way down your screen. Reduce, reuse, and recycle.
Execution
Create and object and name it "snow1" Go to Properties > Summary and set the group name to "snow". Set height and width to 10 x 10 (a good size for a snowflake.)
**SCRIPT UPDATE 12/23/08**
Create another object (you should now have a total of two objects now) and put this script in it:
Dim trigger, objcount
Dim snocount, snowidth, snolimit, snostop, snostart, snodir, snospeed
snocount= 1
objcount= Desktopx.GroupObjects("snow").count
snowidth = system.VScreenWidth - DesktopX.Object("snow1").width
'***Adjust these variables to your preferences***
snolimit = 20 '--How many objects you want
snospeed = 2 '--How fast to go
trigger = 50 '--How far apart are the objects
snodir = "up" '--Which direction (up or down)
'*************************************************
Function Dropsnow '---Move snowflake objects downscreen, duplicate, reset positions--- '---Duplicate snowflake object, and set its starting position---- '---Delete snowflake objects on startup----
'Called when the script is executed
Sub Object_OnScriptEnter
object.KillTimer 1
If snodir = "down" Then
snostart = 0 - DesktopX.object("snow1").height
snostop = system.screenheight
Else
snostart = system.screenheight
snostop = 0 - DesktopX.object("snow1").height
trigger = system.screenheight - trigger
End If
DesktopX.object("snow1").top = snostart
Clearsnow
Dropsnow
End Sub
Object.SetTimer 1, 20
End Function
Sub Object_OnTimer1
objcount= Desktopx.GroupObjects("snow").count
For Each elem In Desktopx.GroupObjects("snow")
If elem.top = trigger Then
If objcount < snolimit Then Duplicate '--if not at limit of total snowflakes, duplicate
End If
Select Case snodir
Case "down"
If elem.top => snostop Then
elem.top= snostart
Randomize Timer '--get random coordinates
snowx = Int(Rnd * snowidth) + 1 '--get random coordinates
elem.left = snowx
Else
elem.top = elem.top + snospeed
End If
Case "up"
If elem.top <= snostop Then
elem.top= snostart
Randomize Timer '--get random coordinates
snowx = Int(Rnd * snowidth) + 1 '--get random coordinates
elem.left = snowx
Else
elem.top = elem.top - snospeed
End If
End Select
Next
End Sub
Function Duplicate
Randomize Timer
snowx = Int(Rnd * snowidth) + 1
snocount = snocount + 1
snoname= "snow" & snocount
Desktopx.Object("snow1").clone snoname, snowx, snostart
End Function
Function Clearsnow
For x = 2 To objcount
Desktopx.Object("snow" & x).delete
Next
End Function
**Notice the portion of the script between the star lines. You can change these variables to adjust the settings of the falling objects, such as speed, spacing, direction, and amount.
There you go. It's a pretty rudimentary script but hopefully you get the basic idea behind it.
Well, that's it! Thanks for reading. Happy Holidays (and happy birthday to me!)
Reply #22 Tuesday, December 23, 2008 9:37 PM
New script is up. You can now easily change the amount of objects, speed, spacing, and direction.
Reply #23 Tuesday, December 23, 2008 9:44 PM
Awesome sViz, you totally rock! ![]()
Dang, no matter what I do, it still falls down sViz ![]()
Reply #24 Tuesday, December 23, 2008 10:39 PM
You mean the objects are going down instead of up? Make sure the variable 'snodir' is set to "up" instead of "down"
Reply #25 Tuesday, December 23, 2008 10:46 PM
Yep sViz, I changed all instances of snodir to up, but no go hehe
Reply #26 Tuesday, December 23, 2008 11:24 PM
Hmm. If you copy and paste the exact code above, you only need to change the first instance, the one in between the star lines (should be on line 12 or thereabouts.) No other instances need to be altered.
Reply #27 Wednesday, December 24, 2008 12:26 AM
Ohhh hehe, okidoki sViz, I'll give that a shot, and thanks for all your help, you rock ![]()
Reply #28 Wednesday, December 24, 2008 2:07 AM
sViz!!! I HAVE TANK BUBBLES going UP, W00T ![]()
Now, to just make it so they are on one side, thanks again buddy ![]()
Reply #29 Sunday, December 28, 2008 9:30 PM
Awesome work.
If anyone cares there is a SERIES of tutorials on making a countdown widget from begining to end, including scripts.
https://forums.wincustomize.com/328522
Enjoy, Merry Everything, and happy stuff too.
Please login to comment and/or vote for this skin.
Welcome Guest! Please take the time to register with us.
There are many great features available to you once you register, including:
- Richer content, access to many features that are disabled for guests like commenting on the forums and downloading skins.
- Access to a great community, with a massive database of many, many areas of interest.
- Access to contests & subscription offers like exclusive emails.
- It's simple, and FREE!











Reply #21 Monday, December 22, 2008 9:32 PM
Thanks sViz, I have to keep reloading the script because it stops working if i try and edit anything
I changed everything that said Top, to Bottom, but I guess that's not what I'm meant to edit hehe
I have NO idea what I'm doing LOL
Trial and error, mainly error in my case hehe
Edit:I just did a test export, whoa, my cpu is being eaten , I need less bubbles, and set to one part of the screen , like left or right, like fishtank pump bubbles, going upwards