-
30 May 2012 3:44 PM #1
Answered: What's the best way to swap two panels with a fade?
Answered: What's the best way to swap two panels with a fade?
Hello there.
I'm wondering what is the best way to swap out two panels on the screen with a fade effect?
I have two panels which I have positioned over top of each other using CSS. panelOne is visible, panelTwo is hidden.
On click of another button (not on either panel), I want panelOne to fade out and panelTwo to fade in.
I currently have this working using the code below, but I find it's quite laggy on some Android devices we have here for testing. Is there a better way to do it than what I'm currently using? How can I improve this animation?
This code is executed on button tap:
Any help is much appreciated.Code:Ext.Anim.run(panelOne, 'fade', { duration: 100, after: function() { panelOne.hide(); } }); Ext.Anim.run(panelTwo, 'fade', { out: false, duration: 100, before: function() { panelTwo.show(); } });
Thanks.
-
Best Answer Posted by mitchellsimoens
If the container that is going to hold these panels is a card layout, then just specify the animation config in the layout config and setActiveItem will animate between the two.
-
1 Jun 2012 4:45 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,714
- Vote Rating
- 438
- Answers
- 3113
If the container that is going to hold these panels is a card layout, then just specify the animation config in the layout config and setActiveItem will animate between the two.
Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.
-
4 Jun 2012 12:39 PM #3
Thanks mitchellsimoens.
I've implemented this method, and while I agree it is a better way to do it, it doesn't seem to have increased the performance of the fade on the Android devices I have here.
Oh well, I guess that's just the way it is.
Thanks for your help.


Reply With Quote