skia2/modules/skottie/skottie.gni
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

88 lines
2.7 KiB
Plaintext

# Copyright 2018 Google Inc.
#
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# Things are easiest for everyone if these source paths are absolute.
_src = get_path_info("src", "abspath")
_include = get_path_info("include", "abspath")
skia_skottie_public = [
"$_include/Skottie.h",
"$_include/SkottieProperty.h",
]
skia_skottie_sources = [
"$_src/Adapter.h",
"$_src/Camera.cpp",
"$_src/Camera.h",
"$_src/Composition.cpp",
"$_src/Composition.h",
"$_src/Layer.cpp",
"$_src/Layer.h",
"$_src/Path.cpp",
"$_src/Skottie.cpp",
"$_src/SkottieJson.cpp",
"$_src/SkottieJson.h",
"$_src/SkottiePriv.h",
"$_src/SkottieProperty.cpp",
"$_src/SkottieValue.cpp",
"$_src/SkottieValue.h",
"$_src/Transform.cpp",
"$_src/Transform.h",
"$_src/animator/Animator.cpp",
"$_src/animator/Animator.h",
"$_src/animator/Keyframe.cpp",
"$_src/animator/Keyframe.h",
"$_src/animator/Scalar.cpp",
"$_src/animator/Shape.cpp",
"$_src/animator/Vec2.cpp",
"$_src/animator/Vector.cpp",
"$_src/animator/Vector.h",
"$_src/effects/DropShadowEffect.cpp",
"$_src/effects/Effects.cpp",
"$_src/effects/Effects.h",
"$_src/effects/FillEffect.cpp",
"$_src/effects/GaussianBlurEffect.cpp",
"$_src/effects/GradientEffect.cpp",
"$_src/effects/HueSaturationEffect.cpp",
"$_src/effects/InvertEffect.cpp",
"$_src/effects/LevelsEffect.cpp",
"$_src/effects/LinearWipeEffect.cpp",
"$_src/effects/MotionBlurEffect.cpp",
"$_src/effects/MotionBlurEffect.h",
"$_src/effects/MotionTileEffect.cpp",
"$_src/effects/RadialWipeEffect.cpp",
"$_src/effects/ShiftChannelsEffect.cpp",
"$_src/effects/TintEffect.cpp",
"$_src/effects/TransformEffect.cpp",
"$_src/effects/TritoneEffect.cpp",
"$_src/effects/VenetianBlindsEffect.cpp",
"$_src/layers/ImageLayer.cpp",
"$_src/layers/NullLayer.cpp",
"$_src/layers/PrecompLayer.cpp",
"$_src/layers/SolidLayer.cpp",
"$_src/layers/TextLayer.cpp",
"$_src/layers/shapelayer/Ellipse.cpp",
"$_src/layers/shapelayer/FillStroke.cpp",
"$_src/layers/shapelayer/Gradient.cpp",
"$_src/layers/shapelayer/MergePaths.cpp",
"$_src/layers/shapelayer/Polystar.cpp",
"$_src/layers/shapelayer/Rectangle.cpp",
"$_src/layers/shapelayer/Repeater.cpp",
"$_src/layers/shapelayer/RoundCorners.cpp",
"$_src/layers/shapelayer/ShapeLayer.cpp",
"$_src/layers/shapelayer/ShapeLayer.h",
"$_src/layers/shapelayer/TrimPaths.cpp",
"$_src/text/RangeSelector.cpp",
"$_src/text/RangeSelector.h",
"$_src/text/SkottieShaper.cpp",
"$_src/text/SkottieShaper.h",
"$_src/text/TextAdapter.cpp",
"$_src/text/TextAdapter.h",
"$_src/text/TextAnimator.cpp",
"$_src/text/TextAnimator.h",
"$_src/text/TextValue.cpp",
"$_src/text/TextValue.h",
]