Python 3D Graphics Tutorial 18: 3D Clock Animation with Proper Hand Motion

preview_player
Показать описание
You guys can help me out over at Patreon, and that will help me keep my gear updated, and help me keep this quality content coming:

In this video we show step-by-step instructions on how to build a 3D clock face model in Vpython. We will animate the clock in this lesson, with second, minute and hour hands. We then how to show how to make it keep accurate time by synchronizing with your system clock time. We will also create proper hand motion with the hands move incrementally between integer time values.

#Python
#Lessons
#Vpython
Рекомендации по теме
Комментарии
Автор

I Am Legend. Another assignment I thought I was going to crash a burn on. Didn't think about it until I was at work the next day. Came up with the solution to it on paper, got home, coded it up and it worked a treat! Thanks again!

Mr.Java
Автор

Paul, thanks so much for all of your wonderful videos. I know what an immense chore it can be. And yes, there are some of us who have no interest in cute cat videos or silly prank videos, and vastly prefer excellent tech content like yours. Thanks much.

EETechStuff
Автор

I love this clock! Thank you for the lessons!

louistoweill
Автор

I am legend. Took less then 10 mins to get both hands moving smoothly. I don't know if this was easy or I am getting better.

petefontana
Автор

I AM LEGEND! I racked my little brain trying to figure out the exact perimeters. Crashed an burned a few times.
Returned with the new knowledge.
and FINALLY figured out how to do this.
Living Struggle.. but it felt amazing when I found a solution.


Hind Sight 20/20 - I way over thought the problem.
Ended up calculating a slope for the degrees over time.
It works but your solution is much more elegant :)


Thanks Again Paul, all your material and lessons are truly a GEM.

NOS
Автор

You made the smooth clock assignment easy by your example from last week. I am Legend.

floridian
Автор

I am legend 👍loving these videos, great job sir

garethhunt
Автор

1/2 Legend! Minute hand behaves as expected, but hour hand seems to have a mind of its own, Sort of like herding cats!

codecage
Автор

Dear Paul,
Referring to your program, it seems that
lines 48 and 49 are not needed, because this is an analog clock.
In lines 52, 53 and 54 you added np.pi/2. I think this is
also not needed, because the clock hasn't to start at 12 o'clock,
but at actual time of the pc. Please tell me if this is correct.
In my solution for the homework, the link to which is in the
comments of lesson 17, the sum of all the seconds
and their fractions is used to calculate the three angles.
This causes that the seconds hand also moves smoothly.
while True:

misSegundos=miHora[5]
misMinutos=miHora[4]
misHoras=miHora[3]
sInc=time.time()%1 #the remainder of the number of seconds
#divided by one is the value at the right of the decimal point.

sAngle=totalS*2*np.pi/60
mAngle=sAngle/60
hAngle=mAngle/12
#instead of a negative value of the angle, I swap sin and cos.
sHand.axis=vector(sHandL*np.sin(sAngle), sHandL*np.cos(sAngle), 0)
sHand.length=sHandL
mHand.axis=vector(mHandL*np.sin(mAngle), mHandL*np.cos(mAngle), 0)
mHand.length=mHandL
hHand.axis=vector(hHandL*np.sin(hAngle), hHandL*np.cos(hAngle), 0)
hHand.length=hHandL

MrElFRanz
Автор

Another great video, Paul. Thanks!! I’ve fallen a little (a couple lessons) behind with the homework. “Too many irons in the fire” here. I’ll be catching up soon.😊

leeg.
Автор

I did this for the homework for lesson 15. Thanks

kenstephens
Автор

great video, new to python but enjoying your videos

alistaircook
Автор

I choose the impossible method and did it !!

ritwikkaushik
Автор

I have a question unrelated to the topic What do you think about the topic of Facebook virtual reality

danny
Автор

Working well now, except still haven't figured out why my second hand doesn't align with the tick marks except at 12, 3, 6, & 9. The minute and hour hands seem to align perfectly.

codecage
Автор

I am legend, not so elegant maybe but result was the same.

jansimurda
Автор

Decided to make a clock class/module so we can display multiple clocks

keithlohmeyer
Автор

And here is my try to make something different - cuckoo clock.
Realtime testing is really hard and I cannot figure out how to make cuckoo go back to the house at the and of the cycle

jansimurda
Автор

I think that I am a legend but my code is just a bit different

yusufguler