Search the Community
Showing results for tags 'addlabel'.
-
Synchronizing GSAP timelines across React components using a master timeline (with labels)
Jose Pio posted a topic in GSAP
Hi GreenSock team π I'm working with Next.js 15 and trying to orchestrate animations across multiple components using a shared masterTimelinethrough context. Each component defines its own gsap.timeline() and then adds it to the global timeline via masterTimeline.add(). For example: I have two components: Boxand Nav. - Box has its tl with 4 tweens and inserts a label after the second tween (addLabel('afterSecondTween')). - Nav defines its own timeline and tries to insert it at that label inside the master timeline using masterTimeline.add(navTL, 'afterSecondTween'). π― My goal is to synchronize timelines between different components, so that they run in sequence or in specific positions. π£ The result: Nav always animates at the start of the timeline. β Iβve confirmed that: - The Nav timeline is added with the same label name. - But it still plays immediately (as if the label had time = 0). π¬ My question is: Is it correct to insert timelines at labels from other components in GSAP + React? Is this synchronization possible? What is the correct or recommended way to synchronize animations between different components in GSAP and React? Is this pattern okay: 1. Each component creates its own timeline 2. One of them defines a label at a specific point 3. Another component inserts its timeline at that label Or... is there a better / more robust way to orchestrate animations across components in React using GSAP? Thanks in advance for your insights π Hereβs a minimal CodePen that replicates the problem: π CodePen -
addlabel Making the animation complete in 20% of the last animation in the timeline
BhanuSingh posted a topic in GSAP
I have this animation, where I am having a hard time making a particular animation complete in almost 20% or start of a particular label. const zoomData = [ {scale: 1, origin: [0.5, 0.5] }, {scale: 18, origin: [0.685, 0.38], steps: [ { type : 'in', el : '.location_1', }, { type : 'out', el : '#text', }, { type : 'out', el : '.location_wrapper .section-title', }, { type : 'out', el : '.location_wrapper .andaman-key', }, { type : 'in', el : '#htxt', }, ], label : 'empty' }, {scale: 1, origin: [0.5, 0.5], steps: [ { type : 'out', el : '.location_1', }, { type : 'out', el : '#htxt', }, ], label : 'havelock' }, {scale: 18, origin: [0.500, 0.78], steps: [ { type : 'in', el : '.location_2', }, { type : 'in', el : 'svg #ctxt', }, ], label : 'chidiyatapu' }, ]; I have this object which is responsible for setting up the animation. It is used by the following Js to add it to the timeline. zoomData.slice(1).forEach(data => { if(data.steps) { tl.zoom(".location_island", { scale: data.scale, origin: data.origin, ease: "power1.inOut" }); tl.addLabel( data.label , "<"); data.steps.forEach( step => { if(step.type == 'out') { tl.fromTo(step.el, { autoAlpha: 1, display: 'block', }, { autoAlpha: 0, display: 'none', ease: "power1.inOut" }, data.label ) } if(step.type == 'in') { tl.fromTo(step.el, { autoAlpha: 0, display: 'none', }, { autoAlpha: 1, display: 'block', ease: "power1.inOut" }, data.label + "+=20%" ) } }) } else { tl.zoom(".location_island", { scale: data.scale, origin: data.origin, ease: "power1.inOut" }) } }); }); How can I make the text, Our Centers, Andaman Island and `#text` fade away when I am first time zooming inside. -
When working with TimelineMax, is it possible to use a relative position and have a label? I have tried to chain `addLabel` before and after the desired position, but it does not seem to be able to be referenced. Am I falling into some sort of anti-pattern? Here is a barebones demo: http://codepen.io/anon/pen/VLrpQX var tl = new TimelineMax(); var boxNode = $('.box'); tl .fromTo( boxNode, 8, { autoAlpha: 0 }, { autoAlpha: 1 }, 'fadeIn' ) // Start the movement alongside the fade .addLabel('moveFromTop') .to( boxNode, 1, { top: '200px' }, 'fadeIn+=0' ) //.addLabel('moveFromTop') // One second after moving from top, move from the left .to( boxNode, 1, { left: '200px' }, 'moveFromTop+=1' );
- 3 replies
-
- timelinemax
- addlabel
-
(and 1 more)
Tagged with:
-
Could someone lend me some knowledge?!! Is it possible to take this addLabel string: overviewtl.addLabel("Sequence 01", overviewtl.duration); and have it update a dynamic text box on the stage. It's for client editing purposes, so they can have a reference to the sequence name within a long timelineMax build. My knowledge of AS3 really lets me down sometimes, but I usually manage from Carl's tutorials and the forums here to get what I need to work. This case, I'm stumped! I've already built in the progress bar and slider + play pause functions which all work a treat - this final bit would be the icing on the cake! Thanks in advance, Merrick
- 3 replies
-
- timelineMax
- greensock
-
(and 1 more)
Tagged with:
-
Hi Is there a way to to add a listener when the timelinemax instance reaches a label or would I have to use TimelineMax.currentLabel on the onUpdate to see the label change? Thanks!