-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Question: Who requires SVG support? #74
Comments
|
would love svg support (no need for snap then =D), but also see the point of bloating the codebase... |
There should be very minimal bloat if I implement this.
Right, thanks for the reminder. Updated original post.
Awesome, Oleg! Bookmarked. |
Hi! I'm definitely interested in support for SVG animations. I'm currently using SVG.js as well as Snapsvg.js in two different projects, but the only use I have for both of them is animating x/y/transform properties. It would be really nice to get rid of the huge overhead they impose for the animations use case, especially since e.g jQuery can be used to modify the SVG DOM just fine, jQuery + Velocity would be a great combination for more basic SVG animations. |
yes please |
+1. |
I was actually looking for SVG animations with velocity :) But of course potential would be very big if I could do anything with SVGs like I could do with any DOM elements. |
I just changed all animations in my current project from Snap.svg to Velocity over the last weekend. Your API is way intuitive to work with, and I want all animation handlings to be queued and executed in one place (via Velocity). I can do most animations that my project is required with only Velocity.js except doing something like transforming a path (like animating a shape from triangle to a square). Currently, I use Snap to load my SVG spirtes then inject different fragments of the code into divs, then use Velocity.js to animate transform or opacity properties of the SVG elements. So, supporting for SVG animation will be great. I hope to remove Snap from my project dependency - it is not the smallest library, and I just use it to load SVG sprites and animating shapes. I was thinking about implementing it myself but not confident that I'm good enough to deal with cross-browser quirks. Hope it would not add much more weight to Velocity, else I think @legomushroom made a good point that having it as a plugin might be a good option. |
Hey Thanik!
Awesome. Thank you for the kind words :)
I'll have it integrated directly into Velocity itself. It should barely add any weight. This will land in the next 14 days. Stay tuned! :) |
Hey Julian, awesome news! I really admire your great work on Velocity. Love the techniques you implement to cache DOM states and avoid querying it for computed values. |
How often do you use CSS transforms on SVG's as opposed to sticking with |
@julianshapiro I reckon transform usage is more common than |
Yeah, I'd agree. Problem is that it's not possible to support it on Android stock browser and all of IE unless there's an add-on to Velocity to provide CSS transform matrix math support. I sort of feel like leaving it out altogether since people will complain that their SVG transforms aren't working in IE/AOSP. |
I think that the inline transform attribute IS supported in all browsers, even though CSS transforms aren't. |
CSS transforms whenever possible =) |
You have to pass it a raw |
IMHO, if it's trivial to add SVG support for modern browsers then adding that with the disclaimer that for additional support users need to add another plugin is totally legit. |
I primarily use opacity/transform to animate - just to keep the work in the composite layer to avoid repainting and layout recalculation (if I understand the discussion correctly). I have not tested in IE---will do it tonight. What is your thoughts about changing all transforms to If so, please let me know if there is anything that I can help. |
I don't think the same layout recalc issues would apply to SVG's since they have no concept of document flow. But I could be wrong; haven't checked into it yet. Either way, there's one last thing I need: #120. |
+1 |
d'oh! I never thought about that. It makes very much sense. It seems like anything in SVG gets repainted (using show paint rectangles in Chrome) during animation even with the translateZ hack. |
@julianshapiro, would stroke, stroke-width, fill, etc be a part of this SVG support additions? It might be just similar to backgroundColor, color, etc. |
Yup, I already built in support for those. :-) Sent from my phone.
|
Sweet!! 👍 |
yup awesome! +1 |
This took a tremendous amount of time, but only 80 additional lines of code. Woohoo! See http://velocityjs.org/#svg for implementation details. Please test and report any issues in a new thread. Enjoy! |
@julianshapiro Awesome work! Really appreciate adding SVG support. Will be playing with the new features soon. |
Alot of my coding is like that; glad I'm not the only one ;)
Is that because of flaky SVG support in browsers you decided not to add it, or...? Thanks for your hard work! |
I'm going to need to animate SVG elements, so I'll definitely be investigating this implementation. +1 |
Closes #74. See http://velocityjs.org/#svg for info.
I'm considering adding support for SVG element animation. By default, neither jQuery, nor Transit, nor Velocity support this. Why? Because most CSS properties don't take effect on SVG elements; you have to tween their HTML attributes (e.g.
width='100%'
) directly.CSS properties that already work by default for SVG elements:
opacity
, 2D transforms (all browsers except Safari desktop and mobile)What I'd be adding support for:
transform
(full browser support),x
,y
,width
,height
,cx
,cy
,r
,rx
,ry
,x1
,y1
,x2
,y2
-- basically, anything that's numerically tweenable.How it would work: Before an element is animated, there would be a check for
node instanceof SVGElement
. When Velocity detects this flag, it'll apply all properties directly to the SVG element's attributes instead of its style tag.So here's the question, who would use this? Better yet, is anyone dying for this to be implemented?
I only consider this a valid consideration for Velocity if it helps people avoid having to load additional SVG animation libraries; if you still need whatever your current SVG solution is even once Velocity has integrated this support, then it's not worth supporting at all.
The text was updated successfully, but these errors were encountered: