Sunday, 8 February 2015

Mouse With Moving Eyes With CSS Animation

Mouse With Moving Eyes With CSS Animation
Thinking about an animal easy to draw I came up with a mouse. A mouse is so easy: you just have to put several round shapes together, put dots in its face and here we have a mouse!

The head, the body, arms and legs, the mouth and eyes all parts are created with div elements. By using the CSS animation property you can move the eyes of the mouse. The left property values of the black dots with the id m_black_right_eye and m_black_left_eye are changed from 0px to 20px with the following syntax:

@keyframes eyemove {
from{left:0px;}
to{left:20px;}
}

The animation should go one forever so the value of the animation property is set to infinite.The black dots should go from left to right and vise versa with the value alternate.

Change the top and left value #mouse in the CSS code and position the mouse at will.

HTML and CSS Code

No comments:

Post a Comment