Transition/transform/translate3d in CSS3 may lead to significant flickering on the initial or final "frame" of the transition (specifically on an iPad)

Hello everyone,

I am currently developing a web application specifically for the iPad and I have implemented a CSS3 transition to animate a div, moving it from left to right.

Here is the structure of my class:

.mover {
    -webkit-transition:all 0.4s ease-in-out;
}

Upon clicking a button, the following code is executed:

var newPosition = "translate3d(" + newPosition + "px, 0, 0)";
$('.mover ').css('-webkit-transform', s);

The animation works perfectly fine except for one issue – there is a noticeable flicker the first time the user triggers the transition.

Although I understand that using translate3d may not be necessary since I am only shifting the div horizontally, I believe it forces GPU acceleration on the iPad. Can someone confirm this for me?

Thank you in advance!

[UPDATE]

To clarify about the "flicker" issue – through various experiments with CSS3 transitions on the iPad, I consistently observe a distinct flicker at the beginning or end of the animations.

In essence, the transitions themselves are extremely smooth. However, depending on specific settings, there is a visible flicker just before or after the transition occurs.

For instance, when working with three stacked PNG images, the bottom image has an opacity of 1.0, while the top two have an opacity of 0.0. Utilizing -webkit-keyframes, I achieve seamless fading transitions in between the photos. Yet, as the animation concludes, the bottom photo experiences a brief flicker. It appears as if the browser needs to redraw/re-render the screen, resulting in a slight delay.

This flickering greatly impacts the overall effect and renders the transitions unusable. While barely noticeable on my iMac, it is prominent on the iPad.

Answer №1

I encountered a similar issue and managed to find the solution right here on Stack Overflow: iPhone WebKit CSS animations cause flicker

The fix is quite straightforward:

-webkit-backface-visibility: hidden;

and possibly

-webkit-perspective: 1000;

Add these to each animated object. It resolved the problem for me, hopefully it works for you too.

Answer №2

Greetings,

While I cannot guarantee that this solution is foolproof (especially since the flicker itself can be quite unpredictable), based on personal experience, it appears to address the issue...

Here's what worked for me:

.mover {
    -webkit-transition:all 0.4s ease-in-out;
}

var s = "translate3d(" + newPosition + "px, 0, 0)";
$('.mover ').css('-webkit-transform', s);

Upon initial execution, I noticed a flicker before the animation kicked in. However, subsequent calls ran smoothly without any hiccups.

My interpretation was that setting the 3d coordinates prior to initiating the animation helped eliminate the flicker. The first call establishes these coordinates, ensuring seamless animations with subsequent calls.

Therefore, I made sure to set the 3d coordinates of the element at the beginning (during initialization) before triggering any animations.

By taking this approach, any 3d animations now start from established coordinates, effectively preventing flickering.

While I can't guarantee universal success, this method has proven effective for my current projects.

Best of luck!

Answer №3

Our team managed to eliminate various issues with flickering and fonts by adjusting the viewport settings.

In the past, we encountered problems with content extending beyond the screen (a sliding div), causing the device to struggle when the viewport was not stable. It had difficulty handling data outside the visible area while dealing with the zoom feature of the displayed content.

Adding this meta tag in the head section proved to be the solution to our challenges.

<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">

Answer №4

Give it a shot

.mover {
    position:absolute;
    -webkit-transition:-webkit-transform 0.4s ease-in-out;
} 

However, my understanding is that this compels the iPad to utilize GPU acceleration

Both translate() and translate3d() generate stacking context and could potentially utilize layers - texture buffers in relation to GPU. Thus, I believe they may not have a significant impact on acceleration.

Answer №5

div { -webkit-tap-highlight-color: rgba(255, 255, 255, 0); }

Upon observation, I found that when adding a hover state to a div, the page would flicker inexplicably, even without any attached CSS or JS. Without seeing your HTML code, this tip might be useful in resolving the issue.

Answer №6

After struggling with a similar issue, I attempted all of the suggestions provided in this thread. What finally resolved the problem for me was realizing that the z-index values of the elements were causing the flickering.

In my case, I had three panes arranged in a specific way: one flat middle pane flanked by two angled ones like this \_/. The middle pane kept flickering because its z-index was either equal to or higher than the side panels. Once I moved it to the bottom on the z-axis, the flickering completely disappeared.

Just wanted to share in case anyone else encounters the same issue.

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

"Border-radius becomes less prominent on pointer interaction in Chrome and Safari due to WebKit's behavior

Having an issue with a list inside a div. The problem arises when there is a div containing a list, which limits the visibility of items for users. If the limit is exceeded, a scroll bar appears inside the div to allow users to see more items. Additionally ...

Locate an original identifier using Selenium WebDriver

