Jump to content
Search Community

Soft floating/hovering tween effect

MDiddy test
Moderator Tag

Recommended Posts

Hey everyone

 

I'm Trying to nail down a tween for an effect and I could use a little help. Basically, I'm trying to get an effect similar to a snow globe where a flake would slowly fall slighty influenced by wind. The wrinkle is that my flakes are buttons and have to generally stay where they area but instead just hover and spin and all axis.

 

I've also been trying to create a randomized that will get a point that's unique where the shapes don't overlay within a circle. I've got the randomized working to get a random point inside a circle but the returned points just dont seem random enough as they frequently overlap. Any thoughts on either issue are really appreciated.

 

Thnk you!

Link to comment
Share on other sites

I'm Trying to nail down a tween for an effect and I could use a little help. Basically, I'm trying to get an effect similar to a snow globe where a flake would slowly fall slighty influenced by wind. The wrinkle is that my flakes are buttons and have to generally stay where they area but instead just hover and spin and all axis.

 

Have you tried doing an x/y bezier or bezierThrough tween to random points within a range around your button?

 

I've also been trying to create a randomized that will get a point that's unique where the shapes don't overlay within a circle.

 

Create a randomized what? And where what shapes don't overlap? What is defining the shapes? I don't understand the explanation or objective, sorry.

Link to comment
Share on other sites

Very sorry I probably shouldn't try to articulate questions that late at night. Thanks for bezierThrough suggestion. I'll do some experiments to see if I can get a satisfying effect.

 

For my randomizer question, I know this is outside of the scope of TweenMax but I figured someone may have had to do something similar when creating an animation. I need to get random unique points inside of a circle to don't overlap any other shapes inside the circle. The shapes will be snowflakes all the same default size, but may be slightly scaled/blurred depending on their depth. I can get random points inside a circle using this:

 

public static function getRandomPoint(radius:Number):Point {
                           // fetches a random point within this circle radius
                           var p:Point = new Point();
                           var a:Number = (Math.random()*360);
                           var r:Number = (Math.random()*radius);
                           p.x = Math.cos(a * Math.PI/180) * r;
                           p.y = Math.sin(a * Math.PI/180) * r;
                           return p;
                  }

What I can''t seem to figure out is how to ensure that the random points aren't too close to each other. I figured I could iterate through an array of points and check each new random point against the array but I can't wrap my head around how I need to set it up. Hopefully that's a little easier to understand. Had my morning coffee :)

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