Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Adding animation to Button(Possible to add animation without bit performance hit?)
icon5.gif  Adding animation to Button [message #540325] Tue, 15 June 2010 16:03 Go to next message
John is currently offline JohnFriend
Messages: 3
Registered: June 2010
Junior Member
I am exploring the idea of adding animation to a button when the mouse goes over it, or when it is clicked on.

The approach I have is to use Display.timeExec() to call redraw on the targeted button, then use a custom redraw code in a PaintListener to apply the animation.

However, the constant redraw() call appears to be expensive - Just calling redraw() repeatedly without any repaint logic will use up 10-20% of my system (3GHz core2 duo).

Is there any reasonable way to implement animation without incurring an big performance hit?
Re: Adding animation to Button [message #540415 is a reply to message #540325] Wed, 16 June 2010 05:42 Go to previous message
Vijay RajFriend
Messages: 608
Registered: July 2009
Senior Member
Instead of drawing on the control draw on an image and update that image on the control...

try this snippet

http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.swt.sni ppets/src/org/eclipse/swt/snippets/Snippet141.java?view=co

u can strip out all the unnecessary code and add what u require to make the code simpler....


---------------------
why, mr. Anderson, why, why do you persist?
Because I Choose To.
Regards,
Vijay
Previous Topic:How to prevent resize event to pass to a child
Next Topic:creating image from text
Goto Forum:
  


Current Time: Fri Apr 26 17:08:49 GMT 2024

Powered by FUDForum. Page generated in 0.03438 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top