Dynamic emblem on a webpage

Recently, I stumbled upon this website. A unique feature caught my attention - when users click on the "Log in" button, the logo on the page starts animating. I'm intrigued by this animation and curious to learn how it can be implemented. Can anyone provide me with helpful links or resources for similar animations? My attempts at Googling for information have been unsuccessful so far, mostly because I don't know what this type of animation is called.

Answer №1

Indeed, it seems quite simple to accomplish this task. If the two elements are siblings, you can achieve the desired result using CSS.

CSS METHOD

#site-logo {
   background-image: url(path/to/non-animated-image);
}
.login-button {
  /* Add default login button CSS styling here */
}
.login-button:active ~ #site-logo {
   background-image: url(path/to/animated-image.gif);
}

You can then insert an animated gif in the

.login-button:active ~ .site-logo
block.

Alternatively, jQuery or a similar library can be utilized

jQuery METHOD

.login-button.on('click', function(){
   $('#site-logo').css('background-image', 'url(path/to/animated-image.gif)');
});

Answer №2

The link you shared utilizes CSS3 animations/transitions and a canvas. However, it seems to have an excessive amount of code for achieving a simple effect on the logo. This method may not be very efficient, as noted by Josh Burgess, who suggested using a .gif image instead. Despite that, let's delve into some interesting aspects of this logo, beyond just the canvas or gif image.

Let's start with the circles in the design – they are not images but created solely using CSS and HTML for the static portion of the logo. While one could use .gif images to achieve a similar look, here it is all about CSS styling.

Exploring the Circles

CSS:

.myCircles li, .myCircles li:after {
    position: absolute;
    top: 25px;
    left: 25px;
    list-style: none; /* hide the list style */
    text-indent: -9001em; /* hide the text content */
    width: 50px;
    height: 50px;
    border-radius: 100% 100% 100% 100%;
    border-top: 5px solid #000;
    border-right: 5px solid #000;
    border-bottom: 5px solid #000;
    border-left: 5px solid transparent;
    transform: rotate(45deg);
    transition: all 2s; /* The transition effect */
    -moz-transition: all 2s; /* Firefox 4 */
    -webkit-transition: all 2s; /* Safari and Chrome */
    -o-transition: all 2s; /* Opera */
}
.myCircles li:after {
    content: ''; 
    left: 25px;
}
.myCircles li:hover {
    transform: rotate(190deg);
    opacity: 0.5;
}

HTML:

<ul class="myCircles">
    <li id="circle"> circle </li>
</ul>

The website generates multiple circles through the :before and :after selectors, demonstrating the fading-in animation when triggered. By adding a simple :hover action, users can observe the fading effect firsthand.

You can apply these transitions and animations to various events beyond just hover effects by incorporating JavaScript functions like onclick or load events.

HTML/JS (jQuery):

<button id="test">login</button>

<script>
    $(document).ready(function(){
        $('#test').click(function() {
            $('#circle').css( 'left', '100px' );
            $('#circle').css( 'opacity', '0.5' );
        });

    });
</script>

While utilizing canvases offers flexibility in rendering complex animations, it may involve more manual work or relying on libraries to harness its full potential. Nevertheless, the canvas element provides greater creative freedom for intricate animations.

For further references on animations and effects, feel free to explore resources such as CSS Transformations and Canvas Animations:

CSS Transformations, Transitions, Animations:

CSS Transformations

Canvas Animations:

Canvas Animations

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

What is the technology powering A.nnotate.com?

Can you explain the process by which services such as A.nnotate.com, Scribd, and Google Docs convert PDFs, .doc files, or other documents into HTML? Additionally, could you detail how their annotation systems function? ...

Struggling to achieve the desired outcome in HTML5 and CSS?

Can anyone help me correct a formatting issue I'm having with my HTML and CSS code? I want all textboxes to align vertically, but it's not displaying correctly. Here's the code: <div id="wrapper" class="wrapperClass"> <fieldse ...

:nth-child along with endless scrolling

In the development of a website, I encountered a situation where there is a grid of items with rows that float properly thanks to a specific CSS code: .collection .grid-item:nth-child(3n+1){ clear: left; } This code ensures that the first item in ea ...

Implementing a feature in jQuery to reveal an element upon button click

