-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Missing methods on SVG.FX in svg.js.d.ts #597
Comments
@peterennis Aside from You can animate the paths of a logo by morphing between a start path and an end path. Here is an example with two similar icons from icomoon: http://codepen.io/dotnetCarpenter/pen/mREvjL If you need to animate/morph between less similar paths, you can use svg.pathmorphing.js. |
After reading the docs, I think you should use I will check later if this is a bug or a documentation bug. |
@dotnetCarpenter your code will set an attribute rotation on an element which just willl do nothing. svgIcon.animate().rotate(45)
//or
svgIcon.transform({ rotate: 45 }) To have relative transformations (which is maybe what you are looking for), use the relative flag: svgIcon.transform({ rotate: 45 }).transform({ skewX:25, skewY:0 }, true) EDIT: for the bug which says that rotation is not defined on animation: Fell free to create a PR and fix that in the ts file |
@peterennis I just noticed that you're using |
@peterennis It appears that this is not a bug. I've just made a demo with your use-case and it works fine: https://jsfiddle.net/dotnetCarpenter/5yjc8k84/ @Fuzzyma thanks for the corrections. |
This might be an issue with |
@peterennis Can you patch If yes, then I know how to fix typings. But since I don't use typings, I need you to confirm that it is working. |
I think there might be a lot more methods than |
@dotnetCarpenter I will look into this over the weekend and get back to you. |
@peterennis yes you're right. Perhaps we can all hack something together. There is an interesting answer on SO for that, here: http://stackoverflow.com/questions/12687779/how-do-you-produce-a-d-ts-typings-definition-file-from-an-existing-javascript#12695001 |
@dotnetCarpenter said: |
@dotnetCarpenter I am using Windows 10 with Visual Studio Code
I do not know enough to help with typings, but I can test... |
@Fuzzyma |
@peterennis: Could you try I'm not surprised that |
@RmiTtro, @peterennis if |
@RmiTtro, @dotnetCarpenter |
Thanks for testing this out! We are making progress, that's good! For I'm a bit puzzled as to why there is still a red squiggle under rotate... |
I have been doing some research into typings. Quick summary: Current definitions I am using are 0.0.17 (https://www.npmjs.com/package/@types/svg.js) Fuzzyma ticket: typings/registry#574 Automatic Typings Acquisition: https://github.com/Microsoft/nodejstools/wiki/Automatic-Typings-Acquisition Go here: https://microsoft.github.io/TypeSearch/ Microsoft have a developer on this working directly with the Definitely Typed guys: TypeScript 2.2 is now available: http://www.typescriptlang.org/ The package owner should be in control of this process. It should save you a bunch of heartache and get some automation Ryan should be able to answer the squiggle question... @RmiTro, I will play with skew in my sandbox. Thanks. HTH |
@peterennis thanks for the info. I'm afraid this will have to wait to after the 2.5.0 release but your last post is great starting point. If you are able to help further we'll appreciate it 👯♂️ |
I tested dts-gen, ran into problems and opened a ticket with Ryan Cavanaugh. |
@peterennis Sorry for the delay. You have my full support. Let us know, if you need anything in particular from us. |
@dotnetCarpenter, I looked into this some more and the layout of svg.js with code modules under src is not recognized by dts-gen. So I tried just doing that file by itself, but npm want fx.js installed as a module and there is actually an unrelated npm module called fx. My next idea would be do take the fx.js file and see if that could be turned into an npm module (fxsvg ?), |
Seems that ain't gonna happen (more than a week ago). Gonna look into dts-gen. |
As I see it, dts-gen can not understand our architecture. When required via CommonJS, Doing it on each source file, won't work because our source files are meant to be concatenated as defined in our gulpfile.js. I've been championing es6 modules for a while, which might give dts-gen something to work with. E.i. if you try to use dts-gen on a single file, Alternatively trying to feed all of SVG.js, Even with a new architecture for SVG.js, which dts-gen understand, it will not know which arguments are optional of know which data type we expect. I'm afraid that the typings definition has to be manually edited and kept ajoure. And I'm afraid we don't have this expertise in the team at the moment. I for one, don't even know how to enable typings for SVG.js in vscode. |
Although there has been happening nothing here for quite some time, I'm interesting in hearing if my problem is connected to the problems you have with dts-gen. So far the Typescript support works splendorous and makes autocomplete a breeze in vscode. Would it help to fork svg.js and whenever I would miss something in svg.js.d.ts, to add the typedefinition and create a pull request in the upstream repository? |
Jeah I guess there havent been much progress lately. However behind the curtain we are hard working on 3.0 which comes with new amazing stuff and es6. I dont know if dts-get can keepup with our mixings (they would need to create the objects and look at their prototype - i dont know if they do that) but its cool anyway :D. For your collaboration: Yes, create as much PRs as much as you want. That would help tremendously! |
Thanks for the confirmation regarding to forking. I'll do it so. My intention wasn't to say that you haven't made progress. That is obviously disproved when browsing the git-history of the project. I just meant this specific issue. Sorry for the phrasing. As for me, you're doing great work and I'll continue to use the library and looking forward to see v3.0 |
Hehe that was by no means what I wanted to imply :D. I just wanted to say that we move to es6 soon and then we might be able to use dts-gen and solve this issue with typescript. Until then your contribution to the typings is very welcome! :) |
I discovered only two missing Typescript-definitions so far, as I only have used as small subset of functionality of svg.js. Would it be better to create small pull-requests whenever I added something, or rather wait till I think I added a considerable number of missing definitions? If the former is a common practice, please excuse my question, as I don't have a lot of experience with collaboration on git. Best wishes for the es6 migration. |
Do as you like. You can go ahead and create a PR and push to that branch whenever you find something new. And I can merge whenever I feel like :D. But there is nothing wrong with small PRs in general. |
Installed using Ionic2.
First test basic animation worked.
Rotate fail.
v2.4.0
Apart from the error my goal is to load an SVG icon and animate it
but did not see how to do that in the docs.
The text was updated successfully, but these errors were encountered: