Hi,
I'm wondering if it would be possible to randomise number AND pass it to the animation on update:
$('.dot').each(function(e){
var floatingThis = new TimelineMax({repeat:-1, yoyo: true, onUpdate: update});
var timing = Math.floor(Math.random() * 10) + 8,
posY = Math.floor(Math.random() * 90) + 0,
posX = Math.floor(Math.random() * 100) + 0;
function update(){
timing = Math.floor(Math.random() * 10) + 1,
posY = Math.floor(Math.random() * 90) + -90,
p
Yep, I'd do exactly what @MindGamer recommended. Simple example:
function random(min, max) {
return min + Math.random() * (max - min);
}
function gotoRandomPlace() {
//notice the onComplete points back to this same function, so it'll keep going to random coordinates
TweenMax.to(...{x:random(-100, 100), y:random(-100, 100), onComplete:gotoRandomPlace});
}
gotoRandomPlace();
As for vw/vh units, those aren't supported on transforms because to maximize performance, GSAP bak