In the MDN animation documentation, it mentions a type of animation known as "discrete". Can you explain what this term signifies?
In the MDN animation documentation, it mentions a type of animation known as "discrete". Can you explain what this term signifies?
Discrete animations move directly from one keyframe to the next without any blending.
Imagine it as a simple image transition - one frame followed by another. Blending, or interpolation, smooths out the movement between these main frames (using mathematical formulas in computer graphics).
In traditional hand-drawn animation, the lead artist would create the keyframes, while a secondary artist would create the intermediary frames.
Therefore, discrete animation is akin to hand-drawn animation minus the intermediate frames typically drawn by an assistant.
This indicates that the property can be used for animations, but it will instantly switch states when the value changes without any smooth transition between values.
On the other hand, the MDN documentation describes another type of animation called "Not animatable", where the property cannot smoothly transition between different values even when used in animations.
For example, imagine you have an emoji that you want to make disappear after one second of hovering over it.
Using visibility: hidden;
will achieve the desired effect.
.ball {
visibility: visible;
}
.ball:hover {
animation: hide 1s forwards;
}
@keyframes hide {
to {
visibility: hidden;
/* display: none; */
translate: 100px;
}
}
<div class="ball">⚽</div>
However, using display: none;
in this scenario does not work as expected.
.ball {
display: block;
}
.ball:hover {
animation: hide 1s forwards;
}
@keyframes hide {
to {
/* visibility: hidden; */
display: none;
translate: 100px;
}
}
<div class="ball">⚽</div>
This discrepancy is due to the nature of the
<a href="https://developer.mozilla.org/en-US/docs/Web/CSS/visibility#formal_definition" rel="nofollow noreferrer">visibility</a>
property being suitable for discrete animations while the <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/display#formal_definition" rel="nofollow noreferrer">display</a>
property is not intended for smooth transitions.
Update: It's worth noting that there may be changes coming soon regarding the transitionability of the display
property based on the recent announcement from Webkit. Even though changes are expected, the core concept remains the same.
Currently, I am utilizing Vue.js and SCSS along with PrimeVue and Element plus, where I am importing their variables. My objective is to dynamically change the theme color. In my dark-variables.scss file, I have defined various color variables for differe ...
How can I highlight the active tabs and shift it when clicking on another link? $(function() { $('.nav ul li').on('click', function() { $(this).parent().find('li.active').removeClass('active'); $(this).a ...
Is it possible to modify the font-family of the title attribute in an input field using either JavaScript or jQuery? <input type="text" title="Enter Your Name" id="txtName" /> ...
Is there a way to target the first child of a span after a specific HTML tag? Here is an example of my markup: <div class="gad-help"> <a href="#">AdWords Guide<br><span>ensure best results</span></a> </div> H ...
I'm attempting to align the final image on the right side of the page in order to achieve a symmetrical look. The code I have been using in FTL is as follows, but it consistently ends up next to the middle section: <table class="h ...
I'm having a hard time figuring this out for some reason. I need to center both text and an image on the same line within a div that has a 100% width. Check out this jsfiddle link for reference: http://jsfiddle.net/JnbeJ/ ...
As I delve into HTML and Javascript, I am facing a challenge with resizing an image based on the window size. The goal is for the image to occupy the entire window while maintaining its aspect ratio during resizing. Additionally, if the window size exceeds ...
I'm currently using Bootstrap 5 and facing an issue with getting text centered vertically on the page. I attempted to make the container of the div take up 100% of the page by using h-100, but it resulted in overflow due to the navbar occupying some s ...
I'm currently facing an issue where the scroll bar is not appearing on my page when more elements are added. In addition, I have a modal that covers the entire page when clicking on an item. However, changing the CSS position: fixed property affects ...
Is there a way to make my video play on loop like a GIF without the controls ever showing? I want it to have a seamless playback experience. Any ideas would be appreciated. P.s. Don't worry about any StackOverflow errors when running the snippet. Than ...
Currently working on a web app using HTML, CSS, JavaScript, and AngularJS. Progress so far includes a clickable box that triggers a javascript function to display more boxes upon click using ng-click. <div ng-click="!(clickEnabled)||myFunction(app)" cl ...
I'm attempting to create a layout using Bootstrap 3.2.0 with tiled divs in a single row for screens wider than 768px. The divs have heights of either 50px or 100px, controlled by the classes "home-height-single" and "home-height-double," and widths ad ...
Creating a customized WordPress options panel is an essential task. One of the key functionalities it offers is allowing users to select their preferred colors. To achieve this, I currently follow a method where I utilize a default stylesheet and then appl ...
The column-fill:auto property functions by filling one complete column before moving on to the next. .two-column { column-count: 2; column-fill: auto; } In Chrome, this behavior is consistent while viewing on screen, but when printing and encounterin ...
When using Bootstrap 5, I am facing a challenge with a video on the index page that plays beneath the navigation. I want to maintain the 16x9 aspect ratio and have centered text overlayed on the video. However, I encounter an issue when attempting to set a ...
When I try to click a link in my extension popup and open it in a new tab using "middle click -> open link in a new tab", the popup closes. Is there a way to keep the popup open so I can click on multiple links from my extension without interruption? A ...
I am currently trying to set a custom image as the cursor using jQuery in this manner $(document).ready(function(){ $("body").css('cursor','url(http://affordable-glass.com/test/penguinSm.png),auto'); }); While this method works, ...
Let's say I've included the v-text-field component from Vuetify in my Vue component as shown below: <v-text-field v-model="email" name="email" type="email" color="#90C143" label="Email"> Upon inspecting the element, it generates regular H ...
My monitoring website displays dynamic rrd graphs in png format with fixed dimensions. I am looking to adjust the layout based on browser window size - showing the graphs in 1 column if the width is below a certain threshold, and in 2 columns if it exceed ...
Here's a CSS query I have: If I have the code below, does the styling apply to the contents of v-container but not v-container itself? <v-app id="inspire"> <v-container justify-center style="max-width: 1200px"> <v-layout row ...