Commit Graph

85 Commits

Author SHA1 Message Date
Florin Malita
d863ae52d4 [skottie] Fractal noise 'fractal type' support
In addition to various filter modes, ADBE Fractal Noise also supports
a "fractal type" option which controls a post-filter function.

This CL implements support for 4 types:

  - basic:            f(N) = N
  - turbulent basic:  f(N) = abs(N - 0.5)*2
  - turbulent smooth: f(N) = (abs(N - 0.5)*2)^2
  - turbulent sharp:  f(N) = sqrt(abs(N - 0.5)*2)

Change-Id: I4067a414272cbe1c20e1e46d8a46e3bc51d93af0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/377841
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Florin Malita <fmalita@google.com>
2021-03-02 15:50:32 +00:00
Florin Malita
8e4031d1d1 [skottie] Initial fractal noise effect
Supported options:

  - noise type
  - complexity
  - evolution
  - sub influence
  - sub scaling
  - sub rotation
  - sub offset
  - random seed
  - rotation
  - uniform scaling
  - scale/scale width/scale height
  - offset

TBR=
Change-Id: Id54ace54ec2d474e6d016f51db68c8d4fd229a4c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/374676
Commit-Queue: Florin Malita <fmalita@google.com>
Reviewed-by: Florin Malita <fmalita@google.com>
2021-03-01 19:50:10 +00:00
Florin Malita
80aa5b1365 [skottie] Add threshold effect
https://helpx.adobe.com/lv/after-effects/user-guide.html/lv/after-effects/using/stylize-effects.ug.html#threshold_effect

Bug: skia:11311
Change-Id: I9d726b4526f2bbe584f11c77ee2e6829e5148956
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/369156
Commit-Queue: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-02-11 16:35:32 +00:00
Florin Malita
792c2cb44e [skottie] Sphere effect lighting
Plumb lighting props and implement a Phong lighting model.

This is ~40% slower with the SW backend - to mitigate, construct two
runtime effects and only apply fancy lighting when needed.

Change-Id: If6f71253e7adc148f6d5cf5fbde2c1dff977f669
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/368246
Commit-Queue: Florin Malita <fmalita@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2021-02-10 21:34:57 +00:00
Florin Malita
dfa269f1cd [skottie] Implement skew & skew axis support
Also add a SkMatrix::Skew() helper.

Change-Id: I3d385ddda107e54db2d5078e51da4e799defd8ac
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/368016
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Florin Malita <fmalita@google.com>
2021-02-08 22:24:38 +00:00
Florin Malita
f3b1a751cb [skottie] Sphere layer effect
Implement CC Sphere.

No lighting support for now (matches AE's Light Intensity: 0,
Ambient: 100).

Change-Id: I7eb4d8f9c5dd4b4cb312321cefee0231a9901873
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/362457
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Florin Malita <fmalita@google.com>
2021-02-02 18:36:23 +00:00
Florin Malita
8655eab56c [skottie] Add text colorization GM
Expand existing SkottieColorizeGM to also handle text properties and
add text-focused instance.

Update layer names in one of the json assets to match expected demo
prefix ($).

TBR=
Change-Id: I076229067523fe597be66c611a8653897f995bc8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/342916
Reviewed-by: Florin Malita <fmalita@google.com>
Commit-Queue: Florin Malita <fmalita@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2020-12-10 17:10:48 +00:00
Florin Malita
9176c51b5c [skottie] Black & White effect
Add support for Adobe's Black&White effect [1].

Also plumb 'abs' for SkSL.

[1] https://helpx.adobe.com/after-effects/user-guide.html/after-effects/using/color-correction-effects.ug.html#main-pars_heading_2

Change-Id: Ia7dc24d6df9492867a1b1806ce7645586498161a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/329536
Commit-Queue: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2020-10-27 17:03:40 +00:00
Florin Malita
71bcfef9f7 [skottie] Auto-resize and VAlign support for point text
Auto-resizing and vertical alignment require a non-empty text box.  But
currently, the presence of the text box is used to discriminate between
point text [1] and paragraph text [2].

