Commit Graph

28 Commits

Author SHA1 Message Date
Florin Malita
1022f74375 [skottie] Nested animation support
Extend composition layers to support referencing external .json
animations ("$"<PATH> syntax).

This is a custom extension (not supported in BM/Lottie).

Also make skottie::Animation ref-counted, to facilitate sharing.

TBR=

Change-Id: I062d031e5868d759f3930dea9b261f9b3ec81684
Reviewed-on: https://skia-review.googlesource.com/109806
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-02-23 19:15:26 +00:00
Florin Malita
796cda11e4 [skottie] FMA-friendlier lerp
TBR=

Change-Id: Id43e463da99bb0478c48ba48a909cead817e4498
Reviewed-on: https://skia-review.googlesource.com/103600
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-02-05 16:07:46 +00:00
Florin Malita
f8393c8619 [skottie] Split-position support
TBR=

Change-Id: I82433bc9a73f89956c2b25146e1521412d125945
Reviewed-on: https://skia-review.googlesource.com/102622
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-02-01 17:48:08 +00:00
Florin Malita
21d0e8b0a6 [skottie] Clamp SkCubicMap results to [0,1]
Looks like SkCubicMap can produce slightly out-of-range values.

That's prolly some unimportant precision artifact, but since we're
asserting t is in [0,1] down the line it'd be nice to not crash in debug.

TBR=

Change-Id: I048b691d1c0f0977556d5b25893a6dab2b9986cc
Reviewed-on: https://skia-review.googlesource.com/102480
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-01-31 22:47:15 +00:00
Florin Malita
aa71c899fd [skottie] Anti-alias masks
TBR=

Change-Id: I16eca80b515fde8ad87a79c01ffd0ea2b3e31259
Reviewed-on: https://skia-review.googlesource.com/101740
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-01-30 14:47:45 +00:00
Florin Malita
38ea40eb75 [skottie] Layer clip support
TBR=

Change-Id: Ibf65efc69031f8f6e19f4f28cccab29c357e704d
Reviewed-on: https://skia-review.googlesource.com/101540
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-01-29 21:57:44 +00:00
Florin Malita
eb87d67a83 [skottie] Time start, time stretch
Pre-compositions (only) can have their timelines adjusted via bias and
scale.

TBR=

Change-Id: I519fa1d7cf210f7f152dcabcbe004119a2cf08d9
Reviewed-on: https://skia-review.googlesource.com/101460
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-01-29 21:12:13 +00:00
Florin Malita
cca86f386c [skottie] Hierarchical animators
Instead of a flat animator space, introduce animator groups.

This allows us to encapsulate layer animators and only dispatch ticks
when their owning layer is active.

TBR=

Change-Id: I1fc8a55abf68a712b71969bb1a11275dbe54c236
Reviewed-on: https://skia-review.googlesource.com/101201
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-01-29 16:16:21 +00:00
Florin Malita
dd22cf96d3 Revert "[skottie] Cache attached assets"
This reverts commit ba3ed69a4e.

Reason for revert:

Looks like asset references can manipulate the timeline (preComps),
so we do need distinct instances for each ref.

May revisit in the future for cases where all instances share the same timeline.

Original change's description:
> [skottie] Cache attached assets
> 
> This avoids redundant instantiations for assets referenced multiple
> times.
> 
> TBR=
> 
> Change-Id: I8f61f73e695f0d567e55ef077c7d3fb344399f12
> Reviewed-on: https://skia-review.googlesource.com/101002
> Reviewed-by: Florin Malita <fmalita@chromium.org>
> Commit-Queue: Florin Malita <fmalita@chromium.org>

TBR=fmalita@chromium.org

Change-Id: I3e537ace9dfbf69a11f421992db033a0f8ad2aa9
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/101220
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-01-29 15:42:10 +00:00
Florin Malita
5effc281c7 [skottie] Reduce parser verbosity
TBR=

Change-Id: I9a949cfb9e7625b93988d9fc251c8696ae99007a
Reviewed-on: https://skia-review.googlesource.com/101080
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-01-29 15:00:49 +00:00
Florin Malita
ba3ed69a4e [skottie] Cache attached assets
This avoids redundant instantiations for assets referenced multiple
times.

TBR=

Change-Id: I8f61f73e695f0d567e55ef077c7d3fb344399f12
Reviewed-on: https://skia-review.googlesource.com/101002
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-01-29 04:59:58 +00:00
Florin Malita
4a49068faf [skottie] Simplify layer matrix caching
Switch to SkTHashMap, unify the cache based on layer index.

TBR=

Change-Id: I7e7622571156d67b4fe5ef91ee9a9a49b089c78f
Reviewed-on: https://skia-review.googlesource.com/101001
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-01-28 19:47:18 +00:00
Florin Malita
75f4c40588 [skottie] Switch animators to SkTArray
TBR=

