skia2/modules/skottie
Florin Malita eeaabc4ba2 [skottie] Vector-encoded paths
Lottie shapes (paths) are expressed as a sequence of vertices, where
each vertex has a

  - position
  - in-tangent control point (relative to position)
  - out-tangent control point (relative to position)

A nice property of this representation, is that interpolation can be
performed independently on each scalar component.

This seems really close to what VectorAnimator is good at - so can we
shoe-horn shapes into vectors and drop the ShapeValue KeyframeAnimator
specialization?  Yes, we can!

To support the conversion, we need to abstract out two aspects of the
VectorKeyframeAnimator builder:

  - parsing the encoding length of a vector-representable object
  - parsing the actual encoding data of a vector-representable object

(For current/regular vector values, the encoding length is the same as
the json array length, and the encoding data is just the array of json
numbers.)

Shapes are encoded as a sequence of 6 floats per vertex, plus an
additional/trailing boolean maker for the "closed shape" property:

 [v0.posX, v0.posY, v0.inX, v0.inY, v0.outX, v0.outY, ..., closed_flag ]

(thus encoding_len == 6 * vertex_count + 1)

After we're done with parsing, animation/interpolation is handled
via existing VectorKeyframeAnimator - so we can remove
KeyframeAnimator<ShapeValue>.

Converting to SkPath is pretty much the same as for the previous
representation, except the input is now flattened.

Change-Id: I822797fceae561b52b709bf258163bbcc6b565fb
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/280898
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2020-04-01 17:06:04 +00:00
..
fuzz rewrite includes to not need so much -Ifoo 2019-04-24 16:27:11 +00:00
gm rm Sk3D.h -- long live SkMat4 2020-02-20 13:15:33 +00:00
include [skottie] Cleanup: relocate Animator base class out of SkSG 2020-03-26 20:50:10 +00:00
src [skottie] Vector-encoded paths 2020-04-01 17:06:04 +00:00
tests [skottie] Lazy adapter sync 2020-03-30 16:06:02 +00:00
utils This change allows users of PropertyObserver to compose a full keypath for each of the modified properties. 2020-02-12 14:13:13 +00:00
BUILD.gn rm Sk3D.h -- long live SkMat4 2020-02-20 13:15:33 +00:00
skottie.gni [skottie] Vector-encoded paths 2020-04-01 17:06:04 +00:00