In order to support auto-scaling and v-alignment for point text, we must
decouple the text mode encoding from the text box:

  * introduce and explicit LinebreakPolicy property for skottie::Shaper,
    and use it to control line breaking instead of the text box presence
  * by default, the line breaking policy is initialized per existing
    AE/BM semantics: non-empty text box -> paragraph mode,
    empty box -> point mode
  * the policy can be overridden via the PropertyObserver APIs to enable
    point mode auto-resizing and vertical alignment

[1] https://helpx.adobe.com/after-effects/using/creating-editing-text-layers.html#enter_point_text
[2] https://helpx.adobe.com/after-effects/using/creating-editing-text-layers.html#enter_paragraph_text

Change-Id: I007144283a31a2faa579d7eec82af72af3d540cb
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/321788
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Florin Malita <fmalita@google.com>
2020-10-02 19:33:35 +00:00
Florin Malita
66b45a7f40 [skottie] Add support for invert/YIQ
The Invert layer effect [1] also supports YIQ selectors [2]:

  -- YIQ
  -- Luminance (Y)
  -- In Phase Chrominance (I)
  -- Quadrature Chrominance (Q)

[1] https://helpx.adobe.com/after-effects/using/channel-effects.html#invert_effect
[2] https://en.wikipedia.org/wiki/YIQ

Change-Id: I54b1c81a786ff6f2bdea6456b45b435b2c0fea07
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/316446
Commit-Queue: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2020-09-11 14:55:44 +00:00
Florin Malita
4748c17557 [skottie] Initial Displacement Map effect
Plumb layer size information and add machinery for retrieving layer
content as an SkPicture.

Implement the effect in SkSL.

Current limitations:

  * displacement source layer must be above (on top in stacking order)
    of the target layer
  * if animated, the displacement layer timeline (in/out points) must
    fully cover the target layer timeline
  * Hue/Sat/Lightness selectors are not supported at the moment

These will be addressed in follow-up CLs.

Note: Bodymovin does not export hidden layers by default; if the
displacement source layer is hidden, one should select the "Hidden"
export option.

Change-Id: I11a5c760a9df1e75835a51371f60d5b798e7e38a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/314798
Commit-Queue: Florin Malita <fmalita@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2020-09-11 14:15:44 +00:00
Florin Malita
cdb0f8e523 [skottie] Assorted shape repeater fixes
Refactor the shape repeater using a custom render node (instead of
duplicating per-instance SG nodes).

In the process, fix several issues:

  * scale was not being composed correctly
  * start/end opacity were being ignored
  * non-atomic fragments were being drawn in wrong stacking order

Change-Id: I06cd3606806d1a46852a8557b27c09eb44abdadd
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/313209
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Florin Malita <fmalita@google.com>
2020-08-26 13:24:53 +00:00
Florin Malita
13c4dbe2ef [skottie] Add support for baseline shift
AE allows specifying a baseline shift [1] for text content.

This is essentially a vertical offset.

[1] https://helpx.adobe.com/after-effects/using/formatting-characters-character-panel.html#text_scale_and_baseline_shift

Change-Id: I6abfc47912735376f044769d6be6c25115dc62b6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/312483
Commit-Queue: Florin Malita <fmalita@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
2020-08-21 20:05:10 +00:00
Florin Malita
d1ae99438e [skottie] Add support for inline/data-uri fonts
BM can now export inline fonts, encoded as data-uris.

Extend our DataURIResourceProviderProxy helper to also intercept and
decode inline typefaces.

