animated-vector-drawable icon indicating copy to clipboard operation
animated-vector-drawable copied to clipboard

How to actually make shapes?

Open sirvon opened this issue 8 years ago • 3 comments

Thanks for the tutorial!

Where did you get or come up with these?


<string name="path_circle">
    M 50,50
    m -48,0
    a 48,48 0 1,0 96,0
    a 48,48 0 1,0 -96,0
  </string>
  <string name="path_face_left_eye">
    M 35,40
    m -7,0
    a 7,7 0 1,0 14,0
    a 7,7 0 1,0 -14,0
  </string>
  <string name="path_face_right_eye">
    M 65,40
    m -7,0
    a 7,7 0 1,0 14,0
    a 7,7 0 1,0 -14,0
  </string>
  <string name="path_face_mouth_sad">
    M 30,75
    Q 50,55 70,75
  </string>
  <string name="path_face_mouth_happy">
    M 30,65
    Q 50,85 70,65
  </string>

How do I go about making arbitrary shapes?

sirvon avatar Jul 08 '15 20:07 sirvon

Bump! How do we actually generate all these path values for morph? Thanks heap!

cooperkong avatar Aug 06 '15 06:08 cooperkong

I created an SVG path by hand, then took the d variable to use as the value in the string. Here is an SVG path tutorial: http://tutorials.jenkov.com/svg/path-element.html

For morphing to work, each path needs to have the same number of commands (M, a, Q etc), and each command needs to have the same number of variables. Unfortunately I don't know any tools that generates that for you.

chiuki avatar Aug 06 '15 14:08 chiuki

I think you can convert SVG files to Android VectorDrawable files using online tools, like this one: http://inloop.github.io/svg2android/

AndroidDeveloperLB avatar Feb 29 '16 13:02 AndroidDeveloperLB