Jump to content
Search Community

unable to rotate the image

newlearner test
Moderator Tag

Go to solution Solved by GreenSock,

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

  • Solution

I'm not sure I entirely understand the effect you're after, but I noticed a few problems:

  1. You were trying to select things with jQuery but you weren't loading jQuery. For example, you had a bunch of $('#dart1') references but those won't work if you don't load jQuery ("$" would be undefined). But there's no reason to use jQuery to select that stuff - you can simplify your code by just letting GSAP do that selection for you. Delete your $('...') wrappers and it'll work. 
  2. You said you wanted the back-and-forth to stop after a few times, but you had repeat:-1 which means "forever". I changed it to repeat:2 so that it repeats twice, but change that to whatever you want. 
  3. You don't need to wrap your CSS properties in a css:{} object although it's totally fine. If you omit that, GSAP will automatically add it for you. So you can keep your code more consolidated.
  4. To make your code even shorter, you can chain things.
  5. There's no need to play() the animation at the end - by default, all animations play by default. 

Here's an updated version with more concise code:

http://codepen.io/anon/pen/VeBWqW

 

Does that help? 

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