In search of a distinctive identifier for the "update profile picture button" on my Facebook account to utilize it in automation testing with Selenium WebDriver and Java. I attempted driver.findElement(By.className("_156p")).click();, but unfortunately, i ...

Saving the content of a div as a PDF

There are several aspects to consider when it comes to this question, but I'm having trouble finding the information I need. Hopefully someone can provide an answer. Essentially, what I want to achieve is: Imagine a div that is 400 X 400 px in size. ...

Removing the Shadow from Material UI's Dialog Box

I am currently struggling with the Material UI dialog component that displays information about a location marker. My issue is with disabling the unattractive box shadow that surrounds the component. Despite setting box-shadow: none and trying different so ...

Using the technologies of .ajax along with jquery, we can create a seamless experience by

I am facing an issue where the images I upload using .ajax jquery are still being uploaded even after ajax finishes. The load event that is triggered afterwards loads the same images again, causing me to have to refresh multiple times before getting the co ...

Modifying the title of a webpage with a Bootstrap design

As a newcomer to HTML/CSS, I recently utilized a Bootstrap theme from Themezy to build my personal website. The template includes a navigation bar with tabs labeled Top, Work, Portfolio, and Contact. I felt the need to change Top to About, so I replaced ...

Horizontal SWF's are providing spaces of white in between them

I'm struggling with removing the white space between SWFs on my HTML page. I've tried using 'block' in CSS, but it's not working for a horizontal layout. Adding "0" for the border hasn't helped either. I'm getting frustr ...

The styles are not being rendered on the Angular application

I have successfully implemented a Modal service with working HTML/CSS (Check it out on StackBlitz) div.cover { align-items: center; background-color: rgba(0, 0, 0, 0.4); bottom: 0; display: flex; justify-content: center; left: 0; ...

Update the href attribute with values from the form fields

My current project involves creating a form with 5 input fields: Service type Number of days Number of children Number of adults I want to dynamically change the value of a button based on these variables using JavaScript. Here is my code so far: JS ...

Error: Property 'html' is undefined - AJAX response must be displayed only in a specific div

I encountered an issue: Uncaught TypeError: Cannot read property 'html' of undefined I am working on implementing a voting system for each video on my webpage from a database. I have successfully integrated it using AJAX, but the problem is ...

Resizing the Vue page to fit the viewport and using Flexbox to anchor the footer to the bottom

My Vue.js page structure consists of a navigation bar, main body content, and a footer: <template> <div class="flex_container"> <div class="container_navigation"> <nav-bar /> </div> < ...

Utilize CSS Grid to adjust the size of an image

Hi there! I'm currently working on resizing an image using a CSS grid layout. Here's the CSS code I have so far: /* Reset */ * { padding: 0; margin: 0; } html { height: 100%; background-image: url("/assets/images/background.p ...

Toggle the font weight in a text area by clicking a button

I need help with creating a button that will change the font-weight to bold when clicked and then revert back to normal when un-clicked. However, I only want the specific part of the text area where the user clicks the button to be bolded, not the entire t ...

.htaccess file is causing js and css files to not load

I followed an MVC tutorial by howcode on YouTube, but I encountered an issue where my CSS and JS files were not loading due to the htaccess configuration. .htaccess file: RewriteEngine On RewriteRule ^([^/]+)/? index.php?url=$1 [L,QSA] I attempted vario ...

The image source is visible in Vue.js, but unfortunately, my picture is not showing up

Below is the code and script that I have: <template> <div class="tasks_container"> <div class="tasks_content"> <h1>Tasks</h1> <ul class="tasks_list"> ...

Transfer the raw file information from an input of type=file via an AJAX request

Below is a simple form that I have created: <form enctype="multipart/form-data" id="imageupload"> <input name="files" type="file" /> <input type="button" value="Upload" /> </form> My goal now is to send all the files using a ...

Position the SVG next to the link text in a Bootstrap navbar brand

I am using the .navbar-brand class from Bootstrap to include an SVG in my navbar. However, I want to display text next to the SVG and align it properly. The SVG and text are currently in the navbar but they are not aligned correctly. Below is the code snip ...

What is the best way to display a loading screen while simultaneously making calls to multiple APIs?

I'm currently working with Angular 8 to develop an application that retrieves responses from various APIs for users. The application is designed to simultaneously call multiple APIs and I require a loading indicator that stops once each API delivers a ...

Client-side validation with Jquery is failing to function properly

Currently, I am experimenting with the jquery.validate.unobtrusive.js plugin to dynamically generate form fields. Here is an example of how I'm creating a textarea field: var message = $("<textarea id='test'></textarea>"); $(mes ...

Can someone provide assistance on how to add an icon to a button?

Help needed with adding icons to buttons! I am new to coding and struggling with adding icons to each button. If any classes need to be changed, please let me know. I am currently learning HTML and CSS and could use some guidance. Thank you! Example: ...