pulsate the text by applying a transform css to it

I have an SVG template with some text that I want to make pulsate.

Here is the HTML code:

<tspan class="text animated pulse" x="14.325" y="39.18">50</tspan></text>

Unfortunately, it's not working as expected.

If you'd like to see the code in action, check out this CodePen link.

Answer №1

Perhaps this approach could yield better results:

.word.span.animate.beat {
  animation: beat-word infinite;
  animation-duration: 1s;
}

@keyframes beat-word {
  0% {font-size: 1em;}
  50% {font-size: 1.2em;}
  100% {font-size: 1em;}
}

Answer №2

Hello, thank you for your response. Unfortunately, that is not the solution ;(( I need to apply the CSS class text animated pulse

<g transform="matrix(1,0,0,1,165.514,113.873)" class="no-kerning">
<text stroke-width="0" stroke="#5F5E5E" stroke-linejoin="round" fill="#5F5E5E" font-family="CurrencyRegular" font-size="40"><tspan class="text animated pulse" x="14.325" y="39.18">50</tspan></text>
</g>

Answer №3

The transform property does not work for the tspan element. You can achieve a similar effect by animating the font-size instead. Here is the updated code:

https://codepen.io/anon/pen/WKVOzB

Changes to the code:

tspan.text.animated.pulse {
  animation: pulse 3s ease-in-out infinite;
}

@keyframes pulse {
   0%,100% {font-size:40px;}
   50% {font-size:50px;}
}

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

Angular 2 presents a challenge with two-way binding in dropdowns with IE 9/10

Encountering a peculiar issue on IE 9/10 - two-way binding seems to work for all HTML elements except dropdowns. Even if the value exists in the dropdown, it does not get selected. Below is a snippet of the code: HTML <select [(ngModel)]="model.city" ...

What are some recommended techniques for designing a voting system that accommodates both registered and unregistered users?

In my latest project, I am in need of a voting script that will allow both registered and unregistered users to vote on content featured on my website. The goal is to ensure that each user, whether registered or not, can only vote once for the same piece o ...

Tips for placing <div .right> above <div .left> when the window is small, given that <div .right> is positioned to the right of <div .left> when the window is large

I've come across a similar layout before, but I'm struggling to replicate it myself. The idea is to have text aligned on the left side with an image floated to the right. Instead of the image appearing below the text when the window size is red ...

Transform the CSS to a Mat-Form-Field containing a search box within it

I am currently working with Angular, Angular Material, and SCSS for my project. Here is the front-end code snippet that I am using: <mat-form-field class="custom-form-field" style="padding-top: 5px;padding-bottom: 0px; line-height: 0px; ...

Struggling with setting up a search bar for infinite scrolling content

After dedicating a significant amount of time to solving the puzzle of integrating infinite scroll with a search bar in Angular, I encountered an issue. I am currently using Angular 9 and ngx-infinite-scroll for achieving infinity scrolling functionality. ...

Storing Data in Web Browsers: HTML5's localStorage, Cookies, and

After browsing through numerous search results on SO, it seems that HTML5's localStorage feature is particularly advantageous compared to Cookies for storing large amounts of data that doesn't need to be sent to the server. (Local Storage vs Cook ...

Issue with connecting JavaScript to HTML button

I am currently working on a 10-second countdown feature for a game using Javascript and HTML. Currently, the code runs upon page load. However, I am facing difficulty in linking it to a button so that it triggers upon clicking. ...

The Owl carousel is experiencing difficulty loading slides due to issues with autoheight functionality

UPDATE I have identified the issue. It appears that the problem lies with the auto height function of Owl Carousel. If I disable this function, the images load properly. However, I rely on this feature due to the varying sizes of the images. What course o ...

Align list item span to the center

I have encountered an issue with creating a match list using li and ul tags. Despite applying the center span to a fixed width and the team spans to the remaining space, the widths still appear different. How can I ensure that the team spans have the same ...

CSS: Handling Background Images Responsively

I'm experiencing an unusual issue where the image is not appearing, even though the div box shows up when I highlight elements on the page. Validation and inspection also show no issues. Here is the code: <div class="mainImage"></div> A ...

Tips for sending multi-dimensional arrays in an HTML form via request?

I have created a form where users can select products and enter the quantity for each product. Here is the structure of my form: <select name="products[][product_id]"> @foreach($products as $product) <option value="{{ $ ...

How Python Flask sends a string as &#34 to an HTML page

I am working on a Flask app and I need to send simple JSON data from the app.py file to an HTML page. Here is the relevant code in my app.py: jsonArr = [{"type": "circle", "label": "New York"}, {"type": "circle", "label": "New York"}] return ...

Stop animation on mobile devices by modifying the CSS file

Using jQuery, I added an animation class to a div on my webpage. The animation.css file has been included as well. The class animated slideInLeft is currently in use. My question is whether it is possible to disable this class for mobile devices in order ...

Adjusting Transparency using jQuery

I have a grid with 9 items, and I want each item to have an opacity of 0.5 initially. When the user hovers over an item, I want it and its contents to have an opacity of 1.0. Check out the JavaScript code below: $('.gallery-single').css({ opaci ...

When trying to run the code locally, JS and Bootstrap seem to have trouble functioning together, despite

Check out my codepen project here: https://codepen.io/ldrumsl/pen/ZxdZwa Below is the JavaScript code: $('#datetimepicker1').datetimepicker(); $('#datetimepicker2').datetimepicker(); Downloaded index.html file content: <!DOCTYPE ...

What exactly does the 'value' attribute do when used in an input element within React?

Can someone explain the significance of value={} in React inputs? Currently, I am working with a state defined as const [username, setUsername] = useState("");. In my form, there is an input element that updates the state based on user input. &l ...

What is the best method for directing to various pages on a GitHub Pages website?

My GitHub Pages site is live at this link. While the splash page loads perfectly, clicking on the circle to transition to the next page, 'landing.html', leads to a 404 error. I have exhausted all possible solutions to address this issue, includin ...

Reduce the size of all elements on the website in Semantic UI

I am facing an issue with my semantic UI website where everything appears too zoomed in and I would like to scale it down proportionally, from fonts to containers and segments. Attempting to solve this problem, I have tried using CSS properties like zoom: ...

Is it possible to dynamically change the recipient of a mailto: link using HTML and JavaScript based on the URL used to visit the website?

I manage multiple websites that share a common privacy policy page. I wish to dynamically change the email address based on which site the user is accessing it from. For instance, if a user visits the privacy page from Site A and clicks on [email pro ...

Is Socket.io combined with Redis the best architecture for an interactive gaming experience?

My current setup involves a NodeJS scaling architecture with Redis, specifically designed for a real-time multiplayer game. However, I'm facing challenges in configuring separate lobbies for players, as the load balancer assigns users to different ser ...