skia2/modules
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
..
canvaskit Remove deprecated functions 2020-03-27 17:13:58 +00:00
particles Fix crash when editing particle scripts 2020-02-10 15:08:00 +00:00
pathkit Fix wasm builds 2020-01-28 19:03:49 +00:00
skottie [skottie] Vector-encoded paths 2020-04-01 17:06:04 +00:00
skparagraph Revert "Enable deprecated-copy-dtor warning." 2020-03-31 22:32:07 +00:00
skplaintexteditor Remove SkTMin and SkTMax 2020-02-07 18:40:09 +00:00
skresources use std::make_unique 2019-12-12 22:32:45 +00:00
sksg [skottie] Cleanup: relocate Animator base class out of SkSG 2020-03-26 20:50:10 +00:00
skshaper Remove SkTMin and SkTMax 2020-02-07 18:40:09 +00:00