Thank you for the quick reply, i'm not sure if im explaining it well.
note: translating X is just being used as an example for simplicity, any property would be applicable.
var targetlist = $(".sometarget"); // this could be multiple targets, an array.
TweenMax.to ( targetlist, 1, { x : function( x ){ //insert unrelevant logic here
return x; } } ); // I would like to get the current x value and send it through a function.
The x would be different for each targetlist[number].
TweenMax.to( targetlist, 1, { x: (this.vars.css.x + 100) } ); // This does not work even though this.vars.css.x does return a valid value.
TweenMax.to( targetlist, 1, { x : ( this.target.position().left + 100 ) } ); //nor does this work, this.target.position().left returns a valid value.
Is there a way to do this without doing it like the following-
var targetlist = $( ".sometarget" );
var targetlistlength = targetlist.length;
var newtarget='';
var targetx=0;
for(var I = 0; I< targetlistlength;i++){
newtarget=$(targetlist[ I ]);
targetx = newtarget.position().left;
// some logic done on targetx//
TweenMax.to( newtarget, 1, {x: targetx } );
}
I would like to do something similar as to what is seen in Draggable instead, for example:
Draggable.Create( $(".sometarget"), { snap: { x: function(endValue){ return (endValue / 2 ) * 2 ; } , y: function(endValue) { return (endValue / 2) * 2 ; } } } );My goal is to simply tween a div background color(hsl format), increasing the hue by 120 every second, if hue goes over 360 I would like to subtract 360.
TweenMax.to( $(".mytargetdiv") , 1 , { repeat:-1, backgroundColor: function(backgroundColor){ backgroundColor[0]+=120;if(backgroundColor[0] > 360){ backgroundColor-=360;} return backgroundColor } } );
//note: might need to process the backgroundColor value to strip an array[3] from the format hsl(x,y,z) and vise versa.
Is Draggable's snap just an exception or can this be done for tweenmax vars?