Jump to content
Search Community
Stagnax 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

Hello,

I'm trying to use DrawSVG for the external border .

As you can see I have 4 blocks that appear one by one .

What I'd like to do is : 

As soon as the first block appears a border should start and complete its path as the last block appears

 

I hope I'm clear what I want  :)

See the Pen yvZRJE by stagnax (@stagnax) on CodePen

Link to comment
Share on other sites

Thank you for the nice demo.

 

The main problem was that you gave your SVG an id of border but you really want a <rect> inside the SVG to have that ID so that DrawSVG can animate it.

 

 

var tl = new TimelineMax();
 tl.add("reveal");
 tl.to("#lay1",2,{opacity:1 });
 tl.to("#lay2",2,{opacity:1 });
 tl.to("#lay3",2,{opacity:1 });
 tl.to("#lay4",2,{opacity:1 });
//create a tween that has a duration the same as the timeline and put it at a time of 0
 tl.fromTo("#border", tl.duration(), {drawSVG:0}, {drawSVG:"100%"}, 0);

 

See the Pen PQVXxZ?editors=0010 by GreenSock (@GreenSock) on CodePen

 

 

 

  • Like 3
  • Thanks 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...