541 Commits

Author SHA1 Message Date
7cb217b980 test: automated golden tests
Any riv added to `test/assets/batch_rive` will automatically be tested. The test includes:
1. Setting up the animation to play the default state machine
2. Render first frame
3. Advance by three quarters of a second
4. Advance by two seconds

Diffs=
7c3f77dd6 test: automated golden tests (#5785)

Co-authored-by: Gordon <pggordonhayes@gmail.com>
2023-08-10 15:13:47 +00:00
1da10ef040 fix: remove default font from flutter runtime
Removing the default font logic from the runtime, because:
- Flutter Web will console log an error trying to load the default font from a URL
- `rootBundle` prevents tests as it cannot be spoofed.

Diffs=
b905380c9 fix: remove default font from flutter runtime (#5783)

Co-authored-by: Gordon <pggordonhayes@gmail.com>
2023-08-10 13:46:04 +00:00
047c6ab39a chore: add git lfs to flutter test runner
Diffs=
d5162f1e1 chore: add git lfs to flutter test runner (#5782)

Co-authored-by: Gordon <pggordonhayes@gmail.com>
2023-08-10 12:29:21 +00:00
07665f3cc9 update mono to apply .gitattribute changes first & made a trivial cha…
…nge in rive_flutter to push downstream

tested this on a couple of private repos.

this also ran a linter on mono.sh 🙈 i guess that should be fine though

Diffs=
96a0f0b96 update mono to apply .gitattribute changes first & made a trivial cha… (#5781)
cbc6ba291 Add rive::math::msb() (#5777)
58cc49580 Add a Bitmap::detachBytes method (#5763)
30351d475 Letter spacing! (#5774)
e6941215f refactor: use ticker instead of stopwatch (#5761)
3ab062dd2 Run editor tests on hosted runner. (#5760)

Co-authored-by: Alex Gibson <agibson.uk@gmail.com>
Co-authored-by: Gordon <pggordonhayes@gmail.com>
Co-authored-by: Luigi Rosso <luigi-rosso@users.noreply.github.com>
Co-authored-by: Maxwell Talbot <talbot.maxwell@gmail.com>
2023-08-10 10:33:33 +00:00
59b73de9b7 refactor: hit testing
- Moves the hit testing logic from `RiveAnimation` to the `Rive` render box instead. Setting the default to be false, and users have to opt in to enable it. This is to ensure we don't break code for anyone that currently handles their own pointer logic, and also to avoid unnecessarily doing work if it's not needed.
- Add onEnter and onExit to resolve https://github.com/rive-app/rive-flutter/issues/284
- Adds ability to set cursor (this had to be overridden to allow for onEnter/onExit) and makes sense to expose publicly. Note though that this will be for the entire render box area. It won't work for "part" of an artboard that has a listener. Though we could look into adding that in the future.

Diffs=
2eb7308d2 refactor: hit testing (#5731)

Co-authored-by: Gordon <pggordonhayes@gmail.com>
2023-08-08 13:21:09 +00:00
7bf4ec8fda Fix loading init text in Flutter runtime.
The important work is done in _initTextAndImport. This functionality needs to be called by the user if they call RiveFile.import. See the changelog for some notes.

I needed to bump rive_common for this to work as we manually added our fixRequireJs fix to the HTML. We should always try to inject functionality that's required at runtime dynamically so it can apply to all apps (not just our editor).

Diffs=
d072cbde0 Fix loading init text in Flutter runtime. (#5758)

Co-authored-by: Luigi Rosso <luigi-rosso@users.noreply.github.com>
2023-08-07 18:55:50 +00:00
a2bb7294c6 Updating rive_common and rive_flutter with memory leak fix.
Rolls fixes from https://github.com/rive-app/rive/pull/5752 into the editor via rive_common and updates rive_flutter to use the latest rive_common.

Diffs=
133fe44e4 Updating rive_common and rive_flutter with memory leak fix. (#5753)
2f67af55f fix leak in move operator= on SimpleArray (#5752)
b3a367dad Make rive_decoders compile on Windows (#5733)

Co-authored-by: Luigi Rosso <luigi-rosso@users.noreply.github.com>
2023-08-05 15:36:27 +00:00
afe42b0998 Clipping and baseline
The way we were computing the bounds for clipping was off which also exposed it was off in the runtime for transform constraints! This was also breaking the Lottie converter.

Now the origin, baseline, bounds, and clipping all look right in Flutter + C++. Goldens would help here too @mjtalbot

<img width="1152" alt="CleanShot 2023-08-02 at 11 50 36@2x" src="https://github.com/rive-app/rive/assets/454182/5b7d580e-9d82-4e7b-8b91-7155a2c89fa6">

Fixes #5732
Fixes issue discussed here: https://2dimensions.slack.com/archives/CLLCU09T6/p1690977600095549

Diffs=
d3e75b38d Clipping and baseline (#5734)

Co-authored-by: Luigi Rosso <luigi-rosso@users.noreply.github.com>
2023-08-02 20:30:01 +00:00
8c12763c6b docs: add awesome-rive to README
Diffs=
50f10716b docs: add awesome-rive to README (#4866)

Co-authored-by: Gordon <pggordonhayes@gmail.com>
2023-08-02 18:30:30 +00:00
4134e1961d Enable animation for Text Run style prop
<img width="262" alt="CleanShot 2023-08-01 at 10 17 31@2x" src="https://github.com/rive-app/rive/assets/8057513/ee375ef9-7a23-418b-81a2-6f38bc102200">

Diffs=
da909105a Enable animation for Text Run style prop (#5726)
2023-08-01 21:40:44 +00:00
b6fbd4fe9e Fix transform constraint trying to transform to shape bounds.
Diffs=
bd9a2e12a Fix transform constraint trying to transform to shape bounds. (#5727)

Co-authored-by: Luigi Rosso <luigi-rosso@users.noreply.github.com>
2023-08-01 18:44:45 +00:00
79836aea3d chore: release flutter v0.11.9
Diffs=
1192a06b9 chore: release flutter v0.11.9 (#5723)

Co-authored-by: Gordon <pggordonhayes@gmail.com>
2023-08-01 15:53:15 +00:00
01a12255ea basic text test
adding a basic text test to get to the bottom of text not working

Diffs=
66e234066 basic text test (#5718)
b69ae1312 Lift tess decoders into a static lib (#5709)

Co-authored-by: Maxwell Talbot <talbot.maxwell@gmail.com>
2023-08-01 14:48:05 +00:00
f14627211e chore: end with call to dispose
Fixes: https://github.com/rive-app/rive-flutter/issues/335

By calling `super.dispose()` at the end - as suggested in the Flutter docs for widgets + render objects.

Added the same to the editor (for widgets + render objects)

These changes _should_ not result in any issues. But I don't know if there are valid reasons for any of these to call super.dispose first - if yes, then we should investigate the underlying reason for that.

Diffs=
913760d97 chore: end with call to dispose (#5703)

Co-authored-by: Gordon <pggordonhayes@gmail.com>
2023-08-01 11:52:24 +00:00
bd683637d2 chore: add pubspec topics
See [Pub topics](https://dart.dev/tools/pub/pubspec#topics) and [existing topics](https://pub.dev/topics)

Diffs=
1db023d07 chore: add pubspec topics (#5704)
baefd620c Fix crash when no Follow path target specified (#5706)

Co-authored-by: Gordon <pggordonhayes@gmail.com>
2023-08-01 11:50:30 +00:00
6ce24aa349 Update text render styles when origin changes.
Diffs=
caed30e55 Update text render styles when origin changes. (#5699)

Co-authored-by: Luigi Rosso <luigi-rosso@users.noreply.github.com>
2023-07-29 03:47:42 +00:00
2f7d8763e7 Text fixes
Bunch of text fixes:
- gradients respect origin on text
- changing font size updates the text editor selection
- apply @avivian's transform constraint fix from https://github.com/rive-app/rive/pull/5689 to cpp

Diffs=
6af562d4c Text fixes (#5696)
fcccdeccd Add originX and originY support to images (#5624)
5b2a52f44 Fix text alignment in cpp based runtimes (#5691)

Co-authored-by: Luigi Rosso <luigi-rosso@users.noreply.github.com>
2023-07-29 01:49:02 +00:00
8ac04725c9 Replace broken hero image on runtime READMEs
Separate PRs for react + react native

Diffs=
dd6983034 Replace broken hero image on runtime READMEs (#5690)
5034c8612 Build with rive_text from Android Studio (#5681)

Co-authored-by: Zachary Plata <plata.zach@gmail.com>
2023-07-28 15:38:19 +00:00
96627405fa Keep width height in rivs
[Archive.zip](https://github.com/rive-app/rive/files/12175519/Archive.zip)

re-adds the width height stuff, so that we do not remove parameters from files, as the "old" runtimes still need these to layout assets properly

included the same .riv once broken and once "fixed" @luigi-rosso i got a question about this "widthChanged/heightChanged"

Diffs=
a1b1c1ec3 Keep width height in rivs (#5672)
be33bd1b1 update thumbnailer for text (#5667)

Co-authored-by: Luigi Rosso <luigi.rosso@gmail.com>
Co-authored-by: Maxwell Talbot <talbot.maxwell@gmail.com>
2023-07-26 18:20:16 +00:00
c1c4c94533 Updates for publishing Rive Flutter
Some updates to clean up warnings and info reported from flutter analyze.

Diffs=
83e539cff Updates for publishing Rive Flutter (#5666)

Co-authored-by: Luigi Rosso <luigi-rosso@users.noreply.github.com>
2023-07-25 23:36:50 +00:00
8dfb05c64d Adding run targeting to text value ranges!
Ability to target an individual run with the modifier range:
<img width="1577" alt="CleanShot 2023-07-24 at 16 25 12@2x" src="https://github.com/rive-app/rive/assets/454182/48bca39b-057c-4ed5-b04e-cada62c1f190">

Diffs=
215d11c86 Adding run targeting to text value ranges! (#5660)

Co-authored-by: Alex Gibson <agibson.uk@gmail.com>
Co-authored-by: Luigi Rosso <luigi-rosso@users.noreply.github.com>
2023-07-25 22:26:38 +00:00
810730f00c Follow path distance support all values & fix scaling issue.
Fixes the following as discussed:
- FP not respecting scale values of constrained component
- FP not handling distance values <0 and >100

This video shows 4 scenarios (all 4 show car being scaled from 100-500% and back):

TL - distance animating from 0 to 200 with orient on
TR - distance animating from 0 to -100 with orient on
BL - distance animating from 0 to 100 with orient on and animating path
BR - distance animating from 0 to 100 with orient off and car rotating 720 degrees

https://github.com/rive-app/rive/assets/186340/15156cec-ac90-4b67-8bfb-b4a60e99090f

Diffs=
24aaadf9a Follow path distance support all values & fix scaling issue. (#5659)

Co-authored-by: Philip Chung <philterdesign@gmail.com>
2023-07-25 21:48:13 +00:00
a69627fb3c Runtime clip text
Clippy clip

Diffs=
f49673939 Runtime clip text (#5661)

Co-authored-by: Alex Gibson <agibson.uk@gmail.com>
2023-07-25 08:58:11 +00:00
9e7a831df6 Make TextValueRun visible to clients and NestedArtboards too.
Makes this easier:
```
class MyController extends RiveAnimationController<Artboard> {
  @override
  bool init(Artboard core) {
    var run = core.component<TextValueRun>("blah");
    run?.text = "HEEEEEY";

    return super.init(core);
  }

  @override
  void apply(Artboard? core, double elapsedSeconds) {}
}
```

Also exposes NestedArtboard which lots of users have requested.

Diffs=
fa36ec055 Make TextValueRun visible to clients and NestedArtboards too. (#5657)

Co-authored-by: Luigi Rosso <luigi-rosso@users.noreply.github.com>
2023-07-24 21:27:49 +00:00
db112aa589 Fix runtime image sizes and run core generator.
Follow this thread: https://2dimensions.slack.com/archives/CLLCU09T6/p1690220943525829

Note that re-running the generator picked up some more changes.

Diffs=
aeb9210ad Fix runtime image sizes and run core generator. (#5655)

Co-authored-by: Luigi Rosso <luigi-rosso@users.noreply.github.com>
2023-07-24 19:55:58 +00:00
f999112d92 improve Rive widget clipping and sizing
- Exposes `useArtboardSize` in RiveAnimation
- Checks to see if clipping is disabled - Artboard.clip
- Provides means to supply a custom Rect for clipping

Diffs=
fa6ed717b improve Rive widget clipping and sizing (#5154)
13863bf8f Rive Text for iOS and Android! (#5634)
9e0c43b70 Fix small bugs caught by JC (and Alex). (#5647)

Co-authored-by: Gordon <pggordonhayes@gmail.com>
2023-07-24 17:11:14 +00:00
f1a666d9a2 ran generate core runtimes
just ran "generate_core_runtimes.sh" because it looks like we've started to fall behind a bunch here.

Any reason not to get this merged (after sorting any issues)

looks like it has some text updates & follow constraints?
i guess it'd be good to double check this for things we do not want in the public runtimes

Diffs=
d0c65132d ran generate core runtimes (#5628)
420d27a5b FollowPathConstraint to extend TransformSpaceConstraint (#5635)

Co-authored-by: Maxwell Talbot <talbot.maxwell@gmail.com>
2023-07-21 16:49:33 +00:00
df9191d6fa refactor asset export helpers, moving them into rive-api & moving som…
…e asset extensions into api as well

bit of a refactor...
tldr move stage mutation & export mutation stuff into rive api (we couldjust move export i guess...)
move the export helper into rive-api as well

this allows peon to share the same code as our backend here!

Diffs=
17a07fe2e refactor asset export helpers, moving them into rive-api & moving som… (#5620)

Co-authored-by: Maxwell Talbot <talbot.maxwell@gmail.com>
2023-07-20 14:42:33 +00:00
b4ec7a7ab4 use the dimensions of the image at runtime, rather than of the ImageA…
…sset

ok just "fixing" how we export .riv files, and no-longer rely on width and height form image assets, but take them from the image instead.

its not "huge" difference, but basically it means that if we replace an existing image with an image of different dimensions we end up drawing the image from the centre of where the original image was, rather than the top left, which is a bit mroe forgiving

example:

got a few images in here, (they're all like 5k x 3k pixels, so all quite large)

<img width="1086" alt="CleanShot 2023-07-03 at 16 28 34@2x" src="https://github.com/rive-app/rive/assets/1216025/625e0d34-ac0c-4eb6-ad75-cb839aca92ac">

before this change this would look like:

<img width="1135" alt="CleanShot 2023-07-03 at 16 28 46@2x" src="https://github.com/rive-app/rive/assets/1216025/8ba848da-5938-4897-a664-eaae39c86806">

with this change we get

<img width="1113" alt="CleanShot 2023-07-03 at 16 29 17@2x" src="https://github.com/rive-app/rive/assets/1216025/c5f30eb6-21bd-419e-802d-9c98c00399e7">

(the mesh is kinda interesting here)

*note* i'm not touching the cpp runtime just yet, so this & other changes still need to make it down there

Diffs=
235908221 use the dimensions of the image at runtime, rather than of the ImageA… (#5519)

Co-authored-by: Maxwell Talbot <talbot.maxwell@gmail.com>
2023-07-20 13:59:39 +00:00
591b275519 Update http v1.1.0
Resolves https://github.com/rive-app/rive-flutter/issues/321

This requires Sentry to be updated as well.

Diffs=
05c8632e8 Update http v1.1.0 (#5540)
db5688c4a Don't use the '-g' buildoption in premake (#5621)
b17671130 Fixing modifier ranges not updating on the right frame. (#5623)

Co-authored-by: Gordon <pggordonhayes@gmail.com>
2023-07-20 09:51:48 +00:00
d872f57d09 fix: joystick handleSource not enabled for flutter runtime
Fixes https://github.com/rive-app/rive-flutter/issues/331

An inconsistency between the editor and Flutter runtime. External control on a Joystick was not applied.

I used this file to reproduce and test: [joystickdemo2.rev.zip](https://github.com/rive-app/rive/files/12051102/joystickdemo2.rev.zip)

Expected behaviour (the handle is controlled by the position of the top rectangle):

https://github.com/rive-app/rive/assets/13705472/1eae3a71-5f2d-4375-a531-d36b61e5cc61

Diffs=
44f6c4b9c fix: joystick handleSource not enabled for flutter runtime (#5589)
d1f8710f5 Fix dependency order issues for Follow Path (#5595)

Co-authored-by: Gordon <pggordonhayes@gmail.com>
2023-07-19 10:20:47 +00:00
0f08139463 Force embed assets when getting the preview for the sharelinks
- enables overriding the exporttype on export
- forces the "preview" riv file that gets exported to be exported "embedded"
- allows us to handle exceptions when decoding images (more to be done here, but this at least lets us avoid crashing without being able to catch exceptions https://api.flutter.dev/flutter/dart-ui/decodeImageFromList.html)

Diffs=
185b76201 Force embed assets when getting the preview for the sharelinks (#5608)
8e82475b8 Baseline Origin (#5577)
8b49fcbc5 Add option to quantize time to whole frames of framerate. (#5578)
b8e5473b9 Follow path should respect constrained component rotation if orient is off (#5601)

Co-authored-by: Maxwell Talbot <talbot.maxwell@gmail.com>
2023-07-18 12:35:01 +00:00
a86d5e5f02 Code generator fixes alternative
three commits

1 - updated the generator
2 - ran generator against core
3 - ran generator against core runtime

i tried to remove all the changes that are not the comment change

Diffs=
1292ebe56 Code generator fixes alternative (#5584)
094afae0b Adding target origin to transform constraint. (#5559)

Co-authored-by: Maxwell Talbot <talbot.maxwell@gmail.com>
2023-07-14 11:06:02 +00:00
ca712600bc refactor: asset resolving
Adds some cleanup to this previous PR: https://github.com/rive-app/rive/pull/5411/files

- Brings back some classes and parameters and mark them as deprecated.
- Changed the naming for parameters
- Removed asset resolving from the high level `RiveAnimation` widget, prefer to manage this by loading in your own `RiveFile`. This is to avoid introducing too many changes that we may revert down the line
- Removed code comments that were intended as questions, marked some as TODOs
- Improved documentation and cleaned up example

The cached asset example now has a button to hot swap out assets at runtime by keeping a reference to the asset. This works for images, but not for Fonts.
- We can either remove this example for the time being
- Or investigate why it does not swap out (I would expect it to)

Diffs=
94e3490ae refactor: asset resolving (#5563)
bae069339 Stop automatically pruning empty segments in RawPath (#5557)
2d2d8c413 Line Height & Paragraph Spacing (#5552)

Co-authored-by: Gordon <pggordonhayes@gmail.com>
2023-07-13 14:06:41 +00:00
d58c3c762b Runtime modifiers
Finally ready! Some highlights:
- Text objects own TextModifierGroups
- A TextModifierGroup defines a set of operations (Modifiers) to perform on ranges of the whole Text object.
- The ranges are defined by TextModifierRanges which are owned by TextModiferGroups. Each TextModifierGroup can have multiple TextModifierRanges, meaning that the set of Modifiers will perform on the final selection defined by TextModifierRanges.
- TextModifierRanges select portions of the text in a Text object based on rules that define the strength of the selection. The strength of multiple TextModifierRanges can be blended together meaning selection strength can be above 1 and below 0 (optionally clamped).
- There are three fundamental modifications:
  1. Transform where glyphs are individually transformed by a matrix
  2. Paint where glyphs are drawn with different paint (currently only opacity is supported, but later Fill and Stroke will be too).
  3. Shape where a selection can have shaping properties (currently variable axes later also font size) changed. This is the most complex one as it requires [two pass shaping](ef2d0d3ca3/packages/runtime/src/text/text.cpp (L578-L598)).

Diffs=
8086bdbf9 Runtime modifiers (#5512)
1a271c437 Get more compiling on MSVC (#5547)
5a18c89bd Swap propertyKeys between follow path and text core defs (#5543)
942bb8c94 Fix conflicting core key ids and set follow path offset to default false (#5541)
dcf320c64 Follow Path Constraint (Editor & CPP Runtime) (#5510)

Co-authored-by: Luigi Rosso <luigi-rosso@users.noreply.github.com>
2023-07-12 18:19:56 +00:00
8e9077dbf7 Adding origin to text.
Adds origin to text object that works just like the origin of a parametric path. It can be moved in freeze mode too. Adds support in the editor, Flutter runtime, and C++ runtime.

Diffs=
9b8dacbac Adding origin to text. (#5533)
797fb4cbd Add CMake support for building Android and Catch2 Tests (#5468)

Co-authored-by: Luigi Rosso <luigi-rosso@users.noreply.github.com>
2023-07-07 22:11:27 +00:00
e42bfd2599 Add cdn overwrite
allowing the cdn to be set per asset, defaults to our public production cdn.

its a "little" wasteful, but should only find usage when we are exporting .riv's from uat (which will be a little bit bigger as a result of this)

We could put the cdn base url onto the rivefile as a whole, i don't think it buys us much & this is simpler.
also considered putting the default string into the runtime (where it was priori to this) but i think its better of in the defs (as the defs would default to an empty string otherwise, which makes the code ever so slightly messier to read). I think this comes out just a crappy if we ever change the default cdn url.

Diffs=
5c76c52e1 Add cdn overwrite (#5522)

Co-authored-by: Maxwell Talbot <talbot.maxwell@gmail.com>
2023-07-06 13:13:09 +00:00
0e3fdf8de5 Caching example
(basing this pr onto our dart runtime change for now, to limit scope)

made some small tweaks to function names, mostly to get fonts and images to "feel" more similar.

broke out "decode' into parsing the asset first.

makes it possible to cache images/fonts with our dart runtime, example included

Diffs=
40302069e Caching example (#5517)

Co-authored-by: Maxwell Talbot <talbot.maxwell@gmail.com>
2023-07-06 10:50:13 +00:00
5def5d7b1c Font dart runtime
There are a number of questions I'd like to resolve before considering to merge this. also a few thigns to clean up no doubt

# Questions before merging
To customize loading out of band assets, we expect our users to implement
```
abstract class FileAssetLoader {
  Future<bool> load(FileAsset asset);
  bool isCompatible(FileAsset asset) => true;
}
```

1. is this a good interface (i've changed `loadContents`, to `load`)? (if we like this we should change this in cpp too)
2. `FileAssetLoader` is a mouth-full, would `AssetLoader` be better?
3. We are passing `FileAssets` (our core objects) to users with some slight api extensions, is that good? should we just wrap this in an Asset class (I had this before, its not a lot of work to get it back)

things sorted
- [x] cdn "loading" vs url loading
    - just sticking with cdn, users can customize for url
- [x] asset class for consumers of our runtime.
    - i've avoided this one for now, just extending our FileAsset
- [x] Importer/Resolver/Loader. I flipped some names around, mostly because I want our end users to provide an `AssetLoader`, not a resolver.

things to sort out down the line, i'm declaring them out of scope for this pr, fft disagree:
- Fallback font, I see we have a fallback font file hardcoded in the runtime. should investigate if we can include an asset for people like this, or if we need to have users set this if they want to use fallback fonts.
- Image Placement, we should strip width/height from runtimes on ImageAssets
- What do we want to do about asset loading / decoding errors
- TextStyle has both assetId & fontAssetId it gets assetId from the file asset referencer, its nbd,

Diffs=
06e959ad2 Font dart runtime (#5411)

Co-authored-by: Maxwell Talbot <talbot.maxwell@gmail.com>
2023-07-06 08:49:14 +00:00
ba5f9afbac add skip to core string type, to avoid trying to parse bytearrays as …
…strings

an approach we could do to sort this out

Diffs=
9007b7f92 add skip to core string type, to avoid trying to parse bytearrays as … (#5503)

Co-authored-by: Maxwell Talbot <talbot.maxwell@gmail.com>
2023-06-29 13:41:29 +00:00
fe30e35068 Run generate
just trying to flush through some of the bits coming out of running generate core runtime & generate core runtime without making a mess in other pr's .
this is split into four commits which might be helpful when looking at the changes here.

Diffs=
ad72cfce5 Run generate (#5490)
7ee5f7d5a Increases the margin for the approx call to some of the wangs formula… (#5506)
2f224da7f Runtime ellipsis (#5482)

Co-authored-by: Maxwell Talbot <talbot.maxwell@gmail.com>
2023-06-29 08:29:17 +00:00
13adb8da86 Bump Flutter runtime version and changelog, small analyze fix
Following our runtimes upgrade docs here: https://www.notion.so/rive-app/Updating-Runtimes-e03da3c30a0448e59e72e82e3e8f9f6f

Unsure if this needs to be committed and pushed down first before doing the flutter publish, or after. @luigi-rosso ?

Diffs=
ca5884788 Bump Flutter runtime version and changelog, small analyze fix (#5495)
500d878a2 fix viewer build (#5493)

Co-authored-by: Zachary Plata <plata.zach@gmail.com>
2023-06-27 17:20:07 +00:00
93c1ca86e2 Feature options on Fonts
Adds runtime and editor support for setting feature flags on a Font.

The biggest change to the font engine is that the feature options are now stored on the Font object itself instead of hard-coded during shaping. This is nice as it requires no extra data to be piped through for individual run styling. It also means that we generalized the concept of creating a variable font as configuring a version of the font (see withOptions replacing makeVariation) so that variable axis and feature settings are treated as options to a Font configuration.

This also allows us to track existing variations and options on the configured Font such that any further call to "withOptions" on that already configured Font will propagate previous changes if not overridden. This fortuitously also fixes an issue the modifiers were exhibiting where a variation set on the TextStyle that wasn't part of the modifier set would be lost.

Diffs=
31d9a5424 Feature options on Fonts (#5479)
8b7587241 Runtime/interpolate states cpp (#5437)

Co-authored-by: Luigi Rosso <luigi-rosso@users.noreply.github.com>
2023-06-26 17:36:43 +00:00
4893a3e79e Add transition interpolation to the runtime
Just ran `generate_core_runtime.sh` which added quite a lot of stuff. The change is quite minimal, I'll highlight it with a few comments in the PR.
I'll also adding a test for these new cubic exports just in case!

Fixes the Flutter bit for #5404

Diffs=
59858e333 Add transition interpolation to the runtime (#5429)

Co-authored-by: Umberto Sonnino <umberto@rive.app>
2023-06-19 18:53:56 +00:00
d7d22b9aee chore: bump rive_common to v0.0.10
Diffs=
d520a7ea4 chore: bump rive_common to v0.0.10 (#5406)

Co-authored-by: Gordon <pggordonhayes@gmail.com>
2023-06-13 09:58:15 +00:00
7f218d15bd revert overriding rive_common in flutter example
this breaks tests in rive-flutter, and presumably a leftover from testing a rive_common bump locally

37eb623b96

Diffs=
ad0d13cd6 revert overriding rive_common in flutter example (#5334)

Co-authored-by: Maxwell Talbot <talbot.maxwell@gmail.com>
2023-05-31 13:41:01 +00:00
76b43e1cc2 Add setting custom headers
adding pr from the community https://github.com/rive-app/rive-flutter/pull/314, including an update to how we make sure credits for contributions are kept when our mono scripts merge changes upstream.

Some companies don't let the rive file URLs without authentication, that's why they need to send headers in the network request.

Example of how to use:

```
RiveAnimation.network(
          'https://cdn.rive.app/animations/vehicles.riv',
          headers: {'Authorization': '{token}'},
        )
```

The same idea is in the [flutter_svg package](https://pub.dev/documentation/flutter_svg/latest/svg/SvgPicture/SvgPicture.network.html)

Diffs=
c163c1a7f Add setting custom headers (#5327)

Co-authored-by: Ahmed Wahba <a.tarek360@gmail.com>
Co-authored-by: Maxwell Talbot <talbot.maxwell@gmail.com>
2023-05-31 11:56:54 +00:00
58c998986a Fix web editor
Need to make sure setUrlStrategy is only called once. Due to a bug in Flutter it seems like that static final instance is being called like a getter in Flutter Web (bizarre) but we can mitigate it by using the correct Platform (not the one from rive_common).

Also re-published the wasm for the latest rive_common.

Diffs=
cae6fa5cc Fix web editor (#5299)
2023-05-25 21:04:39 +00:00
37eb623b96 Text modifiers!
Adds support for text modifiers, which are a set a of operations that can run on a per character basis to transform, reshape, and fade resulting glyphs.

Adds:
- Modifier groups which encompass a set of modifications done to a range of the text.
- Range selectors which help define the range the modifier applies to (multiple range selectors can be included to build up the final selection of a modifier group).
- Variation modifiers which allow animating variable fonts per character.
- Origin, Translation, Rotation, and Scale modification.
- Opacity modifiers.

Diffs=
9695de6e3 Text modifiers! (#5288)
a9f8a1c5d Macos take2 (#5258)
2023-05-25 17:53:23 +00:00
32672e1326 replace performResize with computeDryLayout
fix up an edge case where we require computeDryLayout over performResize

https://docs.flutter.dev/release/breaking-changes/renderbox-dry-layout

the default implementation of performResize uses dryLayout so we can get rid of our override there. I was not able to make a unit test that fails without computeDryLayout, but an app with the below will throw this error

```
══╡ EXCEPTION CAUGHT BY RENDERING LIBRARY
╞═════════════════════════════════════════════════════════
The following assertion was thrown during performLayout():
The RiveRenderObject class does not implement "computeDryLayout".
If you are not writing your own RenderBox subclass, then this is not
your fault. Contact support: https://github.com/flutter/flutter/issues/new?template=2_bug.md
```

```
import 'package:flutter/material.dart';
import 'package:rive/rive.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
        useMaterial3: true,
      ),
      home: const MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key, required this.title});
  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        backgroundColor: Theme.of(context).colorScheme.inversePrimary,
        title: Text(widget.title),
      ),
      body: LayoutBuilder(builder: (context, constraints) {
        return SingleChildScrollView(
          child: ConstrainedBox(
            constraints: BoxConstraints(
              minHeight: constraints.maxHeight,
            ),
            child: const IntrinsicHeight(
              child: Column(
                children: <Widget>[
                  Wrap(
                    children: [
                      SizedBox(
                        height: 100,
                        child: IntrinsicHeight(
                          child: RiveAnimation.network(
                            'https://cdn.rive.app/animations/vehicles.riv',
                          ),
                        ),
                      ),
                    ],
                  ),
                ],
              ),
            ),
          ),
        );
      }),
    );
  }
}
```

Diffs=
4f7d11d85 replace performResize with computeDryLayout (#5278)
2023-05-24 10:59:05 +00:00