Is there a method in CSS animations that allows for endlessly repeating successive animations in a specified sequence?

While working with CSS animations, I encountered a challenge of making two animations occur successively and repeat infinitely without merging keyframes. Is there a way to achieve this using only CSS?

If not, how can I accomplish it using JavaScript?

I attempted re-invoking the animation in the last keyframe of the second animation but found out that animating an animation is not possible.

.div{

animation: spin 1.6s ease-in-out 0s 1 normal running,
           rotate 1s ease-in-out 1.5s 1 normal running;
}

@keyframes spin {
  from {
    transform: rotateX(0deg);
  }
  99% {
    transform: rotateX(360deg);
  }
  100% {
    transform: rotateX(360deg);
    animation: spin 1.6s ease-in-out 0s 1 normal running,
               rotate 1s ease-in-out 1.5s 1 normal running;
  }
}
@keyframes rotate {
  from {
    transform: rotatez(0deg) rotatey(0deg);
  }
  to {
    transform: rotatez(-33deg) rotatey(-37deg);

      ;
  }
}

Answer №1

Why not try creating a brand new animation that fits your specific needs:

.shape{
 background:blue;
 width:150px;
 height:150px;
animation: rotate 3s ease-in-out infinite;
}

@keyframes rotate {
  0%{
    transform: rotateY(0deg);
  }
  50% { 
    transform: rotateY(180deg) rotatex(0) rotatez(0) translateX(0);
  }
  100% {
    transform: rotateY(360deg) rotatex(-45deg) rotatez(-45deg) translateY(200px);
  }
}
<div class="shape">
</div>

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

Refreshing Data on Vuetify Range Slider

My goal is to update the value as the slider position changes. [codepen]https://codepen.io/JakeHenshall/pen/WLezNg <div id="app"> <v-app id="inspire"> <v-card flat color="transparent"> <v-subheader>Tick labels</v-subheade ...

Guide on implementing iterative data path in v-for loop using Vue

I'm just starting out with Vue and I want to use image file names like "room1.jpg", "room2.jpg", "room3.jpg" in a loop Below is my code, where the second line seems to be causing an issue <div v-for="(p,i) in products" :key="i"> <img src ...

I'm having trouble sending a string to a WCF service using jQuery AJAX. What's preventing me from sending strings of numbers?

Something strange is happening with my web service when using jquery ajax - I can only pass strings containing numbers. This was never an issue before as I would always just pass IDs to my wcf service. But now that I'm trying something more complex, I ...

Recognizing when a Bootstrap dropdown with multiple options is deselected through Jquery

I'm working with a dynamic bootstrap multiple drop-down selector and I need to execute some code when a user deselects an option. <select id="selectOptions" multiple> <option>Test1</option> <option>Test2</option> & ...

What is the importance of using a polyfill in Babel instead of automatically transpiling certain methods?

Recently, I have been diving into a course that delves into the use of babel in JavaScript. It was explained to me that babel, with the preset "env," is able to transpile newer versions of ES into ES5. However, I found myself facing a situation where the a ...

Mastering Authentication in React JS: Best Practices

I am currently working on integrating Backend (Express JS) and Frontend (React JS). One of the challenges I am facing is understanding how to manage sessions effectively. When a user logs in using a form built with React JS, the backend responds with a HS ...

Flickering of image in JavaScript when mouse is hovered over and removed

I recently encountered an issue while attempting to create a mouseover effect that would display a larger image when hovering over a smaller default image. The problem arose when the larger image started flickering uncontrollably upon hover. Check out the ...

Error in Chart.jsx: Unable to retrieve the length property of an undefined object in the COVID-19 Tracker App

INQUIRY Greetings, I am in need of assistance to identify an error that is perplexing me. The source of this code can be traced back to a tutorial on creating a covid tracker available on YouTube. While attempting to implement the chart feature, I encounte ...

Having difficulty utilizing the $.each() function to assign properties to an object

I have an object called habits that contains some values. var habits={ "Drinking":"No", "Smoking":"No" } I want to add the values from this variable into another variable in the following format: var NewHabits = new Object(); Ne ...

Do I have to divide the small functions in my Node.js controller into smaller ones?

When signing up users in my controller, do I need to break up the sign-up steps into individual asynchronous calls or is one big asynchronous call sufficient? Each step relies on the previous one: Validate user Create user Create group Add user to group ...

Error thrown when attempting to access properties of null values (Uncaught TypeError: Cannot read properties of undefined (reading 'map'))

import React, { useState, useEffect } from "react"; import { TaskLists } from "./TaskLists"; import { Daycard } from "./daycard"; import { getTasks, deleteTask } from "../api/task.api"; export function TaskManager() { const [tasks, setTasks] = useState( ...

Is submitting with JQuery always a hit or miss?

Hey there, I'm currently working on a problem and could use some help. I seem to be having trouble getting inside my function for form submission in JQuery. Despite setting up console.logs, it appears that my code never reaches the first function. Can ...

Node.js and the concept of handling null values

console.log("variable = " + JSON.stringify(result.something)); After running the code, I see that variable = null However, when I add this condition: if (result.something != null || result.something != '') { console.log('entered' ...

My div is not displaying the background image properly after adding the Bootstrap CSS

Strangely enough, Bootstrap seems to be interfering with the background image of a div. The following is the HTML code: <div class="wide"> <div class="col-xs-5 line"> <hr> </div> <div class="col-xs-2 logo"> Log ...

Utilizing the Spread Operator in combination with a function call within the props of the Tab component in Material UI

I came across this code snippet in Material UI: <Tab label="Item One" {...a11yProps(1)} />. It uses the spread operator (...) with a function call within the props. However, when I tried to use it separately like: console.log(...a11yProps(3 ...

Issue with Ajax not sending query string to ASP.NET controller

I am currently working with an Ajax function that serializes data sent from my view into a query string. Here is the code snippet: UpdateFIConfig: function ($appForm) { var valid = $appForm.valid(); //if not valid the validate plugin will take ca ...

Discover the job specifications pages on Dice.Com by utilizing C programming language

I have taken on a student project involving web scraping job postings from Dice.Com for analysis. My main focus is on extracting the job description, but I am struggling to figure out how to access it. With limited knowledge in HTML and C#, I find it dif ...

Android experiencing issues with dynamically loading Border XML

I am having trouble setting a border dynamically for a RelativeLayout. Oddly enough, when I manually add the border in the activity XML file, it displays perfectly. However, when I try to generate the border dynamically, it doesn't appear. border.xml ...

An issue with the AngularJS [$parse:syntax] error has been identified when using specific data in the

I encountered an issue when attempting to create an AngularJS ui-grid table with data that includes a '(' and then whitespace before the closing ')' within a string. This resulted in an AngularJS error message: Syntax Error: Token &a ...

JavaScript appending checkboxes to a list not functioning as expected

I have not been using jQuery, JavaScript, and HTML to create a list of products. The task I am working on now is the ability to select multiple items from this list. Currently, the HTML list is dynamically populated with <li> elements using JavaScri ...