f4ceb581dd
This PR adds a `getInterpolatedProps` method to the `ShapeUtil` class. It is used in `Editor.animateShapes` to allow shapes to lerp values that the editor doesn't specifically know about. ![Kapture 2024-07-13 at 09 12 48](https://github.com/user-attachments/assets/f9711aa0-278b-4a26-84d3-4b6bbe610b81) ### Change type - [x] `feature` - [x] `api` ### Test plan 1. Animate a shape's props. ```ts const shape = editor.getOnlySelectedShape() setInterval(() => { editor.animateShape( { ...shape, x: Math.random() * 500, y: Math.random() * 200, props: { w: 200 + Math.random() * 200, h: 200 + Math.random() * 200 }, }, { animation: { duration: 500 } } ) }, 1000) ``` - [ ] Unit tests (Could be done!) ### Release notes - SDK: adds `ShapeUtil.getInterpolatedProps` so that shapes can better participate in animations. --------- Co-authored-by: alex <alex@dytry.ch> |
||
---|---|---|
.. | ||
assets | ||
dotcom-shared | ||
editor | ||
namespaced-tldraw | ||
state | ||
state-react | ||
store | ||
sync | ||
sync-core | ||
tldraw | ||
tlschema | ||
utils | ||
validate | ||
worker-shared |