Animated Order Button

Using HTML, CSS, and JavaScript, the Animated Order Button is a contemporary UI interaction element. By turning a straightforward button into a fluid and eye-catching animation, it improves user engagement. For beginners and front-end learners who want to enhance their UI/UX design skills without using complex frameworks, this project is ideal.

  1. Discover how to use basic <button> and <div> elements to organize the button layout.
  2. Create press, loading, and success animations using CSS transitions and @keyframes.
  3. Enhance UI with micro-animations such as color changing, scaling, and glow effects.
  4. Make the button fully responsive for both desktop and mobile screens.
  5. Control animation states like "Ordering", "Processing", and "Completed" using JavaScript.

How to Design:

HTML Structure: Start with a simple <button> element and add extra <span> layers for icon and text effects. Keep the structure clean and minimal.


CSS Styling: Use transition, transform, and @keyframes to build smooth animations. Apply gradients and soft shadows to make the button visually appealing.


JavaScript Interaction: Use event listeners to trigger animation states. On click → show loading animation → then display success animation, making the button feel dynamic and interactive.


<!DOCTYPE html>
<html lang="en" >

<head>
  <meta charset="UTF-8">
  <title>Animated Order Button</title>
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/meyer-reset/2.0/reset.min.css">

  <link rel='stylesheet' href='https://fonts.googleapis.com/css?family=Roboto:400,500,700&amp;display=swap'>
  <link rel="stylesheet" href="style.css">
</head>

<body>
  <button class="order"><span class="default">Complete Order</span><span class="success">Order Placed
    <svg viewbox="0 0 12 10">
      <polyline points="1.5 6 4.5 9 10.5 1"></polyline>
    </svg></span>
  <div class="box"></div>
  <div class="truck">
    <div class="back"></div>
    <div class="front">
      <div class="window"></div>
    </div>
    <div class="light top"></div>
    <div class="light bottom"></div>
  </div>
  <div class="lines"></div>
  <script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js'></script>
  <script src="script.js"></script>
</body>

</html>
		


Leave Comments

FOLLOW US