Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SVG height and width attributes #27

Closed
marick opened this issue Nov 2, 2016 · 1 comment
Closed

SVG height and width attributes #27

marick opened this issue Nov 2, 2016 · 1 comment

Comments

@marick
Copy link

marick commented Nov 2, 2016

I'm animating SVG rect elements to show fluid levels decreasing. rect uses height and width attributes. Those aren't animatable via the API. I realize I could use points instead of rect, but these attributes might be broadly useful. (Alternately, perhaps a way to set custom SVG attributes, though the case statement in the code suggests that isn't straightforward.)

Interestingly, you can use the HTML height attribute, which results in an element like this:

<rect style="height: 0px;" y="90" fill="#d3d7cf" x="0" width="30"></rect>

That actually works in both Chrome and Safari, but not in Firefox.

@mdgriffith
Copy link
Owner

Hey! Sorry, long time in responding :/

You can do this if you use Animation.attr "height" 0 "px", which manually specifies something that should render as an attribute instead of a style property.

I've put this on the list of things I'm looking at (rendering Animation.height as both a property and a style attribute) when I work on the next major revision.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants