Shining animation of a quote in a right angle using CSS3 and/or Javascript

I have a vision for an animation that involves three successive right angle quotes, like » » », glowing one after the other from left to right and then back again. This could be a unique effect that developers might find interesting and valuable.

The idea for this animation is inspired by the slide-to-unlock feature on iPhones, where text glows progressively.

While I am familiar with CSS3 animations using keyframes and have used them before, I'm unsure about coding the looping part. Perhaps Javascript is the solution, possibly utilizing jQuery since it's already present on the page.

The HTML structure I envision would look something like this:

<span class="glowquote"><span>&raquo;</span> <span>&raquo;</span> <span>&raquo;</span></span>

If you have any ideas on how to best implement this in a clever way, please share your thoughts. I understand that not all browsers support CSS3 animations, but I only need to cater to modern webkit and gecko implementations.

Edit 1: Included span tags around each &raquo; for individual CSS property changes in JavaScript.

Edit 2: To clarify, the left-most quote will glow first with a specific color using CSS properties, followed by the next quote with a short delay.

Edit 3: For further clarification and inspiration, check out this example of the exact animation I have in mind: Example Link


FINAL EDIT WITH SOLUTION SUMMARY: After considering various options, I chose the pure CSS3 approach for my implementation. There are multiple valid solutions presented here, so explore what works best for you. You can view my final implementation at: Final Implementation Link. Have fun experimenting with this animation on your projects!

Answer №1

Just for kicks, here's a method utilizing pure css. It may have some limitations when it comes to browser support.

.glowquote {
    background: -webkit-linear-gradient(left, black 0%, green 40%, green 60%, black 100%);
    background-size: auto 50%;

    padding: 0 100px;

    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;

    -webkit-animation: gradient-animation infinite 1s linear;
}

http://jsfiddle.net/grc4/uF8H2/3/

Edit: The jsfiddle now partially functions in firefox. The gradient animation is operational, the only aspect that doesn't function appropriately is the text clipping (-moz-background-clip:text doesn't exist). Implementing an image mask over the background could resolve this issue.

Answer №2

To enhance the styling of each arrow individually, I would wrap them in separate span elements:

<span class="glowquote"><span>&raquo;</span> <span>&raquo;</span> <span>&raquo;</span></span>

If you are utilizing jQuery UI (since basic jQuery may not support color animations), you can utilize a similar approach like this:

function doGlow(numTimes) {

    var $arrows = $("span.glowquote span");

    function nextGlow(i) {
        $arrows.eq(i).animate({
            color: "green"
        }, 400).animate({
            color: "black"
        }, 400, function() {
            i = (i + 1) % $arrows.length;
            if (i === 0) numTimes--;
            if (numTimes > 0) nextGlow(i);
        });
    }
    nextGlow(0);
}

See it in action here: http://jsfiddle.net/KrL44/1