Change-Id: Iaf1be9db2fd32383af78bc351b1228fe6b3b64bf
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/305685
Commit-Queue: Florin Malita <fmalita@chromium.org>
Commit-Queue: Ben Wagner <bungeman@google.com>
Auto-Submit: Florin Malita <fmalita@chromium.org>
Reviewed-by: Ben Wagner <bungeman@google.com>
2020-07-25 13:46:52 +00:00
Florin Malita
72db717348 [skottie] Add spread/choke support for glow styles
Spread/choke operates as a compression of the alpha channel towards the
low bits.

Change-Id: I82aec1321b60f7f75a79e8280e761d4629f6c923
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/305183
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Florin Malita <fmalita@google.com>
2020-07-22 23:20:02 +00:00
Florin Malita
a524ea266d [skottie] More masking fixes
Assorted bugfixes for the non-analytical mask code path.

1) SkSG modulatePaint() should only override the blend mode when
   one is specified (!= kSrcOver).

2) Some modes (notably intersect) require touching pixels outside the
   mask draw geometry.  These modes must be applied as a layer.
   Introduce an explicit layer node in SkSG, and inject for masks which
   require it.

Also refactor Subtract to use more natural blend and pathops modes,
instead of always inverting geometry.

TBR=
Change-Id: I412168d1ff61eb8e59907babe8f0e091f6fffacf
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/303997
Reviewed-by: Florin Malita <fmalita@google.com>
Commit-Queue: Florin Malita <fmalita@google.com>
2020-07-21 13:58:45 +00:00
Florin Malita
f2d90659ff [skottie] Fix analytical mask fill type
Sksg::Merge needs to preserve the fill type of the first path appended
in the stack.

Theoretically, one could append multiple paths with different fill types
using sksg::Merge, but in practice Skottie should never do that (append
mode with invertible shape only used for the very first mask in a stack).

TBR=
Change-Id: Ie9ac9187cc1c8baaae2bef439313a7700407f04a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/303582
Reviewed-by: Florin Malita <fmalita@google.com>
Commit-Queue: Florin Malita <fmalita@google.com>
2020-07-17 18:35:23 +00:00
Florin Malita
71dc916852 [skottie] Pucker & Bloat shape layer vector effect
Observed semantics:

  -- operates on cubic Bezier path representation
  -- moves vertices towards the shape center, and control points in the
     opposite direction, based on the specified amount
  -- the center is determined as the vertex average
  -- the amount is specified as a fraction of the transition to center
     (0 -> noop, 1 -> fully collapesed to center)
  -- negative and extranormal amount values are allowed
     (invert direction/extrapolate)

TBR=
Change-Id: I7da81a5fe5cffd0e50bd94e6b448565b0b04ed86
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/301582
Reviewed-by: Florin Malita <fmalita@google.com>
Commit-Queue: Florin Malita <fmalita@google.com>
2020-07-10 18:09:53 +00:00
Florin Malita
082323b57d [skottie] Fill-over-stroke support for text
AE allows selecting the paint order when both fill & stroke are present.

The CL also fixes some text stroke issues: stroke width not parsed
correctly and not actually used on the paint.

Change-Id: Iec27bb65d09f689365e43b801d3844106780572b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/301857
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Florin Malita <fmalita@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2020-07-10 14:44:23 +00:00
Florin Malita
cfbb56c6e1 [skottie] Auto-orient fixes
Two issues:

1) For static keyframes (start_value == end_value) AE yields horizontal
   orientation (0 tangent).  We technically have the same logic in
   Skottie, but our value deduplication logic interferes: the two
   consecutive equal values are consolidated, and the result ends up
   holding the spatial lerp info for the next frame => our hold frames
   auto-orient for the beginning of the next keyframe.

   Fix: skip value deduplication when spatial lerp is present.

2) The very last keyframe is always static and holds no spatial info.
   AE retains the orientation of the previous frame, but Skottie yields
   0 tangent.

   Fix: the easiest way to accomplish AE semantics is to detect when
   we're dealing with the last keyframe, and swap with the previous
   keyframe with an adjust weight of 1 (to select the end value).  This
   produces the same lerp result (because keyframed values are always
   contiguous) and also respects the orientation of the prev frame.

