Jump to content
Search Community

infinate rotatation using an SVG in Gsap

Darkin 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

Hello guys,
 
I'm new here, and i'm trying to make this SVG rotate forever, but it just won't work, i've tried making the time -1 and it still wont work.
any suggestions?

Thanks.
 
<script>
//we'll use a window.onload for simplicity, but typically it is best to use either jQuery's $(document).ready() or $(window).load() or cross-browser event listeners so that you're not limited to one.
window.onload = function(){
 
 
var logo = document.getElementById("logo");
 
var tween =TweenLite.to(logo, 5, {rotation:360, transformOrigin:"50% 50%"}); //keywords
   tween.restart();
 
 
 
}
</script>
Link to comment
Share on other sites

Hi and welcome to the GreenSock forums.

 

The trick is to use a TweenMax tween. TweenMax tweens have more features than TweenLite tweens (repeating being one of them)

 

Something like this

TweenMax.to(".gear", 4, {rotation:360, repeat:-1, transformOrigin:"50% 50%", ease:Linear.easeNone});

http://codepen.io/GreenSock/pen/NqgboL

 

More on TweenMax: http://greensock.com/tweenmax

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