Jump to content
Search Community

Creating a reveal animation without using a mask / cover?

Maksiss test
Moderator Tag

Go to solution Solved by ZachSaucier,

Recommended Posts

Hi! 

I've been trying to make this work for a while, but all the relevant tutorials use some sort of a masking technique. And as you can see in the codepen, it's not appropriate here, because of the timeline gaps it creates. I can't put the timeline above the mask, because in the end I need it behind the label. Maybe I could juggle the z-indexes at the midpoint,  but that seems like more trouble than it's worth.

 

image.png.40bc2d303666ac85e788e4ac5e8a0697.png

In the end this is what I'm trying to reveal. So just using from(x:200 /or/ width:0) wouldn't work here, since I want to get that painted on brush stroke effect. 

Any tips on how could I achieve this? 

Thank you!

 

 

See the Pen gOLaNea by maksiss3 (@maksiss3) on CodePen

Link to comment
Share on other sites

  • Solution

Hey Maksiss and welcome to the GreenSock forums. A clip-path or mask is definitely the way to go (really the only way to go unless your background color is a solid color in which case you could fake a clip-path or mask). You just need to make sure to apply the clip-path/mask to only the content that you want to be revealed, not the timeline line.

  • Like 1
  • Thanks 1
Link to comment
Share on other sites

Thank you! Was not aware of how to properly use such a feature.

 

Another thing, if I may. I want to apply scrollTrigger to each element trough forEach loop. Is it possible to somehow access each elements pseudo? (Since I want to trigger it's animation first)

function largeFactTimeline(fact){
  let square = fact.CSSRulePlugin.getRule("::after"); 
}

 

Tried this, but it doesn't seem like that works. Any work around or will I have to try and transfer the pseudo element into the HTML?

Link to comment
Share on other sites

It's not a bug, it's due to how browsers convey the clip-path information. In summary, they don't report the exact value you wrote, they report a shorthand which is ambiguous. So GSAP can't know the original value just from the rendered value.

 

With that being said you could use a .fromTo() instead in this case: 

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

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