-
25 Apr 2012 12:21 PM #1
Mask fadeIn/fadeOut opacity issue
Mask fadeIn/fadeOut opacity issue
Hello, i have this mask
With this CSS in stylesheet.cssCode:Ext.define('Mark.view.Waitmask', { extend: 'Ext.Mask', id: 'waitmask', config: { tpl: [ '<img id="spinner" src="res/spinner.png" />', '<div id="message">{mesage}</div>' ], showAnimation: { type: 'fade', duration: 400, }, hideAnimation: { type: 'fadeOut', duration: 400, }, hidden: true }, initialize: function() { this.superclass.initialize.call(this); this.setData({message:''}); }, show: function() { this.superclass.show.call(this); this.resume(); }, resume: function() { Ext.get('spinner').addCls('anim-rotate'); }, pause: function() { Ext.get('spinner').removeCls('anim-rotate'); }, });
Code:.x-mask { background: rgba(0, 0, 0, 0.8) center center no-repeat; & img { margin: 0px auto; } }
On desktop when i call show() and hide(), the mask fadeIn and Out perfectly,
but on my SE Xperia Arc not fade correctly, the fadeIn flow it is:- Start to FadeIn
- The mask start to fade to black
- When reach my CSS opacity, the mask continue fading more...
- Reach opacity 1.0 (OPAQUE)
- later comeback to the correct opacity setted into stylesheet.
- FadeIn Completed.
Thanks
-
26 Apr 2012 5:27 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,599
- Vote Rating
- 435
Two things, I don't think the CSS background rule can accept rgba, you should just use rgb and then use the separate opacity rule. Could be wrong with that, just what I remember is the "standard".
Since you have showAnimation with fade type, the fade will make it go to opacity 1 overriding any opacity you have in your CSS. We have the opacity set to 1 hardcoded.
If you have you mask like this:
Then you can use this override to allow it to use the after and before configsCode:Ext.define('Mark.view.Waitmask', { extend : 'Ext.Mask', xtype : 'waitmask', config : { tpl : [ '<img id="spinner" src="res/spinner.png" />', '<div id="message">{mesage}</div>' ], showAnimation : { type : 'fade', duration : 1000, after : { opacity : 0.5 } }, hideAnimation : { type : 'fadeOut', duration : 400 }, hidden : true }, initialize : function () { this.superclass.initialize.call(this); this.setData({message : ''}); }, show : function () { this.superclass.show.call(this); this.resume(); }, resume : function () { Ext.get('spinner').addCls('anim-rotate'); }, pause : function () { Ext.get('spinner').removeCls('anim-rotate'); } });
Code:Ext.define('Override.fx.animation.Fade', { override : 'Ext.fx.animation.Fade', updateOut : function (newOut) { var to = this.getTo(), from = this.getFrom(), before = this.getBefore(), beforeOpac = before.data.opacity, after = this.getAfter(), afterOpac = after.data.opacity; if (newOut) { from.set('opacity', beforeOpac || 1); to.set('opacity', afterOpac || 0); } else { from.set('opacity', beforeOpac || 0); to.set('opacity', afterOpac || 1); } } });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.
Looks like we can't reproduce the issue or there's a problem in the test case provided.


Reply With Quote