Share Posted June 18, 2014 Hi! I've ran into this. < var div = document.createElement('div'); < TweenMax.set(div, {backgroundSize: 'cover'}); < console.log(div.style.backgroundSize); > "50% 0px" It's should be "cover", isn't it? Link to comment Share on other sites More sharing options...
Share Posted June 18, 2014 Hi and welcome to forums, TweenMax.set() is basically a zero-duration tween. It will tween for zero seconds ( immediately rendering ) values that are tweenable. backgroundSize takes several options, from which some are tweenable ( like backgroundSize: 10% 50% ) and some are not ( like backgroundSize: cover ). I think TweenMax can't tween that value so it just fallbacks to some value that is tweenable, in this case 50% 0px ). Link to comment Share on other sites More sharing options...
Share Posted June 18, 2014 Yes, it appears that when you specify "cover" or any string it is generating the 50% 0px value, which isn't proper. We will look into this further and get back to you. Thank you. 1 Link to comment Share on other sites More sharing options...
Share Posted June 18, 2014 Yep, Looks like both Chrome and Firefox report the same value for cover: 50% 0px I don't know if this helps.. but when i look at the background-size property, it looks like keyword values are not animatable, even though GSAP can animate any property and object! Taken from MDN background-size docs: Animatiable:yes, as a repeatable list of a simple list of a length, percentage or calc(); when both values are lengths, they are interpolated as lengths; when both values are percentages, they are interpolated as percentages; otherwise, both values are converted into a calc() function that is the sum of a length and a percentage (each possibly zero), and these calc() functions have each half interpolated as real numbers. This means keyword values are not animatable. If the background-size is contain or cover.The image is rendered, preserving its intrinsic proportion, at the largest size contained within, or covering, the background positioning area. If the image has no intrinsic proportion, then it is rendered at the size of the background positioning area. Just my two cents, that are worth one cent:) 1 Link to comment Share on other sites More sharing options...
Share Posted June 19, 2014 After further review, we are going to have look into supporting background-size keywords at a later time. Just a matter of managing a number of very significant priorities that we have for the platform. Will using "100% 100%" work for you? It seems that will currently work with both tweens and set: http://codepen.io/GreenSock/pen/pvLKD Thanks again for pointing out the issue. We will keep it on our list. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now