TBR=
Change-Id: Id661f7804533e95b747722457489a7ef759572a4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/301176
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Florin Malita <fmalita@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2020-07-08 13:52:27 +00:00
Florin Malita
c7b49bbb9b [skottie] Fix merge paths <-> paints interaction
Unlike other shape path effects, merge paths disables the rendering of
any preceding paints - it only extracts the merged geometry from the
stack.

Update the shape layer attacher logic to suppress paints under merge
paths.

TBR=
Change-Id: I414134839de9eaa4b0f828d8dc6d4721620242bb
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/300897
Commit-Queue: Florin Malita <fmalita@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
2020-07-07 17:28:47 +00:00
Florin Malita
6ec66b9d38 [skottie] Add shape layer Offset Paths support
Based on SkPathOps for now.

Change-Id: Id27c8a235cbd4ab5083735b67cf5d2635ee16cfc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/300497
Commit-Queue: Florin Malita <fmalita@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2020-07-06 16:31:52 +00:00
Florin Malita
8155976877 [skottie] Add line-spacing animator support
AE allows animating the line spacing text property [1].

Observed semantics:

  - spacing is applied as an offset to all fragments in a line
  - for selector/partial coverage, the spacing for a given line
    is the average of the computed spacing for each fragment
  - spacing is cumulative (applies to all lines following)

Plumb the new animator prop ("ls") and expand the existing line
tracking logic to also apply computed spacing offsets.

(also requires a Bodymovin update to export the line spacing property)

[1] https://helpx.adobe.com/after-effects/using/animating-text.html#text_animator_properties

Change-Id: I5517acea8dbc1b2fbae09cb0874f1e53cd2acb90
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/300377
Commit-Queue: Florin Malita <fmalita@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
2020-07-06 15:41:12 +00:00
Florin Malita
6a414b277b [skottie] Layer auto-orient support
AE layers can be tagged for auto-orient - i.e. they observe an
additional rotation component dependent on the position property
animation (position derivative/tangent).

Augment Vec2KeyframeAnimator to optionally track orientation, for both
temporal/linear and spatial (motion-path) keyframes.  Update
TransformAdapter2D to use this orientation when attached to layer
transforms.

Change-Id: I616e45a07b088e9e566b4f88450e95f9315b727c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/291716
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Mike Reed <reed@google.com>
2020-05-25 16:19:23 +00:00
Florin Malita
fbddfbb9f3 [skottie] Introduce an external layer API
Add support for external precomp Skottie layers.  This allows embedders
to seamlessly mix custom/Lottie content.

General flow:

  * embedders register a PrecompInterceptor callback with
    the animation builder
  * at build time, Skottie invokes the callback for each pre-composed
    layer
    - the returned ExternalLayer implementation is used instead of the
      Lottie layer payload
    - (a nullptr value signals Skottie to use the usual Lottie payload)
  * at render time, ExternalLayer::render() is called to defer content
    rendering to the embedder

Also implement a sample PrecompInterceptor which attempts to substitute
precmp layers matching a given pattern with external Lottie animations:

   precomp_name: "__foo.json"  -> Animation("foo.json")

This new mechanism is a generalization of (and supersedes) the old
NestedAnimation hack - so we can remove that.

Change-Id: Id80fe11881c62b8717c2476117c7c03ad5300eef
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/288130
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Mike Reed <reed@google.com>
2020-05-06 20:31:14 +00:00
Florin Malita
a9379fb8ed [skottie] Contrast cleanup
- fix/update sample labels
  - make a note of sin-based improved approximation

TBR=
Change-Id: I53b02cd8a6dd1499805b9782fb6378d344476b87
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/286037
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2020-04-29 13:57:22 +00:00
Florin Malita
f2072332f4 [skottie] Non-legacy (is this modern?) contrast effect support
Implement non-linear contrast using a cubic polynomial approximation,
as a SkRuntimeEffect.

