0

Hope So All Of You are Fine.

I have an assignment in which i have to animate some image to a circular div container at its any random place.

Right Now, I had done this Already.

jsfiddle.net/f4p6b/137

But The Problem is that the Container in jsfiddle is not Circular.

I want a Circular div container and image should drag/animate automatically on page load at some random place every time.

Kindly help me with the help of above jsfiddle code.

Thanks.

2 Answers 2

0

Add the following css property to make your container circular

border-radius: 50%; 
Sign up to request clarification or add additional context in comments.

1 Comment

But Problem is that , The Image also animate to outside the circular div.
0

As mentined above, you can add the border-radious:50% attirubute to make your Div circular.

Check out this JSFiddle:

http://jsfiddle.net/internetbird/f4p6b/139/

Check out this updated fiddle :

http://jsfiddle.net/internetbird/f4p6b/141/

I added a function which produces a random point inside the circle (with a little math, which you can find more explination here: Simplest way to plot points randomly inside a circle )

2 Comments

But Problem is that , The Image also animate to outside the circular div.
You want to make all of the 4 values (min/maxX , min/maxY) inside the container circle?

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.