Hi, I'm new to the forums, new to GreenSock GSAP too.
So far I'm using it quite effectively with the 5% of what I've worked with
I've got a bit of an issue trying to get a small script working. I wonder if anyone can help.
The following code effects the x property with a randomisation of 2 possible values (-100% or 100%) which all works great:
var wipeAnimation = new TimelineMax()
.staggerFromTo('section.panelx', 1, {
x:function(){
var randWay = parseInt((Math.random() * 2) + 1);
if(randWay == 1) return "-100%";
else if(randWay == 2) return "100%";
}
},
{x: "0%", y: "0%", ease: Linear.easeNone}, 1)
The issue I have is that I also would like to randomise the property itself between 'x' and 'y' with the randomised value of before (-100% or 100%)
var wipeAnimation = new TimelineMax()
.staggerFromTo('section.panelx', 1, {
function(){
var randWay = parseInt((Math.random() * 4) + 1);
if(randWay == 1) return {x:"-100%"};
else if(randWay == 2) return {x:"100%"};
else if(randWay == 3) return {y:"-100%"};
else if(randWay == 4) return {y:"100%"};
}
},
{x: "0%", y: "0%", ease: Linear.easeNone}, 1)
I'm trying to return both the property and value as one as an object but does't seem to understand.
Is there a way to do this?
Many thanks
Dal1980