Jump to content
Search Community

Stagger from div x y position

curtiswiens test
Moderator Tag

Recommended Posts

I am getting the value of a div x y position thusly:
let c1x = document.querySelector('#c1').getBoundingClientRect().left      
let c1y = document.querySelector('#c1').getBoundingClientRect().top

gsap.from(allcs,{duration:2.8,scale:0,  stagger:{each: 0.1,x: c1x,y: c1y},ease:"quint.out"})

Is there a way to tween from a stage position rather than the object position? I thought that use to be "" vs no quotes. Basically I am trying to have them all tween from a common x y position. Thanks!

Link to comment
Share on other sites

Yeah, a minimal demo will help a but here are a few quick notes:

  1. Your x and y values should NOT be inside the stagger object. 
  2. If you just want to position a bunch of stuff on top of a single element, you might want to look into Flip.fit(). But it's totally fine to use getBoundingClientRect() to do the calculations manually (more hassle, fewer kb). :)

 

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