css3 - CSS animation moving and changing color -
i not familiar css animations. client want achieve the following result when hovering contact
button:
so clear:
- the square's move left right , vice versa
- when square moves, line underneath changes color
the top image start state, middle during effect (50%) , bottom image end stage.
is achievable css or need js well? how approach this?
i created quick , dirty jsfiddle here: https://jsfiddle.net/x0b397pb/
as can see, possible css. in example used pseudo elements (::before
, ::after
) create of elements.
you mentioned "im not familiar css animations". for used transitions.
transition: left 1000ms, right 1000ms, box-shadow 1000ms;
each comma separated element value transition between 2 points. transition happens on change of div, can on hover, when applying div (through js).
to created effect of lines gradually shifting in color used element slides on top of original 2 lines. new lines have 0 width, on hover gain 100% width. transition transition: width 1000ms;
happens gradually.
try not use code final example, ugly. hope gets point across.
Comments
Post a Comment