<svg class="svg">
<clipPath id="my-clip-path" clipPathUnits="objectBoundingBox">
<path d="M0.5,0 L1,1 H0"></path>
</clipPath>
</svg>
<div class="clipped">
<video src="./assets/video.mp4"></video>
</div>
.svg {
position: absolute;
width: 0;
height: 0;
}
.clipped {
width: 100%;
max-width: 500px;
height: 350px;
-webkit-clip-path: url(#my-clip-path);
clip-path: url(#my-clip-path);
}
video {
width: 100%;
height: 100%;
object-fit: cover;
}
async function processData(data) {
const result = [];
for (const { id, k } of data) {
result.push(k ? await api.getData(id) : id);
}
return result;
}
function processData(data) {
return Promise.all(data.map(({ id, k }) => k ? api.getData(id) : id));
}
var changeSlidePortfolio = function (e) {
e.preventDefault();
var { action } = e.target.dataset;
var slides = document.getElementsByClassName('portfolio__col');
var activeSlide = document.getElementsByClassName('portfolio__col-active')[0];
var slidesLength = slides.length;
for (var i = 0; i < slidesLength; i++) {
if (slides[i] === activeSlide) break;
var index = i;
}
var last = action === 'left' ? slidesLength - 1 : 0;
if (index !== last) {
var newIndex = action === 'left' ? index + 1 : index - 1;
slides[index].classList.remove('portfolio__col-active');
slides[newIndex].classList.add('portfolio__col-active');
}
};
<a href="#" class="portfolio__arrow portfolio__arrow-left" data-action="left" onclick="changeSlidePortfolio();"></a>
<a href="#" class="portfolio__arrow portfolio__arrow-right" data-action="right" onclick="changeSlidePortfolio();"></a>