question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[animations] Missing Support for SVG-related Animations

See original GitHub issue

I’m submitting a … (check one with “x”)

[x] bug report => search github for a similar issue or PR before submitting
[ ] feature request
[ ] support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question

Current behavior

The Angular documentation states:

Since Angular’s animation support builds on top of Web Animations, you can animate any property that the browser considers animatable. This includes positions, sizes, transforms, colors, borders, and many others. The W3C maintains a list of animatable properties on its CSS Transitions page.

These animatable properties include svg properties as per this subsection 7.2. A typical example would be the radius r of a <svg:circle> element.

Currently, the API for animations only supports a style(...) property, which does not fully allow the animation of to be supported svg properties.

Specifically, using the illustrative example component below, the animation will be performed in Chrome. It will, however, fail in Firefox (and Edge). I.e. the end state will be immediately jumped to.

Expected behavior

Full support for all animatable svg properties in Angular on par with CSS style animation. This could possibly involve adding a attribute(...) syntax as a complement to style(...) or expanding the supported use of the latter.

For added clarity, support for svg related animations should be a first class citizen in animation e.g. when addressing issues such as #9668 or any other means to creating dynamic animations.

Thanks in advance!!!

Minimal reproduction of the problem with instructions

The somewhat minimalistic component below allows reproduction.

import { Component } from '@angular/core';

import {
  trigger,
  state,
  style,
  animate,
  transition
} from '@angular/animations';

@Component({
  selector: 'app-root',
  template: `
    <svg width=100 height=100>
      <circle
        [@resize]
        cx=50
        cy=50
        r=20
      >
      </circle>
    </svg>
  `,
  styles: ['circle {stroke: slateblue; fill: slateblue;}'],
  animations: [
    trigger(
      'resize', [
        transition(
          'void => *', [
            style({ r: 0 }),
            animate(2000)
          ])
      ]

    )
  ]
})
export class AppComponent {

}

What is the motivation / use case for changing the behavior?

The primary use case are complex data visualizations using svg with animated changes in response to data changes.

Without adding in consistent support for svg related animations, it is necessary to utilize additional third party modules (e.g. d3-selection and d3-transition) to touch the DOM.

With full support for animations, D3 can be used to compute layout data, but as a segregated concern Angular can handle all DOM updates.

Please tell us about your environment:

Windows 10 VS Code 1.11.2 npm 3.10.10

  • Angular version: Angular 4.1.0

  • Browser: [| Chrome Version 57.0.2987.133 (64-bit) | Firefox 53.0 | MS Edge 40.15063.0.0 EdgeHTML 15.15063]

  • Language: [all]

  • Node (for AoT issues): n/a

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:26
  • Comments:13 (2 by maintainers)

github_iconTop GitHub Comments

4reactions
tomwanzekcommented, Jul 2, 2018

Is there any update on this issue?

2reactions
tomwanzekcommented, Jul 21, 2017

@matsko Ping? This issue was opened in April and has not even seen any preliminary guidance/assessment from the core Angular Team. Unfortunate…

cc @vicb

Read more comments on GitHub >

github_iconTop Results From Across the Web

A Guide to SVG Animations (SMIL) - CSS-Tricks
SVG animations can be similar to CSS animations and transitions via by their nature. Keyframes are created, things move, colors change, etc.
Read more >
SVG animation not working; am I missing something? - GSAP
Hi, I am new to GSAP and HTML5/Javascript animation; I'm used to timeline animation in Flash and After Effects, but I think it's...
Read more >
SVG animation with SMIL - MDN Web Docs - Mozilla
Firefox 4 introduced support for animating SVG using Synchronized Multimedia Integration Language (SMIL). SMIL allows you to: animate the numeric attributes ...
Read more >
SVG file losses its animation after inserting it in powerpoint
I am sorry, while all Office applications now include support for SVG images, they do not support SVG Animation. If you need to...
Read more >
How to animate SVG with CSS: Tutorial with examples
There are also animated spot illustrations, which help to brighten up landing pages. How to prepare SVGs for animation. Since it's easier to ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found