The effect range is significantly more constrained than the legacy
version: https://www.desmos.com/calculator/ehem0vy3ft

Change-Id: I86bdbb9cc0d30065780f87705d2d4d39385609cb
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/285840
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Mike Klein <mtklein@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2020-04-29 12:42:41 +00:00
Florin Malita
fc75d5c52d [skottie] Brightness and Contrast effect
Add support for brightness/contrast, "legacy mode".  This effect can
be represented as a color matrix.

Brightness transfer function: https://www.desmos.com/calculator/zne0oqwwzb

Contrast transfer function: https://www.desmos.com/calculator/x5rxzhowhs

Change-Id: I2e6bb0f5f809aa0f33362bf753d2fe447059eaaa
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/285577
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Mike Reed <reed@google.com>
2020-04-28 14:33:12 +00:00
Florin Malita
bf03ac53f1 [skottie] Initial outer/inner glow
Supported controls:

  - color
  - opacity
  - size
  - inner source (edge/center)

Change-Id: I1ada43fe46fa5557e11279abca6128042acef965
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/285005
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2020-04-23 13:46:48 +00:00
Florin Malita
e35a7ea7a9 [skottie] Initial inner shadow layer style support
Implement drop and inner shadow styles using explicit image filters.

Remove existing style support from DropShadowEffect.cpp, as it now
has a new cozy place with its inner sibling.

Supported properties:

  - color
  - opacity
  - angle
  - distance
  - size (sigma)

Change-Id: I5b7e3c75678e036a20c1908b84c74a670a5aa196
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/283918
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2020-04-17 19:57:08 +00:00
Florin Malita
0022f5cf1b [SkTrimPathEffect] Preserve wrap-around continuity
In inverted mode (Mode::kInverted), the trim result represents the
logical segment [stop..start] (wrapping around at the path's end).

We currently emit two segments [0..start] and [stop..1], in that
exact order.  This behavior breaks continuity for single closed
contour paths.

Update SkTrimPath to

1) emit the segments in the correct order ([stop..1],[0..start])

2) skip the connecting moveTo for closed paths

Bug: skia:10107
Change-Id: Icd280554ba7291c985f504793feff104df2a4a99
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/281882
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2020-04-07 14:40:17 +00:00
Florin Malita
0ba30328d0 [skottie] Corner pin effect
Note: works for well-formed poly-to-poly (perspective) transforms, but
doesn't support AE's degenerate corners semantics (concave/inverted
polys) at this point.

Bug: skia:10100
Change-Id: I5b3492b008302495b616867c139c6e5ad6dc57df
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/281595
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2020-04-05 16:47:06 +00:00
Florin Malita
ae58199380 [skottie] Initial drop shadow style support
Plumb layer style parsing, and extend existing DropShadowAdapter to
support both drop shadow style and drop shadow effect.

Change-Id: Id99a419dacd06dc38dc4cf84ff4ecb92218c45f7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/279020
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2020-03-25 12:14:26 +00:00
Florin Malita
ae2da5e7f9 [skottie] Add another text grouping test
TBR=

Change-Id: I9c1ca3e834fdc5b017446811db52582a326d777b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/274740
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2020-03-03 15:17:20 +00:00
Florin Malita
960f3d4cd1 [skottie] Text anchor point grouping support
Implement all AE grouping modes: character/word/line/all.

 -- character grouping was already supported (default mode)

 -- for word and line grouping, expand the existing domain mapping logic
    to also track cumulative advance and max(ascent) per span, then use
    this info to compute anchor point boxes

 -- for "all" grouping, the anchor point box coincides with the text box

