Движение circle в HTML5 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Движение circle в HTML5

В уроках написано, что при помощи cx или cy, будет осуществляться движение круга по экрану, но при запуске подобной программы, круг стоит на своём месте это баг? или под словом «движение» имеется что-то иное?

14th Oct 2021, 10:00 PM
Матвей Барканов
Матвей Барканов - avatar
4 Answers
+ 2
Матвей Барканов <svg width="2000" height="2000"> <circle cx="80" cy="80" r="50" fill="green" > <animate attributeName="cx" from="80" to="250" dur="5s" repeatCount="indefinite" ></animate> </circle> </svg>
14th Oct 2021, 10:50 PM
Abhay
Abhay - avatar
+ 1
Which lesson and what code ? And yes you can use "cx" and "cy" to move a circle. To be specific it won't actually move the circle but create new circles and in the process you will need to clear the previous circle which will give it the effect of moving . Какой урок и какой код? И да, вы можете использовать «cx» и «cy» для перемещения круга. Чтобы быть конкретным, он на самом деле не перемещает круг, а создает новые круги, и в процессе вам нужно будет очистить предыдущий круг, что даст ему эффект движения.
14th Oct 2021, 10:24 PM
Abhay
Abhay - avatar
+ 1
<svg width="2000" height="2000"> <circle cx="80" cy="80" r="50" fill="green" /> </svg>
14th Oct 2021, 10:27 PM
Матвей Барканов
Матвей Барканов - avatar
+ 1
Ok i thought you were talking about canvas. My answer was based on that. You can use animate tag to move circle in svg. I will put one example here in few mins.
14th Oct 2021, 10:40 PM
Abhay
Abhay - avatar