开发者

Workflow for using bezier curves with Core Animation

开发者 https://www.devze.com 2023-03-09 19:36 出处:网络
I recently worked on a project that made extensive use of Core Animation.The results were quite good.Ideally, I would have used layers and bezier curves for the motion.

I recently worked on a project that made extensive use of Core Animation. The results were quite good. Ideally, I would have used layers and bezier curves for the motion.

Does anyone have a good workflow for creating the data points to th开发者_如何学Pythonen use when creating a curve? I got lost a bit with the control points. Conceptually, I do understand what is going on.

Is there a 3rd party software that will let you visually create a Bezier curve and then export it to a text file to include in source code?


This is probably not as straightforward as you're looking for, but OmniGraffle exports its scenes in XML assuming you don't compress them. If you know Python, or some other scripting language with xml support, ts pretty straightforward to parse the XML to get at the bezier values therein. I am using this approach to generate CoreAnimation bezier paths and it works well.

So, roughly what I'm doing:

  1. Create a reference rectangle in OmniGraffle the same pixel size as your Display

  2. Draw some bezier curves.

  3. Save the file as XML (make sure compression is off-in a palette somewhere)

  4. Using python/XML parse the curve data out of the saved scene file
  5. Save out a nicer curve-only xml file resource for your App to read.
  6. Write code in your app to load the XML and create CoreAnimation curves using the bezier values from the file


Free http://inkscape.org/ has XML editing capabilites compatible with SVG format http://www.w3.org/Graphics/SVG/

It allows drawing bezier and export their parameters.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号