Jump to content
Search Community

Restart current animation

evomedia.lt test
Moderator Tag

Warning: Please note

This thread was started before GSAP 3 was released. Some information, especially the syntax, may be out of date for GSAP 3. Please see the GSAP 3 migration guide and release notes for more information about how to update the code to GSAP 3's syntax. 

Recommended Posts

var slide = 1;
var tl = new TimelineMax({repeat:1, yoyo:false});

$(".owl-carousel").each(function(){
    tl.fromTo('.slide-nav.sn-'+slide+' .slide-loading .gold', 5, {drawSVG: "0%"}, {drawSVG: "100%"}, 0);

    $(this).owlCarousel({
    ....
    });

   $(document).on("click", ".slide-nav.sn-"+slide+" button", function () {
    tl.restart();
   });

    slide++;
});

How to restart current object animation? tl.restart() restarts all objects animations. I have multiple carousels and everyone have svg object with animation.

Link to comment
Share on other sites

Hi @evomedia.lt,

 

Is there a specific reason to define 'document' as the click area?

 

If you define the carousels itself, it is easier.

Here's an example, no matter which button (or carousel) you press, only the defined objects e.g.

  $ (this) .find ('. Line'))

and animations 
  TweenLite.to ($ thisLine, 0.8, {xPercent: 0});

are activated:

 

 

See the Pen LXJzVY by mikeK (@mikeK) on CodePen

 

And - as @OSUblake  said - without a CodePen, it's not easy to help you.

 

Kind regards

Mikel

 

  • Like 5
Link to comment
Share on other sites

Hi @evomedia.lt

 

You've 'forked' the Owl Carousel 2 plugin very special.


If you are not very experienced, try to build your own slider according to your ideas.

 

To your 'problem': If you define the carousels itself, it is easier!
Here is the receipt. However, I have damaged your nav buttons ...

 

See the Pen KrGqMY by mikeK (@mikeK) on CodePen

 

Kind regards

Mikel

 

 

  • Like 1
Link to comment
Share on other sites

 

1 hour ago, evomedia.lt said:
I want to restart the current circle animation. Now pressing the button previous / next or changing the slide, restarts all circles

 

You're adding everything to the same timeline. That's why I said to create timelines inside the each loop.

 

@mikel's solution is good too.

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