Hi guys,
I’m have some trouble getting the rotations of my meshes just right. I would like the mesh to rotate to a limit within a range. Then get a new random limit in the opposite direction and continue on like this into infinity. Basically, I want to make the mesh “Wiggle”:
window.setInterval(function(){wiggle(letter_p)}, Math.random() * 5000);
function wiggle(mesh)
{
if (mesh) gsap.to(mesh.rotation,
{
duration: "random(1.0,2.0)",
x: "random(-1.0,1.0)",
y: "random(-1.0,1.0)",
z: "random(-1.0,1.0)",
})
};
This works, but with issues. First, the mesh rotates too much. I would prefer if the mesh only tilts slightly from side to side, so that it is never actually on it’s side or upside down or backside front. The other issue I have with this is that the animations to not flow into each other very nicely. I have a theory that if the animation were one continious event, the rotations would look much more natural.
So here are my questions:
How can I limit the rotations so the mesh is always facing generally forward?
Is there a better way to fire the event off once, and have it continue fluidly into infinity?
Thanks