Jump to content
Search Community

rotation not working

robwebb364 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

Please help.

 

Despite many efforts this is not rotating the ellipses..

 

ive followed the same syntax which has worked before with other attributes being animated, and checked other codepens which seem to work!  

 

GSAP seems very sensitive to syntax, and the docs on line are not helpful...

 

thanks

See the Pen DohdC by robertwebb364 (@robertwebb364) on CodePen

Link to comment
Share on other sites

thanks, both of those work on the codepen.. I was sure Id tried that!  :oops: 

 

but the problem is complicated in that i really want to select all of a class to each be animated: 

How should I do that?  Ive seen somewhere that the selector should be $(".classname") but that dont work!

grateful for help

--

 

the js is like this:

var peep=new Array();

     
$(document).ready(function(){ 
for (j=0; j<=20; j++) {   /// no of paths
var randx=parseInt(getRandom(0,1800));
var y=900; 
    
peep[j] = document.createElementNS('http://www.w3.org/2000/svg' 'ellipse');
    peep[j].setAttributeNS("null", "class", "peeple"); 
    peep[j].setAttributeNS(null, "cx", randx); 
    peep[j].setAttributeNS(null, "cy", y); 
    peep[j].setAttributeNS(null, "rx", getRandom(15,20)); 
    peep[j].setAttributeNS(null, "ry", getRandom(20,40));
    peep[j].setAttributeNS(null, "fill", "grey");
    peep[j].setAttributeNS(null, "stroke", "none");
 
    document.getElementById("svg").appendChild(peep[j]);  
 
}
 
 
var tl = new TimelineMax({repeat:-1, yoyo:true});
tl.to($("#wob"), 1, {rotation:"90", transformOrigin:"left top"});
    
});
 
function getRandom(min, max) {
  return (Math.random() * (max - min) + min);
            
Link to comment
Share on other sites

Hi,

 

In your code you're passing an ID to the selector, you should pass the classname with a point before the name:

var tl = new TimelineMax({repeat:-1, yoyo:true});

tl.to(".peeple", 1, {rotation:90, transformOrigin:"left top"});

If that doesn't solve the issue, please create a reduced live sample so we can get a better idea of what you're after.

 

Rodrigo.

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