SVG + JavaScript tutorial: How to Code an Animated Watch

preview_player
Показать описание
In this SVG tutorial, we are going to code a watch. Since SVG images can be inlined in HTML we can manipulate them with JavaScript. We can animate parts of an image from code, make it interactive, or turn things around and generate graphics from data. In this example, we are going to create a watch. We will use SVG to paint the watch, and use JavaScript to animate the hands and add some interaction.

0:00 Introduction
1:25 The SVG tag
6:34 Drawing minute markers with stroke-dasharray
14:51 Drawing the hour hands
17:04 Animating the hands with JavaScript
21:23 Adding a clickable calendar window
24:41 Next steps

#svg #webdevelopment #creativecoding
Рекомендации по теме
Комментарии
Автор

There's a bug in the code in this video. Can you spot it? Why doesn't it cause any trouble?

HunorMartonBorbely
Автор

Not only an excellent tutorial in terms of content presented, but also beautifully produced and narrated.

christaylor
Автор

hunor!! Great and Advanced as usual, Am totally ready for all the maths and physics you're chopping this year.. wishing you a wonderful 2022 Hunor!

stanleychukwu
Автор

Great tutorial! If you want to keep your HTML super clean you can move the script element to the head and add a "defer" attribute. It has the same effect as it loads the script but executes it only after the DOM was parsed.

pxlbltz
Автор

Hi Hunor do you plan any video in the next coming month ?
I really appreaciate your video on three.js
Cheers

decathlonjuste
Автор

Question - if the animate function is called recursively, will the browser able to detect the click event of the txt . the toggle works in Chrome, but in Safari the txt toggle click event is not getting called as the animate function is running. any comment ?
btw thanks for this video @HunorMartonBorbely

johnvarghese
Автор

Video very interesting, but it’s a pity that the audio is very low

eugeniogonzato
Автор

is is possible to export the animation as video?

tmawn
Автор

Hey Hunor glad to hear you again ?
Do you have some project in mind for this channel ?
May I suggest you some idea for future video ?
but I think it could be a good video to make a small game Like an M.C. Escher-inspired maze with three.js
keep it up

soniamaklouf
join shbcf.ru