<button class="play-button button" aria-label="Прочитать" title="Прочитать">
<svg width="100%" height="100%" viewBox="0 0 36 36">
<path d="M 12,26 18.5,22 18.5,14 12,10 z M 18.5,22 25,18 25,18 18.5,14 z">
<animate attributeName="d" class="pause" attributeType="XML" dur="0.15s" begin="none" fill="freeze" from="M 12,26 16,26 16,10 12,10 z M 21,26 25,26 25,10 21,10 z" to="M 12,26 18.5,22 18.5,14 12,10 z M 18.5,22 25,18 25,18 18.5,14 z"></animate>
<animate attributeName="d" class="play" attributeType="XML" dur="0.15s" begin="none" fill="freeze" from="M 12,26 18.5,22 18.5,14 12,10 z M 18.5,22 25,18 25,18 18.5,14 z" to="M 12,26 16,26 16,10 12,10 z M 21,26 25,26 25,10 21,10 z"></animate>
</path>
</svg>
</button>
body{
background:bisque;
}
.button {
border: 1px #333 solid;
border-radius:4px;
background-color: transparent;
padding: 0;
color: inherit;
text-align: inherit;
font-size: 100%;
font-family: inherit;
cursor: pointer;
line-height: inherit;
width: 100px;
height: 50px;
position:fixed;
left:calc(50% - 50px);
top:calc(50% - 25px);
background:darkorange;
}
.synth-controls .button {
height: 100%;
position: relative;
}
.play-button,
.next-button,
.prev-button {
box-flex: 0;
flex: 0 0 auto;
box-flex: 0;
flex: 0 0 auto;
flex: 0 0 auto;
}
.synth-controls .button {
cursor: pointer;
opacity: 0.9;
display: inline-block;
width: 34px;
transition: opacity 0.1s cubic-bezier(0.4, 0, 1, 1);
transition: opacity 0.1s cubic-bezier(0.4, 0, 1, 1);
overflow: hidden;
z-index: 2147483647;
}
.synth-controls a {
color: inherit;
text-decoration: none;
transition: color 0.1s cubic-bezier(0, 0, 0.2, 1);
transition: color 0.1s cubic-bezier(0, 0, 0.2, 1);
outline: 0;
}
.synth-controls svg {
pointer-events: none;
fill: #685483;
}
.synth-controls .button:hover svg {
fill: #ad0000;
filter: drop-shadow(1px 1px 1px #ffffff);
}
const Button = document.querySelector('.play-button');
const BtnPath = Button.querySelectorAll('svg path *');
Button.addEventListener('mouseenter',
function(event){
event.preventDefault();
event.stopPropagation();
aCls(Button,'active');
BtnPath[1].beginElement();
Button.ariaLabel = Button.title = 'Пауза';
});
Button.addEventListener('mouseleave',
function(event){
event.preventDefault();
event.stopPropagation();
rCls(Button,'active');
BtnPath[0].beginElement();
Button.ariaLabel = Button.title = 'Прочитать';
});
function aCls(e,c){
if(e.classList){
e.classList.add(c);
}else{
e.className = c;
}
} //добавить класс
function rCls(e,c){
if(e.classList!==null){
e.classList.remove(c);
}else{
e.className = e.className.replace(c, "");
}
} //удалить класс
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.