Použití vendor prefixů pro vytváření animací v LESS
Vytvořme funkci, která implementuje
mezi-prohlížečový příkaz @keyframes:
.keyframes(@name, @code) {
@-o-keyframes @name {@code();}
@-moz-keyframes @name {@code();}
@-webkit-keyframes @name {@code();}
@keyframes @name {@code();}
}
Použijme naši funkci:
.keyframes(anim, {
from {
width: 100px;
}
to {
width: 200px;
}
}
);
Výsledek kompilace:
@-o-keyframes anim {
from {
width: 100px;
}
to {
width: 200px;
}
}
@-moz-keyframes anim {
from {
width: 100px;
}
to {
width: 200px;
}
}
@-webkit-keyframes anim {
from {
width: 100px;
}
to {
width: 200px;
}
}
@keyframes anim {
from {
width: 100px;
}
to {
width: 200px;
}
}