css - Transitioning Transforms in Safari look terrible/shaky/stuttering -
i have few functions based on scrolling user moves elements , down along page (imitating scroll effect.)
in order make little smoother using transition: transform 0.7s cubic-bezier(0.49, 0.47, 0.63, 0.85); (with proper vender prefixing).
the problem works great except in safari. there -webkit-transition: -webkit-transform 0.7s cubic-bezier(0.49, 0.47, 0.63, 0.85); causes animation jerk around , gives vibrating effect. have been reading on ages , have tried setting perspective property , backface properties no luck.
is there way fix this/has seen this? , safari not allow transitioning transforms?
any in understanding problem amazing.
i found fiddle http://jsfiddle.net/3yfspjlt/ shows problem. if doesn't blink @ first keep scrolling , down.
for curious code, more curious why bug happens in safari specific use case. (although of course trying find answer).
js file
getelementpositions: function(){ var de = document.documentelement; var windowhight = window.innerheight; var page = scrollanimations.gettopbottom(scrollanimations.featurepage, de, windowhight); var profile = scrollanimations.gettopbottom(scrollanimations.featureprofile, de, windowhight); var barone = scrollanimations.gettopbottom(scrollanimations.firstbar, de, windowhight); var bartwo = scrollanimations.gettopbottom(scrollanimations.secondbar, de, windowhight); var barthree = scrollanimations.gettopbottom(scrollanimations.thirdbar, de, windowhight); scrollanimations.pagediff = page.diff; scrollanimations.pagestartp = page.top - (page.padding -100); scrollanimations.profilediff = profile.diff; scrollanimations.profilestartp = profile.top - (profile.padding/1.3); scrollanimations.baronediff = barone.diff; scrollanimations.baronestarttop = barone.top - (barone.padding/1.3); scrollanimations.bartwodiff = bartwo.diff; scrollanimations.bartwostarttop = bartwo.top - (bartwo.padding/1.3); scrollanimations.barthreediff = barthree.diff; scrollanimations.barthreestarttop = barthree.top - (barthree.padding/1.3); scrollanimations.startscrollanimations(); }, gettopbottom: function(el, de, windowhight) { var result = {}; var box = el.getboundingclientrect(); result.top = box.top + window.pageyoffset - de.clienttop; result.bottom = box.bottom + window.pageyoffset - de.clienttop; result.diff = result.bottom - result.top; result.padding = windowhight - result.diff; return result; }, scrollpage: function(scrollpos){ var pageheight = scrollanimations.pagescroll.offsetheight; var scrolldiff = scrollpos - scrollanimations.pagestartp; var realpos = -scrolldiff/scrollanimations.pagediff; var lengthleft = pageheight - scrollanimations.pagediff; if (realpos > 0.09) { transy = 0.09 * lengthleft; } else if(realpos < -1) { transy = -1 * lengthleft; } else { transy = realpos * lengthleft; } scrollanimations.pagescroll.setattribute('style', '-webkit-transform:translate3d(0,' + transy + 'px,0); -moz-transform:translate3d(0,' + transy + 'px,0); -ms-transform:translate3d(0,' + transy + 'px,0); transform:translate3d(0,' + transy + 'px,0);'); if(modernizr.orientation) { scrollanimations.pagescroll.style.transformstyle='preserve-3d'; scrollanimations.pagescroll.style.webkittransition='0.4s cubic-bezier(0.49, 0.47, 0.63, 0.85)'; } }, css (i have tried using all)
#page-scroll { -webkit-transition: -webkit-transform 0.7s cubic-bezier(0.49, 0.47, 0.63, 0.85); -moz-transition: transform 0.7s cubic-bezier(0.49, 0.47, 0.63, 0.85); -ms-transition: transform 0.7s cubic-bezier(0.49, 0.47, 0.63, 0.85); -o-transition: transform 0.7s cubic-bezier(0.49, 0.47, 0.63, 0.85); transition: transform 0.7s cubic-bezier(0.49, 0.47, 0.63, 0.85); }
i'm not 100% sure you're trying accomplish try below...? let know if helped, if not elaborate more on question please or add more of source codes.
/* add translatey values */ -webkit-transform: translatey(100px); -moz-transform: translatey(100px); transform: translatey(100px); -webkit-transition: 0.7s cubic-bezier(0.49, 0.47, 0.63, 0.85); -moz-transition: 0.7s cubic-bezier(0.49, 0.47, 0.63, 0.85); transition: 0.7s cubic-bezier(0.49, 0.47, 0.63, 0.85);
Comments
Post a Comment