Jump to content


Problem of delay on TweenMax

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



I'm not an expert in GSAP and I have some troubles with my SVG animation. 

Indeed,  I want to create a pre-loading effect on my page but I have some issues regarding the delay. I made a screenshot which show my problem : https://vimeo.com/189758547

My SVG appears at the beginning of my animation but I want to reveal the SVG by animating the strokes.


Here is my JS code (the link to my codepen) :

$(window).load(function () { 
        $(function () {
            var first = $('#firstletter'),
                second = $('#secondletter'),
                competences = $('.competence'),

                // Sample script for Tweening on a Timeline
                tl = new TimelineMax({
                    paused: false,
                    yoyo: false

            tl.fromTo([first, second], 3, {
                drawSVG: "100% 100%"
            }, {
                drawSVG: "0% 100% ",
                ease: SlowMo.easeOut
            tl.fromTo(competences, 1, {
                opacity: 0,
                top: 0
            }, {
                opacity: 1,
                top: "50%"
        $('#loader-overlay').delay(5000).fadeOut('slow'); // 5 sec de délai avant que la div ne disparaisse


Thank you for your help :)

See the Pen jMgmQY by MaralS (@MaralS) on CodePen

Link to comment
Share on other sites

I'm no expert at this at all but could you tween css properties for the loader container from display none to display block like so:


See the Pen xEvrYZ by mulegoat (@mulegoat) on CodePen

  • Like 1
Link to comment
Share on other sites

Hello MaralS, and Welcome to the GreenSock forum!


if it was me i would use the GSAP CSSPlugin special property autoAlpha


See the Pen RGXQXR by jonathan (@jonathan) on CodePen


So instead of using display:none on #titre-conteneur in your CSS, which will remove your element from the rendering tree when loaded. You would use visibility:hidden; to hide the element on load.


Then you would animate autoAlpha to 1 with a to() tween:

tl.to(loader, 1, { autoAlpha: 1 });

autoAlpha is part of the GSAP CSSPlugin:




autoAlpha is better for rendering performance ;)

  • autoAlpha
    Identical to opacity except that when the value hits 0 the visibility property will be set to "hidden" in order to improve browser rendering performance and prevent clicks/interactivity on the target. When the value is anything other than 0, visibility will be set to "inherit". It is not set to "visible" in order to honor inheritance (imagine the parent element is hidden - setting the child to visible explicitly would cause it to appear when that's probably not what was intended). And for convenience, if the element's visibility is initially set to "hidden" and opacity is 1, it will assume opacity should also start at 0. This makes it simple to start things out on your page as invisible (set your css visibility:hidden) and then fade them in whenever you want.
//fade out and set visibility:hidden
TweenLite.to(element, 2, {autoAlpha:0});

//in 2 seconds, fade back in with visibility:visible
TweenLite.to(element, 2, {autoAlpha:1, delay:2});

Happy Tweening! :)

  • 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.