-
Sep 23rd, 2013, 10:06 AM
#1
Animated Spinner Class [vbRichClient5]
After contributing to the following thread (http://www.vbforums.com/showthread.p...Wheel-Spinning), I thought others might be interested in an animated spinner, so I packaged my code into a class and added a simple demo form that allows you to play around with the parameters in real-time.
Demo Screenshot:
Samples:
Source code:
AnimatedSpinner.zip
Features:
Antialiased
Clockwise/Counter-Clockwise animation
Adjustable Speed of spin in, normal spin, and spin out frames
Number of segments to draw
Size of the spinner
Padding between the edge of the spinner box and the spinner
Base Color of the spinner
Background color of the spinner (including transparent background)
Size of the hole in the middle of the spinner
Total Degrees that the spinner should span
Degrees of margin between segments
Gaussian Blur, optionally clipping blurred edges
Optionally fade segments
Optional animated fade on spin in/out
Optional animated zoom on spin in/out
NOTES
This demo requires the vbRichClient5 framework to be registered on your development system.
This code is free to use for any purpose. No warranties! This code has not been extensively tested, nor is it currently used in any production environment. It is also my first attempt at using the vbRC5 Cairo graphics methods, so there may well be bugs/inefficiencies.
Enjoy!
Last edited by Shaggy Hiker; Jan 12th, 2019 at 06:11 PM.
Reason: Bug Fixes, More Features, New Screenshots
-
Sep 23rd, 2013, 11:59 AM
#2
Re: [vbRichClient5] Animated Spinner Class
Updated with some bug fixes and new features
-
Sep 23rd, 2013, 08:28 PM
#3
Re: [vbRichClient5] Animated Spinner Class
Updated again with new Gaussian Blur feature, minor bug fixes, and a new drawing approach to get transparency working properly. Latest code in first post.
-
Sep 23rd, 2013, 09:00 PM
#4
Re: [vbRichClient5] Animated Spinner Class
One last update tonight - added a SegmentMargin property so you can control the distance between segments.
-
Sep 23rd, 2013, 09:16 PM
#5
Addicted Member
Re: [vbRichClient5] Animated Spinner Class
Very nice. Thanks for the sample project. This will be usefull
-
Sep 24th, 2013, 05:18 AM
#6
Re: [vbRichClient5] Animated Spinner Class
@Zelot - Thanks a lot, glad you've found it useful!
-
Sep 24th, 2013, 05:19 AM
#7
Re: [vbRichClient5] Animated Spinner Class
Just added the ability to clip the outside and inside edges of the spinner. This can produce "tighter" effects when combined with the gaussian blur option. Latest source code in first post.
-
Sep 24th, 2013, 09:50 AM
#8
Re: Animated Spinner Class [vbRichClient5]
Added the following options:
Fade During Spin-In/Spin-Out
Zoom During Spin-In/Spin-Out
Enable/Disable Segment Fading
-
Sep 24th, 2013, 11:38 AM
#9
Re: Animated Spinner Class [vbRichClient5]
Sorry for all of the updates everyone - fixed a bug that was causing the spinner degree span to fall short slightly for each segment drawn...for example, at 32 segments and 360 degree desired span, the drawing would fall short a few degrees. Latest source in first post.
-
Sep 24th, 2013, 12:42 PM
#10
Re: Animated Spinner Class [vbRichClient5]
Yet another update!
Added a "Copy to Clipboard" button that will build VB6 source code based on the settings you have defined in the demo app, then copy the code to the clipboard for use in your own programs.
Also fixed a size calculation error for the Hole % when gaussian blur >0 and the clip blurred edges option is selected.
Latest source in first post.
-
Oct 23rd, 2013, 09:47 PM
#11
New Member
Re: Animated Spinner Class [vbRichClient5]
This is excellent!
Have you considered to make it a Widget (something like cwSpinner) to be used like the other vbWidgets? Also this could be included in the vbWidgets project in GitHub if you are ok with that...
I don't know what use you give to this beautiful animation, I was thinking in something like the Firefox's "page loading" spinning circle, for signaling that my application is working... Is that the main purpose of this animation or is something else?
-
Oct 23rd, 2013, 10:14 PM
#12
Re: Animated Spinner Class [vbRichClient5]
@Kbre
Thanks for the kind words! I appreciate the response, since sometimes it feels like I'm passing these demos off into the air.
The main inspiration was a combination of this thread, and (as you mentioned) things like the Firefox "page loading" animation, and other spinners that have become especially common on webpages such as YouTube, etc.... The next inspiration was to get more familiar with the vbRC5 Cairo classes, so it seemed like a nice fit.
I'll be honest though, it was mostly a learning experience for me - I don't use this code in any of my projects right now, and I don't know how it performs in the cases where it would be most useful (e.g. where a task completion time is undeterminable, yet you want to inform the user that work is being done).
That said, I can see use cases where either:
A) It is running in a class using the threading features of RC5 - the animation might be smoother, but it would likely be eating more processor time (making the overall task time longer), and possibly even continuing to animate when the parent has locked-up in an infinite loop, therefor being deceptively and infinitely responsive).
B) It is being used in tasks that are easily separable into steps, so you could perform one step in every firing of a certain interval (the class could fire an event every X milliseconds, and during that time the parent could perform some processing, then relinquish control back to the animation). This would likely result in "choppier" animation, but the task would likely finish sooner. However, with fine tuning of the steps, it might be indistinguishable from the threaded version, without the chance for deadlock misrepresentation (e.g. when the animation stops, the user will know that there is a problem).
I suppose it would be up to the programmer to decide what scenario was preferable, and how much time they want to spend tuning either approach.
Regarding inclusion in vbRC5, I've actually directly offered the class to Olaf for inclusion in vbWidgets, so when he gets back in the mood for it, I hope it might be included.
-
Aug 4th, 2014, 06:49 PM
#13
Member
Re: Animated Spinner Class [vbRichClient5]
This is great and I would like to use it but I am not sure how to actually get it going in a VB6 program.
I am writing some data from memory to an excel spreadsheet then saving the worksheet.
I would like to start the spinner before I start the write process and stop the spinner when the file has been saved.
Could you tell me how to do this please? Thanks
-
Aug 4th, 2014, 09:16 PM
#14
Re: Animated Spinner Class [vbRichClient5]
Here's an example that creates an Excel spreadsheet while the timer is spinning, then stops the spinner when the population of the spreadsheet is done and shows the Excel window:
AnimatedSpinnerExcel.zip
-
Aug 5th, 2014, 02:37 AM
#15
Member
Re: Animated Spinner Class [vbRichClient5]
That's great, thanks a heap jpbro
-
Aug 5th, 2014, 07:37 AM
#16
Re: Animated Spinner Class [vbRichClient5]
-
Feb 5th, 2018, 09:57 PM
#17
Re: Animated Spinner Class [vbRichClient5]
Great, perhaps we can use Cairo to develop a control similar to Fusioncharts in the future. Thanks very much, jpbro.
-
May 15th, 2019, 09:25 AM
#18
New Member
Re: Animated Spinner Class [vbRichClient5]
it is for vb ? im learnin vb 2012, how to use it?
-
May 15th, 2019, 10:03 AM
#19
Re: Animated Spinner Class [vbRichClient5]
No, it is for VB6. The two languages are almost completely different, despite similar names and syntax. VB2012 is VB.NET, so nothing in Classic VB, or VB6 can be considered compatible. However, you may have also managed to choose the single ugliest version of VS ever made. 2010 was the most beautiful, while anything after 2012 was an improvement over 2012.
My usual boring signature: Nothing
-
Apr 29th, 2023, 05:16 PM
#20
Hyperactive Member
Re: Animated Spinner Class [vbRichClient5]
OMG, this is so good, how could I miss this masterpiece? Thank oyu!
-
Apr 30th, 2023, 12:41 PM
#21
Re: Animated Spinner Class [vbRichClient5]
Originally Posted by tmighty2
OMG, this is so good, how could I miss this masterpiece? Thank oyu!
Thank you! And happy to hear that you found it useful - it's always nice to learn that something you put out there is being used by others
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|