Animating the Position of Masks using Angular 2+

I am encountering issues with animating the mask-position property using Angular's animation library and I am seeking assistance in identifying where my mistake lies.

This method is successful:

 @keyframes maskWipe{
     from {mask-position: 100% 0;}
     to {mask-position: 0 0;}
 }

However, when attempting to implement it in Angular, the animation simply 'pops' instead of smoothly transitioning.

This is my current Angular animation code:

animations: [
    trigger('slideInOut', [
      state('slideIn', style({
        webkitMaskPosition: "0 0"
      })),
      state('slideOut', style({
        webkitMaskPosition: "100% 0"
      })),
      transition('slideIn => slideOut', [
        animate('2s', keyframes([
          style({webkitMaskPosition: '0 0'}),
          style({webkitMaskPosition: "100% 0"})
        ]))
      ]),
      transition('slideOut => slideIn', [
        animate('2s', keyframes([
          style({webkitMaskPosition: "100% 0"}),
          style({webkitMaskPosition: "0 0"})
        ]))
      ]),
    ]),
  ],

Please note that I had to use webkitMaskPosition because I am working in Chrome, which automatically converts mask-position to webkit-mask-position.

[Edit]: I forgot to remove the commented out sections.

Answer №1

Isn't it funny how solutions often come to us right after seeking help?

In any case, make sure to include the extra transition in your CSS like this

transition: mask-position 2s linear;

I'll keep this here for others who may stumble upon this post looking for an answer.

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

Adding a variable into a sentence

.xmlFieldCreator(`<Field Name="{${kRegion}}" DisplayName="{${kRegion}}" Type="Lookup" List="{${values[1]}}" ShowField="Title" Required="TRUE"/>`); Whenever I attempt to generate a SharePoint List field in this way, the output displays the field name ...

Passing a JavaScript variable to PHP resulted in the output being displayed as "Array"

After sending a JavaScript variable with the innerHTML "Basic" to PHP via Ajax and then sending an email with that variable, I received "Array" instead of "Basic". This situation has left me puzzled. HTML: <label class="plan-name">Plan name: <b ...

Exploring Validations within Nested Forms in Angular

After grappling with this issue for a month, I am seeking any suggestions or advice. In my form pages, user input data is received. These pages include a component called basa-crud-page, which utilizes Template Driven Forms. The code snippets within this ...

Simple Design Techniques for HTML Tables

I seem to be having trouble with the table styles when I include text in the <td> section: <td rowspan="3"> 30th May 2014 17:35... What could be the issue? <style type="text/css"> .tftable {font-size:12px;color:#333333;width:100%;borde ...

"Exploring ways to reattempt a route request upon encountering the $stateNotFound event within AngularUI Router

Managing a large AngularJS application can be quite challenging when it comes to splitting it into functional modules. Currently, all the modules are loaded on the initial page load as they are bundled into a single JavaScript file. However, I am looking t ...

Even when I try to access the properties of the arguments object, it remains empty and has a zero

Why is the arguments object showing a length of zero when I pass parameters to the function, even though I can still access its properties? I am referring to the arguments object that is implemented by all JavaScript functions, allowing you to access the f ...

Iterating over an array and displaying elements on the webpage

Struggling to access an array and loop through it, but only able to print out one element instead of all. Need a hint on how to solve this issue. See my code below: let toppingsCount; const burger = document.createElement('div'); const toppingsD ...

transforming array elements into properties of a React component

My text component contains the code below return ( <FormControl variant="outlined" className={classes.formControl}> <Grid container> <TextField id={props.id} label={props.label} d ...

Create an input box featuring elongated lines

I'm currently working on coding an input box that resembles the design shown in the image below. https://i.sstatic.net/Wrpo0.png However, I've encountered an issue where only part of the lines are showing up with my current code. Interestingly, ...

Fine-tuning the flexbox grid layout for various screen sizes, both big and small

Two different layouts were created. The first layout is designed for medium & large screens, while the second one is tailored for devices with a maximum width of 736px. Check out the vanilla implementation using flexbox (without mobile adaptation) Here ...

Task within a mapping function?

I am facing an issue with the following code snippet: this.array1 = this.array1.map(a => (a.name = "Harold")); It seems like there is a syntax error, and I can't figure out why. My intention is to set the "name" property of eve ...

Issue with Angular 2: Unable to download a ZIP file as a blob

It appears that the back-end functionality is working fine, as the zip file is being created without any issues: curl -X POST -H 'Content-Type: application/json' -d '{}' http://localhost:3000/zip/create > file.zip The Django back-e ...

Trouble with punctuation marks causing difficulty in obtaining address information within an Ionic Angular app

I am currently working on a project in Ionic Angular where I need to fetch and display user address details from the backend on an HTML page. The address details consist of three fields: Address line1 (mandatory), Address line2, and Address line3 (non-ma ...

The soft keyboard on Android devices may be obscured by an input field when using Cordova

When I use the text input field on my Android phone, the soft keyboard covers the input field. My app is built with Cordova and Angular 6. I have attempted the following solution: <preference name="Fullscreen" value="false" /> <edit-config file ...

What are some ways to track the loading progress of a JSON file retrieved through an Axios call?

To track progress accurately, I am contemplating implementing the following steps while making an axios call: Retrieve file size during the json file request Determine the percentage of downloaded file size from the network tab Currently, I only have a ...

How to send JSON arrays using Yii2 with Ajax

Utilizing the Yii2 framework, I am in search of a way to transfer an array containing the person's ID along with an array of group IDs from the client side to the server. The data is obtained from a Select2 component using jQuery. Subsequently, the s ...

Transferring data from AJAX to PHP

I am currently developing a project in PHP. I have created an associative array that functions as a dictionary. Additionally, I have a string containing text with placeholders for keys from the array. My goal is to generate a new String where these key wor ...

Strange Firefox behavior with absolutely positioned div and percentage height

One of my projects includes a CSS modal dialog that is structured as follows div { position:fixed; top:50%; left:50%; margin:-26% 0 0 -26%; width:46%; height:46%; padding:3%; } Interestingly, this div appears centered in webkit browsers. Ho ...

The issue with Cypress AzureAD login is that it consistently redirects users away from the intended Cypress window

Trying to incorporate the automation of Azure AD login using Cypress, I have been facing some challenges. Even after configuring the local session storage according to the instructions in this GitHub repository https://github.com/juunas11/AzureAdUiTestAu ...

Navigate to the Vuejs component's element that has a specified class name

When a component is loaded, I want it to automatically scroll down to display the element with a class name of 'actual-month' within an unordered list. <b-card no-body header="<i class='fa fa-align-justify'></i> Unorder ...