Vector Graphics

Yes, just a bit order to the Illustrator files will do it. No boolean means some think arounds as well at time of drafting in Illustrator. Objects on new layers - line, fill…

Object id would be useful for animation and effects…

Could the illustrator plugin drawscri that generates the .json tweak drawscri to output ids?

Or could .svgs be converted into .json?

Found this link:

http://petesaia.com/2011/11/svg-to-json/

No, I waas referring to the fact that the importer could do it automatically - when it determines a shape is like this, it splits it into 2. I imagine most people aren’t going to want object-level control particularly on the imported stuff, so it makes sense to keep the workflow within Illustrator or whatever as close to normal as possible and let the importer do the hard work.

As for the SVG format, I’d have to spend time looking at it - obviously the format is a bit more complicated than the JSON (which leaves stuff out - did you notice that there are no gradient fills in the JSON one? This is actually something you can almost certainly do in Corona now, and would be rather useful to get in).

The bottom line is I started with JSON because it was the easiest to understand, but I kinda figured it wasn’t going to be the most useful one. What we have now is proof of concept, but it still remains to be seen when I’ll have time to actually get SVG import in. The first thing I’d have to do I imagine is find a detailled breakdown of the SVG format but I doubt that’s tricky, there are probably docs floating around the intrawebs.

@kilopop - sorry, somehow the first time I read your last message I didn’t see that link. Just opened it up now. It looks… short. I’m not sure what it actually does to be honest, as I’ve zero skill in regular expressions. But might be a starting place. I *think* though that lua has an XML import library no? If so, that would go a long way to simplifying things as well.

This is a very interesting topic. However even though JSON can be used to export this kind of data, it’s not specifically designed for vector graphics, and it feels unnecessary to re-invent the wheel when we have SVG. I understand that JSON was a great “proof-of-concept” stepping stone, but I think the way forward would be to somehow build a SVG parser for Corona.

I’m planning to look at this myself. I found the SVG specs here for anyone interested.

http://www.w3.org/TR/SVG/

The problem is: Why is there always so much fun stuff to look into, and so little time to do it?  :wink:

@rakoonic, you’ve done an amazing job in getting this started in a very short amount of time! Much appreciated!

@ingemar: It does seem that taking advantage of the svg format would make sense, especially when you get the benefits of gradients, named layers, etc. Here’s a small sample from Illustrator that has just two simple shapes, one with a gradient. Each is on a separately named layer (“test1” and “test2”:

<?xml version=“1.0” encoding=“utf-8”?>

<!-- Generator: Adobe Illustrator 16.0.3, SVG Export Plug-In . SVG Version: 6.00 Build 0)  -->

<!DOCTYPE svg PUBLIC “-//W3C//DTD SVG 1.1//EN” “http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd”>

<svg version=“1.1” xmlns=“http://www.w3.org/2000/svg” xmlns:xlink=“http://www.w3.org/1999/xlink” x=“0px” y=“0px” width=“792px”

     height=“612px” viewBox=“0 0 792 612” enable-background=“new 0 0 792 612” xml:space=“preserve”>

<g id=“test1”>

    <polygon fill="#ED1C24" stroke="#000000" stroke-miterlimit=“10” points="220.006,148.871 295.466,148.871 306.509,208.994 

        229.822,229.239 216.938,173.411     "/>

</g>

<g id=“test2”>

    <linearGradient id=“SVGID_1_” gradientUnits=“userSpaceOnUse” x1=“261.7236” y1=“178.3193” x2=“360.4971” y2=“178.3193”>

        <stop  offset=“0” style=“stop-color:#FFFFFF”/>

        <stop  offset=“1” style=“stop-color:#000000”/>

    </linearGradient>

    <polygon fill=“url(#SVGID_1_)” stroke="#000000" stroke-miterlimit=“10” points="283.81,125.558 261.724,183.84 297.307,235.988 

        360.497,192.43 314.485,120.65     "/>

</g>

</svg>

Thanks Jeff.

I’ve got the Adobe CS6 collection and was able to open your SVG in Illustrator. A nice and simple start.

I’m planning on putting aside some time this weekend to see what can be done…

I found a lua based importer for XML that reads in the SVG files you guys gave me ok (is called simpleXML).

Together with the specs list Ingemar found, I think that it should be doable. As he points out though, the issue is time, not whether it is possible or not :frowning:

I am curious, how do I convert a normal SVG file (which is XML) to the JSON formats specifically used in both the ‘face.json’ and ‘iceream.json’? The json I convert it too is totally different. Do I need to use the illustrator tool or is there another way?

I am curious, how do I convert a normal SVG file (which is XML) to the JSON formats specifically used in both the ‘face.json’ and ‘iceream.json’? The json I convert it too is totally different. Do I need to use the illustrator tool or is there another way?