0% found this document useful (0 votes)
366 views3 pages

GSAP Animation Techniques and CDN

Uploaded by

1122.awaissaleem
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
366 views3 pages

GSAP Animation Techniques and CDN

Uploaded by

1122.awaissaleem
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

[Link]('.

box1',{
x:600,
duration:2, as ka matlba katni dar tak chalna ha
delay:2, as ka matlab katni dar bad chalana ha
backgroundColor:"blue",
// stagger:2
repeat:-1, as ka matlab elemnt infinite chala ga
yoyo:true, as ka matlab element takra ka wapis aya ga reapeat/yoyo akti use ho gi
})

.1
[Link] means element go for apni initinal position sa final position
matlab apni asl jaga sa dosri jga jata ha

2. [Link]() means elemnt apni final position sa waps initinal


position measns gom per kr apni asi jaga waps ajata ha

Navbar animate with gsap:

[Link]("#nav img,#nav h3,#nav h4,#nav button",{


y:-100,
duration:1,
delay:1,
opacity:0,
stagger:0.5 // sab ka darman katni time ma animate krwna ha
})

awIaadas

con

Contionuly moving of element:

[Link]("h5",{
y:30,
repeat:-1,
duration:0.7,
yoyo:true
})
ScrollTrigger animations:

[Link](".page1 .box", {duration: 1, delay:2,x:600,rotate:360,scrollTrigger:{


trigger:".page1 .box",
scroller:'body',
markers:true,
start:'top 30%',
scrub:2 // scrub smoothing ka kia use hota ha as ma scroll per element visible hota ha or
scroll per hi unvisible hota ha
}})

<script
src="[Link]
integrity="sha512-7eHRwcbYkK4d9g/6tD/mhkf+
+eoTHwpNM9woBxtPUBWm67zeAfFC+HrdoE2GanKeocly/VxeLvIqwvCdk7qScg=="
crossorigin="anonymous"
referrerpolicy="no-referrer"
></script>
<script

src="[Link]
s"
integrity="sha512-onMTRKJBKz8M1TnqqDuGBlowlH0ohFzMXYRNebz+yOcc5TQr/
zAKsthzhuv0hiyUKEiQEQXEynnXCvNTOk50dg=="
crossorigin="anonymous"
referrerpolicy="no-referrer"
></script>
Ak gsap cdn ha or script scroll ki cdn ha

Locomotive scroll js:


Position in css:
Position relative: ya apni jga ni chrothi move ho jati ha per apni jga ni
chorthi

Position Absoulute: ya apni jga chor dati ha per or parent ma postion lab
Lati ha means apni parent ka sath attach ho jati ha

Position Stickey: ya scroll per apni postion fix krata ha or or ak kam or


krta ha ya apna parent ki height per fix rehta ha jasa hi height katam
wasa hi fix band ho jata ha gar parent ka pass height ni ha tu pori body hi
height la la ga.

Flex:1 Nearst Parent ka sath work katiri ha ziada dor ni kati or ya width
ko equally dievide krati ha
.card{
display: flex;
flex: 1;
}

Common questions

Powered by AI

Infinite loops in GSAP animations ('repeat:-1') allow animations to continue indefinitely, useful for creating backgrounds or elements that require continuous movement. The benefits include engaging users with a lively interface and keeping motion elements alive, which can be impactful in media like banners or loading elements. However, potential drawbacks include increased CPU usage due to constant re-rendering and potential for distracting users from the main content. Careful use is needed to ensure these animations do not detract from the overall user experience .

The 'stagger' option in GSAP is significant when animating a collection of elements because it allows each element to begin its animation at slightly delayed intervals, creating a cascading effect. This capability is valuable for enhancing visual appeal and providing a sense of motion continuity across multiple elements. It can be used creatively to direct user attention through a series of animations that unfold gradually rather than all at once .

The 'flex:1' property in a CSS flexbox layout allows an element to grow and fill available space proportionally based on its sibling elements' growth factors. When multiple elements have 'flex:1', they distribute space equally among themselves, ensuring that the total space is efficiently utilized. This is particularly beneficial in responsive designs to ensure equal utilization of available space across various device sizes .

The 'delay' property in GSAP determines the amount of time, in seconds, before an animation begins after it is triggered. It impacts the timing by allowing developers to control when an animation starts relative to other events or animations, ensuring a precise sequence or staggered effect. This is crucial for coordinating complex animations or when synchronizing an animation with UI interactions .

The 'yoyo' property in GSAP makes an animation reverse direction on alternate loops, causing the animated element to move back to its starting point before repeating the animation. This can create a continuous to-and-fro effect. It is particularly useful in scenarios where repetitive, oscillating animation is desired, such as simulating a bouncing ball or a swinging pendulum effect .

The gsap.to method animates an element from its initial position to a specified final position based on the given properties, essentially moving it to a new location. In contrast, the gsap.from method animates an element from a specified final position back to its initial position. This means that while gsap.to moves an element towards a target location, gsap.from starts from that location and moves it back to its original state .

In CSS, position:absolute removes an element from the normal document flow and positions it relative to its closest positioned ancestor, often the body if none are found. This is useful for overlaying elements precisely. In contrast, position:relative keeps the element in the document flow, but offsets it from its normal position, which is useful for making slight adjustments without affecting other elements. Absolute positioning is effective for creating modals, overlays, or floating elements, while relative positioning is ideal for small adjustments and animations .

The position:sticky in CSS essentially acts like a hybrid between relative and fixed positioning. An element with position:sticky is treated as relatively positioned until it crosses a specified threshold within its parent, after which it becomes fixed in place during scrolling. This behavior is heavily dependent on the height of the parent element; if the parent's height is smaller than the threshold, the sticky element may become fixed immediately or not engage stickiness at all. Thus, it is ideal for headers or other UI elements that should remain visible within a parent section .

The Locomotive Scroll library enhances the interface experience by providing smooth scrolling and view tracking. When used in conjunction with CSS position properties like sticky or absolute, it enables compelling effects that can enhance navigation flow and visual feedback. For example, sticky headers combined with smooth scrolling can offer a seamless transition between sections, maintaining element visibility without disrupting the visual hierarchy. The library's ability to trigger animations or change states during scroll events complements CSS positioning to create dynamic, interactive experiences .

The 'scrub' option in GSAP's ScrollTrigger plugin is used to create a smoother connection between the scrolling motion and the animation. By setting 'scrub' to a positive number, it determines how long it takes for the animation to catch up to the user's scroll position. This ensures that the animation plays in sync with the scroll, providing a more fluid and natural animation experience as users scroll through the page .

You might also like