How can animate a ball rotating 180 degrees like a half circle?

i am trying to make that using atan2 to calculate the angle and get the animation but i am a little confuse how can make that using the blocks of the ball

image

The atan^2 function returns an angle, not the length of a side.

i am trying now to use only degrees and not radians

so i need to store the angle and next apply the angle to the ball?


tan(BAC) = BC/AC
=> BC = AC * tan(BAC)
Since it's a right-angled triangle, AB^2 = AC^2 + BC^2.
r^2 = AC^2 + AC^2 * tan^2(BAC) [where r is the radius of the circle]
r^2/(1+tan^2(BAC) = AC^2
AC = sqrt(r^2/(1+tan^2(BAC)))

Plug in this value of AC into the definition of tan(BAC) to get BC. AC + the x-coordinate of the center is the x-coordinate, and BC + the y-coordinate of the center is the y-coordinate (assuming the diameter line drawn is perpendicular to the base).

1 Like

Try this:

ballrotatehalfcircle.aia (2.6 KB)

1 Like

thanks its working but i have other problem with that

image

when i use the drawline every movement mark drawline are draw the line with black but my problem is that only i will like to get one line no every position with a line its possible make that? that only draw one line ?

using other examples i am trying to make that like this but its not working

image
movimientopelota.aia (3.3 KB)

Do you want to draw just the arc the ball follows or the complete half circle ?

i like to draw only one line rotating using 2 balls. i am trying using the block drawline but the drawline is drawing in every point in the rotating a new line getting a half life painting black like a half circle painted in black. no just one line display rotating. how can get only one line?

Why two balls ?

If you mean like this:

image

then:

two balls because i like to get a line between two balls. no the half circle drawing, i will like get like gauge line

Draw me a picture of what you want.

You have deviated considerably from the original question...

descarga

i will like the black arrow. a line between two balls

I have got it this far (it completes the half circle)

image

Are you trying to make a gauge of some kind? If so, the approach is quite different, and why not say so in the first place, there are already many examples available.

1 Like

ok thanks but its possible make that? using 2 balls and draw only one line? an animate a gauge using the line between the balls?. and where is there other examples?. please help.

Some of them:

MIT App Inventor Gallery

App inventor Gráficos estadísticos con Google Chart. Tarta. Líneas. Barras. Pie. Bars. Line. (kio4.com)

but using 2 balls its not possible?. because i am trying to make a animation movement legs body using lines between balls like joints

Why a half circle ?
Why a gauge type approach?

Explain and show what you are trying to achieve...

i am trying to make this


using the balls like a animation mathematics