ios - How to hardware accelerate a box-shadow animation in CSS? -


i animating on box-shadow css. using instruments program, discovered animation alone taking 35% of cpu on ios safari! iphone become hotter , hotter when leave page running. if comment out animation, cpu usage normal. how can hardware accelerate animation not strain cpu?

css glow

jsfiddle: http://jsfiddle.net/tokyotech/tutlh/

@-webkit-keyframes pulseglow {     0% {         box-shadow: none;     }     10% {         box-shadow: 0 0 1.4em rgba(255,0,0,1),             0 0 1em rgba(255,0,0,1) inset;         border-color: rgba(255,0,0,0.5);     } }  #recordbutton {     display: block;     width: 5em;     height: 5em;     background: salmon;     border-radius: 50%;     -webkit-animation: pulseglow 1s ease-in-out 1s infinite; } 

the short answer browser decides on when use hardware acceleration render something; it's not can force on particular class or style. can use css properties more have browser use hardware acceleration on it, example -webkit-transform: translate3d (even if performing 2d transform on page) , -webkit-transition.

see article notes list of hardware accelerated properties.

as particular animation problem, i'm not sure how you'd able repeating transition occur without user interaction or using javascript (alone or in addition css). while can have -webkit-transition: box-shadow, i'm not sure how go repeating pulse animation since transition run when property value changed.


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -