Jump to content
Search Community

Overwrite problem

nicolasdesle test
Moderator Tag

Warning: Please note

This thread was started before GSAP 3 was released. Some information, especially the syntax, may be out of date for GSAP 3. Please see the GSAP 3 migration guide and release notes for more information about how to update the code to GSAP 3's syntax. 

Recommended Posts

Hi

 

Here's my JS:

 

var del = 0;    
divs  = $('.nav');
       
for(ind in divs){
            del+=.1;
            div = divs[ind];
            var target = div;
            TweenMax.to(target, 1, {css:"opacity:1", delay:del, ease:Sine.easeOut, overwrite:"none"});
}
 
and CSS:
 
.nav {
    color:#000;
    font-family: 'custom', helvetica, sans-serif;
    font-size: 4.25em;
    opacity:0;    
}   
 
 
 
Problem: the tweens overwrite each other, resulting in this 'graded' effect attached (half opacities).
What am I doing wrong? I want all divs to tween to an opacity of 1.
 
Thanks!
     

post-7721-0-56350900-1360330583_thumb.png

Link to comment
Share on other sites

Hmm the css property takes an object, not a string, so changing css:"opacity:1" to css:{opacity:1} would be a first step. I also think that ind is not an index either, rather an iterated element of divs, so I doubt that divs[ind] would be returning the correct element.

 

Figured I'd consolidate your code while it's in front of me; does the following work for you?

 

divs = $('.nav');
divs.each(function(index) {
    TweenMax.to(this, 1, {css:{opacity:1}, delay:(index+1)*.1, ease:Sine.easeOut});
});

 

Overwriting should only come into play if two tweens are applied to the same element. The default overwrite method should allow non-conflicting tweens to continue alongside each other though, so a tween should only be overridden if a tween targets the same element as an existing tween, and is targeting the same property as that existing tween.

 

overwrite:"none" is something I doubt you would really need here, as there are a minuscule number of use cases for leaving 2 conflicting tweens running at the same time.

  • Like 1
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...