Jump to content
Search Community

GreenSock tween Raphael set, not possible?

ApplePI 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

Hi,

 

I'm trying to tween a Raphael set:

 

var atomH1_1 = paper.set();

var atom_Circle1 = paper.circle(10, 10, 25).attr({id: 'circle1','gradient':'70-#00CC00-#00FF00','stroke-width': '0'}).data('id', 'circle1');

var atom_Circle2 = paper.circle(20, 20, 25).attr({id: 'circle2','gradient':'70-#0000CC-#0000FF','stroke-width': '0'}).data('id', 'circle2');

atomH1_1.push(atom_Circle1);

atomH1_1.push(atom_Circle2);

 

tween1 = TweenMax.to(atomH1_1, 0.3, {raphael:{'tx':100,'ty':100,'scaleX':0.5,'scaleY':0.5},ease:Power1.easeInOut, onComplete:nextStep});

 

But it seems it triggers an error in GreenSock ():

TypeError: c is undefined

file:///E:/the%20Factory/Vialight/06_www/js/greensock/plugins/RaphaelPlugin.min.js

Line 13

 

When I use the Raphael animate, it works fine, (but that's not what I'm looking for):

atomH1_1.animate({transform: "t100,100"}, 1000);

 

Is it not possible to tween Raphael sets? Or what am I doing wrong?

 

 

EDIT : I sort of solved the problem by using multiple targets in GreenSock:

 

var mySet = [atom_Circle1,atom_Char1];

TweenMax.to(mySet, 2, {raphael:{'tx':100,'ty':100},ease:Power1.easeInOut});

  • Like 1
Link to comment
Share on other sites

Yep, GSAP's RaphaelPlugin doesn't support Raphael "sets" like that but you found the exact solution I'd recommend :) Good job.

 

For the record, the error was because the "set" doesn't have a "matrix" value (since there are multiple objects in the set, all with their own matrix). Thus when the RaphaelPlugin tried to figure out how to do the transform(s) on the object, the null matrix tripped it up.

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