Animate tag, html | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

Animate tag, html

How can I do, only in html, 2 animations for one rect? Like, that a rect will move from 0,0 to 300, 100 and then move from 300,100 to 600,0? If you have to use css for this case(hey, it’s a rhyme!), tell me I checked the questions of the other sololearners, don’t be angry

12th Aug 2018, 12:03 AM
misgav yosef
misgav yosef - avatar
5 Answers
+ 2
HTML alone does nit perform animation. you need CSS animation and @keyframes to insert animation into HTML element. You didn't specific movementun x or y axis, I presume you want x axis. Here the code. div { width: 300px; height: 100px; background-color: gray; margin: 0 auto; animation: ani 10s linear 0s 1 forwards; } @keyframes ani { from { transform: translateY(0); background-color: gray; } 59% { background-color: gray; } 60% { transform: translateY(300px); background-color: red; } to { transform: translateY(500px); background-color: red; } } https://code.sololearn.com/WQwn4ki93yWB/?ref=app As long as you dont ask us silly question about numbers of seeds in an orange, we don't get angry. 🤣
12th Aug 2018, 12:25 AM
Calviղ
Calviղ - avatar
+ 3
then use svg
13th Aug 2018, 6:41 PM
Nomeh Uchenna Gabriel
Nomeh Uchenna Gabriel - avatar
+ 2
I understand your question. I refer to the question you asked before you modified your question.
12th Aug 2018, 8:30 AM
Calviղ
Calviղ - avatar
+ 2
okay. thanks you very much
12th Aug 2018, 4:02 PM
misgav yosef
misgav yosef - avatar
+ 1
thanks, but you didnt understand i want the rect to go in a ^ way from 0x 0y to 300x 100y and then to 600x 0y
12th Aug 2018, 8:05 AM
misgav yosef
misgav yosef - avatar