Change-Id: I8acc02f176e7dffd344456ad4cc39936e9a9618f
Reviewed-on: https://skia-review.googlesource.com/101000
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-01-28 17:56:28 +00:00
Florin Malita
1eb98dba2f [skottie] Add 'rz' rotation support
TBR=

Change-Id: I6dd82e5dc516faac091e5173688d2bc977e4fcaa
Reviewed-on: https://skia-review.googlesource.com/100280
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-01-26 20:34:00 +00:00
Florin Malita
fc807c885b [skottie] Refactor animators
Separate storage for values, cubic maps, repeated values deduplication.

TBR=

Change-Id: Ibfbcea91ef1d7b1da937b4af44079e7612d410cb
Reviewed-on: https://skia-review.googlesource.com/99981
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-01-26 13:13:24 +00:00
Florin Malita
cf8ed52895 [skottie] Parser cleanup
Consolidate parsing utils into their own CU.

TBR=

Change-Id: Idbf6db5220135ba91df6ebefce3a241c6ec4af15
Reviewed-on: https://skia-review.googlesource.com/99721
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-01-25 21:23:18 +00:00
Florin Malita
a55a591e5a [skottie] Cache the last keyframe
We can avoid searching on every tick.

TBR=

Change-Id: Ifc3ff40f1f5ec2bf865c09a8e784223aa8a96674
Reviewed-on: https://skia-review.googlesource.com/99580
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-01-25 00:37:11 +00:00
Florin Malita
2518a0a328 [skottie] Animator scrubbing
Use std::function and lambda closures to capture node type info.

Reduces the template degree.

TBR=

Change-Id: Id81ff3e2e1fca5c8acaaf2d0fc67e608d6f3d606
Reviewed-on: https://skia-review.googlesource.com/99261
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-01-24 23:53:51 +00:00
Florin Malita
2d5fb12526 [skottie] Clamp keyframe values
We can skip interpolation if |t| is out of range or the interval is
constant ("hold").

TBR=
Change-Id: I0602d36557f46592ab673201ed2b4a96d40dc461
Reviewed-on: https://skia-review.googlesource.com/99420
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-01-24 19:52:49 +00:00
Florin Malita
7b3415cb10 [skottie] "hold" keyframe support
TBR=

Change-Id: I5388bc5a5d24b3bbe3962b2da646719e95efe858
Reviewed-on: https://skia-review.googlesource.com/99281
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-01-24 16:37:20 +00:00
Florin Malita
25366fad43 [skottie] Initial mask support
TBR=

Change-Id: Ibf4baeb17f98e1ed359f04deefe2f1c09414540d
Reviewed-on: https://skia-review.googlesource.com/98840
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-01-23 18:59:20 +00:00
Florin Malita
ca4439f6fd [skottie] Discard orphaned geometry animators
TBR=
NOTRY=true
Change-Id: I8e4de99c8ebc3ec28509753b59a287d896e65aea
Reviewed-on: https://skia-review.googlesource.com/98705
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Florin Malita <fmalita@chromium.org>
2018-01-23 16:22:38 +00:00
Florin Malita
ad335bbfaf [skottie] Improved animation params parsing
Some BM versions wrap the Bezier animation params into arrays.

TBR=
Change-Id: I376b1ed2079105066413b513c3df33a61440cf41
Reviewed-on: https://skia-review.googlesource.com/98580
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-01-23 04:46:45 +00:00
Florin Malita
055b0f5cb0 [skottie] Improved trim path support
|offset| is an angular value in [0..360].

TBR=
Change-Id: I10a91bec7e8f43db1f54c8b5358dd0604c974998
Reviewed-on: https://skia-review.googlesource.com/98560
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-01-23 04:42:45 +00:00
Florin Malita
35efaa8fd7 [sksg] Animator, Scene
Relocate some reusable logic from Skottie

TBR=
Change-Id: I8764e666c9f1127ed895ee1d16cd66d052469ac5
Reviewed-on: https://skia-review.googlesource.com/98160
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-01-22 18:31:17 +00:00
Florin Malita
ee6de4b5fa [skottie] Only apply effects to non-empty geometry stacks
TBR=
Change-Id: Iaafd63c787b72cdf83b21bd39cc10d01612e435d
Reviewed-on: https://skia-review.googlesource.com/97662
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-01-21 16:46:51 +00:00
Florin Malita
16d0ad06b4 [skottie,sksg] Improved shape group semantics
* paints also apply to preceding nested geometries
  * path effects also apply to preceding nested geometries

TBR=
Change-Id: Ic72f8d032fb5823f506ff688630b786a23219f20
Reviewed-on: https://skia-review.googlesource.com/97222
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-01-19 20:44:56 +00:00
Florin Malita
54f65c473f Skotty -> Skottie
Change-Id: If8b6516024c69b0fc256208874f6666a4e70e12c
Reviewed-on: https://skia-review.googlesource.com/95241
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-01-17 14:15:36 +00:00