I need to create a functionality where clicking a button will display a panel. Initially, I have set the panel's visibility to false in its properties. So, when the user clicks the button, the button should hide and the panel should show up. How can I ...

Enhance your web design with the latest Bootstrap 5.2

I attempted to implement a tooltip using jquery in my jquery datatable, but unfortunately the tooltip is not appearing. Below is the code snippet: render: function (data, type, row, meta) { var total = row.success + row.error; if (row.isConsumed = ...

Transforming Input Background Color with jQuery based on Matching PHP Array Entry

I am looking for a solution to implement form validation in PHP. The form has 3 fields: user, id, and email. When a user enters their name or id in the respective input fields, I want to check if the entered value matches any of the values in the PHP arra ...

How can you achieve a vertical list display for a label while preserving its inline-block properties?

I have chosen to use labels for my radio buttons because I enjoy the convenience of being able to click on the text to select the option. However, I want these labels to appear in a vertical list format. Currently, they are displaying as blocks, causing th ...

Is it feasible to create a Fabric.js canvas with dynamic width of 100%?

After executing the code 'canvas = new fabric.Canvas('foo')', Fabric transforms a canvas element with a css class containing width=100% into the following structure: <div class="canvas-container" style="position: relative" width="29 ...

Conflicting media queries

Attempting to resolve the issue of site content overlapping with the background slider plugin on a WordPress website, I have encountered conflicting media queries for different devices. While it may work perfectly on mobile devices, it can create problems ...

"Using AJAX in PHP will not generate any output when returning JSON

Hey everyone, I'm having trouble with my simple PHP test code. I can't seem to get the err value that I want. 2.php $error = "abc"; $er = json_encode($error); return $er; Here's my HTML: <html> <head> <script src="https:// ...

Is there a way to make a button on a single div only affect that specific div

I have a PHP query that echoes a div for each row in the table. I want the div to slide up and then, when the user clicks the "read more" button, the div slides down. However, since it is echoed in a loop, all the divs have the same IDs and classes. I wo ...

I am seeing an empty dynamic HTML table

I have been working on creating a dynamic HTML table, but I am facing an issue where the data is not displaying in the table. I have verified that the query is correct by testing it in SQL and confirming that it outputs the data. The problem seems to lie w ...

"Add a touch of magic to your webpage with text effects that appear

I am looking to create a glowing text effect, and I stumbled upon this resource. http://jsfiddle.net/karim79/G3J6V/1/ However, the client prefers the text effect to appear after the page loads, rather than on hover. Unfortunately, I do not have experien ...

What is the method for eliminating <ol> elements that have a particular number of <

As a beginner in the world of html and css, I am reaching out for some assistance. My question is regarding how to remove the ol tags that contain 3 li elements without any class or id. Here is an example: <div class="text"> <ol> ...

Reduce the size of Scripts/CSS for production mode using node.js

I currently have a node-based web app where the (client) JavaScript and CSS files are not minified for easier debugging purposes. As I prepare to launch into production, I am looking at minifying these scripts. It would be convenient to have a command lik ...

custom dialog box appears using ajax after successful action

Recently, I created a custom dialog/modal box with the following code: <div id="customdialog" class="modal"> <div class="modal__overlay"></div> <div class="modal__content"> <h2><strong>Hello</strong&g ...

A fixed header list using CSS with a single scroll bar

I am looking to create a scrollable list with a fixed header, where the scroll bar extends the full height of the parent but only scrolls through the nav items (keeping the logo in place). My current setup involves: <div className="home-page-nav"> ...

Best Practices for Implementing an Autocomplete Search Box in HTML

I'm currently working on implementing the code below and I could really use some guidance. Despite reading and watching Google Developers' YouTube videos, I am still struggling as I am new to this. My main goal is to integrate an autocomplete sea ...

Tips for maintaining the size of child elements within a parent container without affecting the font size in CSS

I have a basic navigation bar setup: <nav> <a href="#">Home</a> <a href="#">About</a> <a href="#">Register</a> </nav> Along with the CSS styling for the navigation and anchor tags: nav { background- ...

Executing a JavaScript function from one page on a separate webpage

I am trying to link three pages together: dashboard.html, documents.jsp, and documents.js In the dashboard.html file, I have a hyperlink that should take the user to documents.jsp and also trigger a function in the documents.js file, which is included in ...