Is it possible to use an SVG mask with multiple video sources?

Wondering if it's feasible to use an SVG circle mask for various fixed video DOM elements.

https://i.sstatic.net/JzdnU.png

The goal is to have each SVG circle mask a separate video on different layers, then scale up to fit the browser height and width.

I've experimented with multiple code samples, so sharing code here won't make much of a difference. Just seeking guidance on whether this is technically achievable and where to start exploring.

Answer №1

For achieving that effect, you can utilize the clip-path property in the following manner:

video {
  width: 320px;
  height: 240px;
  clip-path: circle(20%);
}

video.full {
  width: 100%;
  height: 100%;
  clip-path: none;
}

.hide {
  display: none;
}

Check out this link for a demo: https://jsfiddle.net/deaxfcbk/

If you open the provided example and click on a video, it will expand to fill the designated area while maintaining its aspect ratio, with other videos getting hidden. Another click will turn it into a circle shape.

You have the flexibility to include multiple videos, toggle controls visibility, play them in full screen mode, and more.

I trust this information is useful :)

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Multiple card displays not working with Javascript Fetch API

I wrote a script that retrieves data from a URL and then organizes it into tables for display to the user. Initially, the script functioned correctly. However, I decided to enhance its flexibility by introducing two parameters - name and HTML div name wher ...

Angular: Image files could not be loaded due to a 404 error (Not Found)

After downloading this free theme, I tried to use it in my Angular project within WebStorm. However, I encountered this error message: Failed to load resource: the server responded with a status of 404 (Not Found) and despite having the correct path, ...

menu featuring a creative favicon and an accompanying label

I am aiming to replicate this menu design: It consists of a flavicon with a label below it. Menu I attempted to create it in two different ways, but both attempts were unsuccessful. Using Bootstrap groups. <link rel="stylesheet" href="https://u ...

Stop using Flexbox in Material UI on small screens

How can I prevent Flexbox from functioning on small screens using Material UI? I am looking for something similar to the d-md-flex class in Bootstrap but for Material UI. In Bootstrap (works as expected) <div class="d-md-flex align-items-md-center ...

The feature of Google street view is not supported within the tabs on WordPress

I'm experiencing some issues with displaying Google maps and street view using the Wp Google Map WordPress plugin within tabs. The map displays perfectly on the first tab where I placed the short code for the map, but on the second tab where I placed ...

I am looking to add some flair to my ID "checkimg" using JavaScript

JavaScript if ((valid1 && valid2 && valid3 & valid4 && valid5 && valid6 && valid7 && valid8)==1) { // include an image in the specified ID. document.formElem.next1.disabled=false; } else { docume ...

Tracking the progress of reading position using Jquery within an article

Here is an example of a reading progress indicator where the width increases as you scroll down the page: http://jsfiddle.net/SnJXQ/61/ We want the progress bar width to start increasing when the article content div reaches the end of the article c ...

Efficiently adjust the width of a child div to automatically fit within

I stumbled upon this fascinating jsfiddle on this website that almost completely addresses my concern, solving up to 90% of it. Check out the JSFiddle Nevertheless, I am keen to incorporate margins within the inner divs. Despite attempting to modify the ...

Emulate the CSS hover effect with jQuery 코드 희미한

Is there a method in jquery or any other technology that can detect event X and trigger a different event elsewhere? Currently, I am working with an image that has an image map. When a user hovers over a specific area on the map, I would like another part ...

Tips for positioning a mat-form-field beside an h1 tag

I've been attempting to place an h1 next to a mat-form-field from Angular Material, but I'm encountering some difficulties. Here's what I've attempted so far: <div class="mat-elevation-z8"> <mat-form-field> <mat-l ...

The orientation of the rating stars has transformed into a vertical layout

I'm having trouble creating a rating interface that prompts the user to rate the website (by clicking the stars) and leave a comment. The stars are displaying vertically instead of horizontally, as shown in the image provided in the link. I've tr ...

What strategies can I use to include multiple spans within div elements without causing the code to become overly lengthy?

I'm working with 20 spans representing movie genres, each accompanied by another span that "closes" the genre when selected. The closing span has an .active class, similar to this example: https://i.sstatic.net/7CuuX.png My version currently looks li ...

CSS for Positioning Elements Side by Side Using Absolute Positioning

I'm having trouble figuring out how to position balloons like the ones shown in this image: <div class="red_frame"> <img src="https://i.sstatic.net/54SMF.png" class="r_over"/> <img src="https://i.sstatic.net/54SMF.png" ...

Placing <IconButton> at the bottom right of <Paper> using React and Material UI without utilizing FAB

Issue: I'm working on implementing a react/material-ui design where I want to show an edit icon floating in the bottom right corner of a paper element. I've managed to get it to float in the bottom right of the entire screen, but that's not ...

What could be causing the hover effect to malfunction in this code snippet?

I have been working on creating a hover effect for a list of items where an underline emerges from the center. While I have done something similar in the past, there seems to be an issue preventing it from working properly this time. I have included the HT ...

Tips for creating spacing between an image and a button when utilizing the routerLink feature in CSS

To enhance the user interface, I've utilized a routerLink with an image to navigate back to the home page, and a button to direct users to add a new customer. Now, I am aiming to create some space between these elements. Previously, I used "& ...

What steps can be taken to resolve the issue of "Uncaught TypeError: undefined is not a function"?

Check out the JSfiddle link for reference: http://jsfiddle.net/mostthingsweb/cRayJ/1/ Including my code below along with an explanation of what's going wrong: This is a snippet from the HTML header, showing all the necessary links: <head> ...

How can we use CSS and JavaScript to transform <td> elements into a visually appealing bar graph?

Is there a way to visually represent a percentage in an HTML table cell using either CSS or JavaScript? I want to create a bar graph effect next to the percentage value, and I'm unsure which method would be easier. The web page is built using a combin ...

The images on iPad2's Safari browser are appearing blurry due to low-quality

I'm encountering some challenges trying to display a large jpg file properly on an iPad 2. The image is 9577x600 pixels and is being used as a background image on a div. I have specified -webkit-background-size on that div and set it to the same dimen ...

Is there an alternative to using CSS units of measurement when using the .css() method?

Is there a way to use .scrollTop() and .css() to adjust the margins of an element so that it floats up only when the page is scrolled, but stops at a certain margin value? I want the element to float between specific values while scrolling. The issue I am ...