(https://helpx.adobe.com/after-effects/using/animating-text.html#text_anchor_point_properties)

TBR=
Change-Id: I8564f1349d167d82c31862d8f7e57615cdae0dcf
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/274201
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2020-03-02 23:07:39 +00:00
Florin Malita
c4fae744d0 [skottie] Fix handling of time-reversed precomp layers
With time-reverse enabled

 - inPoint/outPoint are reversed
 - time stretch is negative

Bug: skia:9958
Change-Id: I5c1197251608aad4b0417cde6ca2600b1b2822fc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/273808
Commit-Queue: Avinash Parchuri <aparchur@google.com>
Reviewed-by: Avinash Parchuri <aparchur@google.com>
2020-02-28 19:42:51 +00:00
Florin Malita
917dddece6 [skottie] Add support for text grouping alignment
AE allows relative adjustments for text animator transform anchor
points [1].

[1] https://helpx.adobe.com/after-effects/using/animating-text.html#text_anchor_point_properties

Change-Id: If98d6b522e73a768ed2358d918867d2aefd09071
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/274044
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2020-02-28 18:59:05 +00:00
Florin Malita
9642b31a71 [skottie] Add support for text animator blur
In adition to transforms/opacity/etc, text animators can target
per-glyph opacity.

Change-Id: I6ab63a6e49a64beaf63fc955f0b672a5b8ba84ba
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/272886
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2020-02-24 14:01:16 +00:00
Florin Malita
178b860769 [skottie] Initial support for per-character 3D
When per-character 3D is enabled, text properties can be animated in
3 dimensions.

 - position and scale become 3-value vectors
 - in addition to existing "r" (really rz), rotation gains "rx" and "ry"
 - instead of specializing for 3D, expand the existing structures to
   handle both 3D and 2D modes
 - also ensure that sksg::Transform does not flatten to SkMatrix

Change-Id: I426a7ee1ff38c1702deb85e9f1db80f6069f36d6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/272648
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2020-02-21 21:14:02 +00:00
Florin Malita
0de01c05b7 [skottie] Clip overflowing paragraph lines
AE discards lines with baselines outside the paragraph box.

This aligns Skottie's behavior with AE for default/top-alignment
(but not for any of the custom vertical alignment modes).

Bug: skia:9933
Change-Id: Id0318f0744bf89580774e89494faf19bfb6f6d14
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/272376
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2020-02-20 18:35:15 +00:00
Florin Malita
4a6a640299 [skottie] Add support for ADBE Pro Levels2 effect
Similar to existing ADBE Easy Levels2, but provides separate mapping
controls per channel.

Change-Id: Ibc58c58e1e8cb8793d6eb819998c1804ccbbf859
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/268936
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2020-02-05 21:05:08 +00:00
Florin Malita
cc982ecbca [skottie] Cleanup: convert remaining effects to new adapter pattern
Also add a couple of tests for missing coverage.

TBR=
Change-Id: I420c71d73657c5d003fda94a4c43dde20a1a6b87
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/267556
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2020-01-30 15:30:08 +00:00
Florin Malita
ad9110026b [skottie] Separate text resize options
The sk_vj text property (Skottie extension) is currently mixing
vertical alignment and resizing semantics into a single enum.  This
precludes certain valid combinations.

Split the resize options into a separate enum (ResizePolicy), and ensure
support for all combinations.

Before:

  "sk_vj": 0 -> Shaper::VAlign::kVisualTop
  "sk_vj": 1 -> Shaper::VAlign::kVisualCenter
  "sk_vj": 2 -> Shaper::VAlign::kVisualBottom
  "sk_vj": 3 -> Shaper::VAlign::kVisualResizeToFit
  "sk_vj": 4 -> Shaper::VAlign::kVisualDownscaleToFit


After:

  "sk_vj": 0 -> Shaper::VAlign::kVisualTop
  "sk_vj": 1 -> Shaper::VAlign::kVisualCenter
  "sk_vj": 2 -> Shaper::VAlign::kVisualBottom

  "sk_rs": 0 -> Shaper::ResizePolicy::kNone
  "sk_rs": 1 -> Shaper::ResizePolicy::kScaleToFit
  "sk_rs": 2 -> Shaper::ResizePolicy::kDownscaleToFit


Bug: skia:9809, skia:9810
Change-Id: I631ae1fa31a9bc9c6958bb480354138591d504ff
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/267040
Reviewed-by: Ben Wagner <bungeman@google.com>
Reviewed-by: Isabel Ren <isabelren@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2020-01-29 00:09:42 +00:00
Florin Malita
7c7cd30550 [skottie] Add custom props rendering GM
Also fix a couple of custom props issues:

  - solid layer colors were not dispatched
  - text values were not sync'ed

TBR=
Change-Id: I827f8c1d8c8bb73b03f05de15e1c7c96753a631e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/264936
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2020-01-17 13:53:02 +00:00
Florin Malita
46a331b93f [skottie] Cascading track matte support
Currently, we treat track matte source layers (tagged with td:1) as single-shot mask triggers:
we apply once to the following layer, then move on.

But track mattes can cascade: a layer with a matte can itself be applied as a track matte for the
following layer.

Also, for matte/masking purposes, only the layer content is being considered (ignoring blend mode
and any masks applied to the matte itself).

To support this, refactor the layer attachment code:

  - instead of tracking the presence of a single-shot matte source, always track
    previous layer content trees
  - instead of triggering matte attachment in the presence of a matte source, trigger based on
    the matte *target* property (tt: X)
  - log errors on unknown matte modes

Change-Id: I6c71d4007e1e27d3f3a139344bbf367d7bc6e29d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/259820
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2019-12-12 21:42:11 +00:00
Florin Malita
e1fa70000a [skottie] Invert effect support
https://helpx.adobe.com/after-effects/using/channel-effects.html#invert_effect

Change-Id: Iac8e291ab9cb57714c50f1e40cecb66b3dc64ee1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/259276
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Mike Klein <mtklein@google.com>
2019-12-11 23:07:04 +00:00
Florin Malita
6cc49538b3 [skottie] Fix precomposed camera sizing
Precomp layers can have a different size vs. main composition.

Instead of relying on the global animation (main comp) size, use the
current (pre)comp size when setting up cameras.

Change-Id: I54106375fb39dde2bfd11e14a38e5ec3e7190764
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/258156
Commit-Queue: Florin Malita <fmalita@chromium.org>
Commit-Queue: Mike Reed <reed@google.com>
Auto-Submit: Florin Malita <fmalita@chromium.org>
Reviewed-by: Mike Reed <reed@google.com>
2019-12-05 14:34:15 +00:00
Florin Malita
ad76b2ee25 [skottie] One-node camera support
So far Skottie has been assuming all cameras are two-node (have a point
of interest).

AE also supports one-node cameras, where the camera does not auto-orient
towards a POI but starts off perpendicular to the z == 0 plane.

(https://helpx.adobe.com/after-effects/how-to/camera-animation.html)

Change-Id: Id565de7d8feb9a762940ac372c1bbbcce2e2dfc6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/254559
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2019-11-14 18:45:18 +00:00
Florin Malita
91a1ec34bf [skottie] Streamlined gradient stop merger
Refactor as a single interpolating loop, based on careful selection
of lerp coefficients.

Change-Id: I58786cddb2f042b53dcbac80c2346736429be102
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/252858
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Mike Reed <reed@google.com>
2019-11-05 19:44:11 +00:00
Florin Malita
73a722ce97 [skottie] Fix trim path mode interpretation
"m": 1 -> parallel trim
  "m": 2 -> serial trim

(we had these backwards)

TBR=
Bug: skia:9599
Change-Id: Ib764c04a96c3a1e627553d8b8588028a411b5240
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/252796
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2019-11-05 18:31:24 +00:00