GSAP Flashcards
What are the three primary methods of the GSAP object for creating tweens?
gsap.to(), gsap.from(), and gsap.fromTo(). These methods animate properties over time.
What does a tween do in GSAP?
A tween animates a property of an object over time, specifying targets, properties, and optional special properties like duration.
How is the x or y property used in GSAP animations?
It is a shorthand for the CSS translateX or translateY property, used to move elements along the horizontal axis.
What are staggered animations in GSAP?
They animate multiple objects with delayed start times using the stagger property.
What is a GSAP timeline?
A container for multiple tweens, enabling sequencing, overlap, nested timelines, and repeat delays.
What is the basic syntax for a gsap.to() tween?
gsap.to(".fred", { x: 400 });
This animates the element with the class “fred” to an x position of 400.
For best performance, which CSS properties should you animate with GSAP?
- x
- y
- rotation
- rotationX
- rotationY
- skewX and skewY
- scaleX, scaleY, or scale
What does the delay property do in GSAP?
The delay property specifies how much time should transpire before the animation begins.
What does the repeat property do in GSAP?
The repeat property defines how many times the animation should repeat.
What happens if you set repeat: -1 in GSAP?
The animation will repeat indefinitely.
How can you play an animation back and forth in GSAP?
With yoyo set to true:
yoyo: true,
How can you delay, when an animation repeats in GSAP?
The repeatDelay property specifies how much time should transpire between each repeat of the animation.
What does the start property in ScrollTrigger define? (GSAP)
The start property defines when the animation begins relative to the scroll position. Example: “start”: “top 75%”.
What does “start”: “top top” mean in ScrollTrigger? (GSAP)
It means the top of the trigger element matches the top of the viewport (default behavior).
What does the end property in ScrollTrigger do? (GSAP)
The end property defines when the animation ends relative to the scroll position.
How can you set an absolute end value in ScrollTrigger? in GSAP
By using a relative value like “end”: “+=500”, which ends 500px after start.
What does toggleActions control in ScrollTrigger? in GSAP
It controls the behavior when the trigger point is crossed - “onEnter, onLeave, onEnterBack, onLeaveBack”.
Which 8 toggleActions can be used for the scrollTrigger in GSAP?
play, pause, resume, reverse, complete, restart, reset, none
What does scrub do in GSAP?
scrub:true or scrub:1 (eased for mouse scrolling) scroll the element according to the scrolling.
A higher value adds delay to the scrolling.
How can you fix an animated element in gsap while using scrollTrigger, so it does not scroll with the page?
With:
pin:true,
What does pinSpacing do in GSAP’s ScrollTrigger?
pinSpacing controls whether space is added to push content down when an element is pinned.
pinSpacing: true (default)
adds padding/margin to keep the layout intact.
pinSpacing: false
removes this spacing, causing content to overlap the pinned element.
What does the pin property do in GSAP ScrollTrigger?
When pin: true is set, ScrollTrigger wraps the target element in a pin-spacer div to preserve its layout in the document flow while making it fixed. This allows the element to appear stationary while other content scrolls.
What is the purpose of the pin-spacer element in ScrollTrigger?
The pin-spacer is an automatically added wrapper element that maintains the original space occupied by the pinned element. This prevents layout shifts and keeps surrounding content in place while the element is pinned.
What padding adjustments does pin add by default?
By default, the pin-spacer wrapper includes padding to prevent visual layout changes. This padding matches the pinned element’s dimensions and offsets to simulate its original position.