Div animate | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4

Div animate

if i want to make a dive moves up and down infinte how i can do this ? svg or canvas ? also if i want to animate with svg should i make the shape with it too , is it the only way ?

26th Jul 2018, 9:31 AM
Shimaa
Shimaa - avatar
20 Answers
+ 11
It does move
17th Aug 2018, 6:40 PM
Abdiwali Mukhtar Mohamed
Abdiwali Mukhtar Mohamed - avatar
+ 6
Shimaa if you want to animate a div use css... Check one of my codes i posted css animation.. It works fine on divs Animate is used only for svg drawings
26th Jul 2018, 10:32 AM
Hermen
Hermen - avatar
+ 4
You can use any of the ways Canvas can be animated with javascript... Css works with keyframes and for svg use animate tag it's special tag to animate svg drawings
26th Jul 2018, 10:13 AM
Hermen
Hermen - avatar
+ 3
Ya'iko Lucky Luke isn't key frames for color change not moving ? and also svg where can i put it .. inside div tag ?
26th Jul 2018, 9:49 AM
Shimaa
Shimaa - avatar
+ 3
Shimaa Fikry I don't know what else your definition of "move" is
26th Jul 2018, 10:07 AM
Dlite
Dlite - avatar
+ 3
Code Your CSS codes need to be auto prefixer before all browsers can support it. Use this tool https://autoprefixer.github.io/
26th Jul 2018, 10:09 AM
Calviղ
Calviղ - avatar
+ 2
Shimaa Fikry Keyframes is used for any type of CSS animation
26th Jul 2018, 9:50 AM
Dlite
Dlite - avatar
+ 2
Shimaa Fikry You can use keyframes for changing margin values and animate the rectangle. Also, you can use svg anywhere, without plugins. See the examples in the lessons for more information. https://www.sololearn.com/learn/HTML/2200/ Here is an example of SVG Animations (works only in web version of SoloLearn) https://code.sololearn.com/WA8yPg48wxPy/?ref=app
26th Jul 2018, 9:51 AM
giannismach
giannismach - avatar
26th Jul 2018, 9:52 AM
Calviղ
Calviղ - avatar
+ 2
yah , I saw it but can't get it .. pls... can u make it here how can i make this div goes up and down for infinite .. like it floating .. https://code.sololearn.com/WONhIvaavowZ/?ref=app
26th Jul 2018, 9:53 AM
Shimaa
Shimaa - avatar
26th Jul 2018, 9:55 AM
Dlite
Dlite - avatar
+ 2
Ya'iko it doesn't move
26th Jul 2018, 9:57 AM
Shimaa
Shimaa - avatar
+ 2
It does move
26th Jul 2018, 9:58 AM
Dlite
Dlite - avatar
+ 2
Ya'iko it doesn't really
26th Jul 2018, 9:59 AM
Shimaa
Shimaa - avatar
26th Jul 2018, 10:03 AM
Calviղ
Calviղ - avatar
+ 2
Hermen Gx u mean if i want to animate with svg .. i can only animate shapes done with svg .. not other shapes ? does the div consider a shape ?
26th Jul 2018, 10:16 AM
Shimaa
Shimaa - avatar
+ 2
Shimaa Fikry @keyframes can define any css animations including moving, change color, opacity, font sizes, width, height, left, top, bottom, right locations. Use svg tag to form svg shape.
26th Jul 2018, 10:22 AM
Calviղ
Calviղ - avatar
+ 1
Simply use CSS' "@keyframes" feature
26th Jul 2018, 9:35 AM
Dlite
Dlite - avatar
+ 1
You can use either SVG animations or simple CSS3 Animations. Here are some related lessons: https://www.sololearn.com/learn/HTML/2213/ https://www.sololearn.com/learn/CSS/2253/ https://www.sololearn.com/learn/CSS/2254/
26th Jul 2018, 9:37 AM
giannismach
giannismach - avatar
+ 1
Code Ur code really doesn't move and sorry for my slow understanding I am knida new so it seems all alittle bit hard to me ..
26th Jul 2018, 10:13 AM
Shimaa
Shimaa - avatar