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 Answers2

0

Add the following css property to make your container circular

border-radius: 50%;
Aayush Gupta
  • 32
  • 1
  • 6
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 )

Community
  • 1
  • 1
Shai Aharoni
  • 1,955
  • 13
  • 25