Jump to content

Search In
  • More options...
Find results that contain...
Find results in...

rotation not working

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



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

Link to post
Share on other sites

The problem had nothing to do with GSAP or it syntax - it was just a problem with your jQuery selector text:

$("wob") //BAD
$("#wob") //GOOD

You were telling jQuery to literally select all of the <wob> tags instead of the element that had an ID of "wob" ;)

  • Like 1
Link to post
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();

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");
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 post
Share on other sites



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.



Link to post
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.