(Alternatively, check out the original version of the demo that loops indefinitely: http://jsfiddle.net/KrL44/)

Answer №3

Give this a shot:

Here is the HTML code snippet:

<span class="glowquote"><span>&raquo;</span> <span>&raquo;</span> <span>&raquo;</span> </span>

And here is the corresponding JavaScript code:

$(document).ready(function(){
    var i = 0;
    function run() {
        $('.glowquote span:eq('+ i +')').animate({color: 'green'}, 500, function(){
         $(this).animate({color: 'black'}, 500);
           i++;
           if (i > 2) { i = 0 } 
           run() 
        })
   }
 run()            
})

Check out the working example on JSFiddle

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 best way to incorporate background audio in Next.js?

I'm working on a project using Next.js and have encountered an issue with my audio player. Whenever the page is reloaded or left, the audio stops playing. I've tried using an iframe to keep the audio playing in the background, but it prompts me t ...

A method for calculating the average of values with identical keys within an object contained in an array

I have a JSON object that contains countries and data values. I need to add up the values of each country and compute their average. Here is the JSON object: var arraySeries = [{"country":"United States","data":2}, {"country":"Venezuela ...

Stop the recurrence of multiple clicks by incorporating a Bootstrap modal popup confirmation

$('button[name="remove_levels"]').on('click', function (e) { var $form = $(this).closest('form'); e.preventDefault(); $('#confirm').modal({ backdrop: 'static', ...

Troubleshooting: Issues with the functionality of ng-include in AngularJS

Hi there, I am new to angular js and I'm attempting to integrate a simple html file into my page. Below is the code I am using: <!DOCTYPE html> <html ng-app=""> <head> </head> <body ng-controller="userController"> < ...

What is the best way to begin a new conversation in an Alexa Skill?

In my NewContactIntent, users provide data such as first name and mobile number. I want them to be able to restart the dialog at any point by using a RestartIntent. When the user says 'Restart', the RestartIntentHandler should handle the request ...

Selection List dictates the necessity of JavaScript

I need to create a JavaScript code that will require the comment field (textarea) when a selection is made from a list. Currently, I have added a required icon next to the comment section but I am stuck at this point. See the code below. Thank you in adva ...

Developing a column index comparable to that of spreadsheet software

Do you know of a method in Javascript that allows for generating a sequence of strings from A-Z, then moving on to AA-ZZ, and continuing to AAA-AMJ? I'm hoping to avoid nested loops to accomplish this task. I've hit a roadblock and would apprecia ...

In the realm of asp.net, the OnClick event springs into action after the

My asp button uses OnClientClick to execute a javascript function, and I also want to run OnClick after OnClientClick. However, the OnClick never seems to execute. Despite looking through similar topics on StackOverflow and other websites, I can't see ...

Setting text alignment in Bootstrap based on breakpoints

Imagine this code: import React from 'react' import DarkPattern from '../Assets/dark-pattern.jpg' const Profile = () => { return ( <div> <section className="bg-dark text-light text-center " ...

Detecting collisions between two squares in an HTML5 canvas

class Snake { constructor() { this.x = 400; this.y = 400; this.width = 25; this.height = 25; } draw() { ctx.fillRect(this.x, this.y, this.width, this.height); } } let snake = new Snake(); class ...

Start fresh with your list styling in Sass/CSS

I'm attempting to revert ul and li elements to their default styles using a specific class, but I'm encountering difficulties in doing so. I've experimented with the inherit and initial values, but they haven't proven effective. This i ...

What is the best way to send numerous forms to a PHP page when the quantity of forms produced varies randomly?

In my project, I have a code that dynamically populates input fields at the final step based on a user's selection. Each choice can have up to 6 input fields, resulting in a maximum of 4 forms or 24 input fields in total. For data persistence, I need ...

Is there a method to delay the loading of a webpage until an image has fully loaded (preloading)?

How can I ensure that an image used in a preloader is loaded before the other contents on my website? <div class="overlay" id="mainoverlay"> <div class="preloader" id="preloader"> <img src="images/logo128.png" id="logo-p ...

Avoid Repeating an Animation with Jquery

When you continuously press a button that triggers a function with animation, the function is called multiple times and the animation plays one after another. How can you prevent the function from being triggered while the animation is still in progress? ...

Design a background image that is optimized for both high-resolution retina displays and standard non-ret

Scenario I am working on a web page where I want the background image to be fixed, covering the entire screen or window (excluding tablets and smartphones). The background image has been created using ImageShack. Everything is running smoothly so far. T ...

What is the best way to ensure a multi-page form is validated using HTML5 and JavaScript before progressing to the next page?

Currently, there are two functionalities at play. The submit button is not being recognized while the functionality in JS $(".next").click(function(){..} is working as expected. HTML This section involves 4 fieldsets. I am attempting to validate ...

Leveraging Leaflet or any JavaScript library alongside Typescript and webpack for enhanced functionality

Important: Despite extensive searching, I have been unable to find a resolution to my issue. My current endeavor involves developing a map library through the extension of leaflet. However, it appears that I am encountering difficulties with utilizing js ...

incorrect sequence of div elements appearing vertically

I'm having trouble organizing the header, page title, and navigation bar on my webpage. Despite my attempts to structure them correctly, they are not displaying in the desired order as shown below: https://i.stack.imgur.com/A3rQe.jpg The issue arises ...

Is there a way to position this Flex-Box Item beside the image?

Please refer to the image How do I rearrange this Flex-Box Item to be positioned next to the image? https://i.sstatic.net/eSy3w.png <div class="brif fb"> <div class="sml-con"><img class="sml-thumb" src="images/chosen/edwa ...

What sets apart the method of assigning event handlers using bind() versus each() in jQuery?

Could someone explain the difference between using bind() to assign event handlers and using each() for the same task? $(function () { $('someElement') .bind('mouseover', function (e) { $(this).css({ ...