-
Notifications
You must be signed in to change notification settings - Fork 55
[IMP] renderer: add animations on cell change #6448
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
2dd49ef
to
9b7ce81
Compare
icons: { left?: GridIcon; right?: GridIcon; center?: GridIcon }; | ||
overlayColor?: Color; | ||
icons: { left?: GridIconWithOpacity; right?: GridIconWithOpacity; center?: GridIconWithOpacity }; | ||
textOpacity?: number; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could also add textOpacity
to property style
of Box
for (const { zone, rect } of this.getters.getAllActiveViewportsZonesAndRect()) { | ||
const { ctx } = renderingContext; | ||
ctx.save(); | ||
ctx.beginPath(); | ||
ctx.rect(rect.x, rect.y, rect.width, rect.height); | ||
ctx.clip(); | ||
const boxes = this.getGridBoxes(zone); | ||
const boxesWithoutAnimations = this.getGridBoxes(zone); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could optimize the code a bit there; computing a new Box is useless if we're in an animation frame that isn't caused by a model update. We could re-use the boxes of last render. A bit annoying (because of multiple viewports), but entirely possible.
We'd save 2-3ms at each animation frame.
066c5b0
to
2216143
Compare
This commit replaces the HTML-based rendering of grid icons with a canvas-based approach. This have the advantages of: - improved performance, especially when there are a lot of icons (no DOM + OWL manipulation overhead) - no parallax effect on mobile devices - is compatible with cell animations of #6448 Task: 4674384
This commit replaces the HTML-based rendering of grid icons with a canvas-based approach. This have the advantages of: - improved performance, especially when there are a lot of icons (no DOM + OWL manipulation overhead) - no parallax effect on mobile devices - is compatible with cell animations of #6448 Task: 4674384
This commit replaces the HTML-based rendering of grid icons with a canvas-based approach. This have the advantages of: - improved performance, especially when there are a lot of icons (no DOM + OWL manipulation overhead) - no parallax effect on mobile devices - is compatible with cell animations of #6448 Task: 4674384 Part-of: #6111 Signed-off-by: Lucas Lefèvre (lul) <[email protected]>
2216143
to
4a2f2f9
Compare
In the rendering process, the `verticalAlign` property is duplicated: inside a `Box` there is both a `verticalAlign` and a `style.verticalAlign` property. This commit removes the `verticalAlign` property from the `Box`. Task: 4805149
The function `computeTextWidth` uses a cache to store the width of a text, but we would make canvas operations `ctx.save()/restore()` even if the width is already in the cache. For an animation on 350 cells, we went from spending 25ms in `computeTextWidth` to 4ms. Task: 4805149
This commit adds animations in the grid's canvas when a cell is changed. The animations are defined in the `cell_animation_registry.ts` and includes: - fade in the cell when it gets a new content. - fate out the cell when its content is removed. - text sliding animation when the text is changed. - color gradient animation when the cell colors is changed - and more The feature is designed to not impact the current grid drawing logic. We still have a first step yo create `Box` from the model content, and a second step to draw the `Box` in the canvas. The animations are a step in between, where we change the `Box` depending on the animation progress, and possibly add some additional `Box` to be drawn. Task: 4805149
4a2f2f9
to
62c9513
Compare
Description:
This commit adds animations in the grid's canvas when a cell is changed.
The animations are defined in the
cell_animation_registry.ts
andincludes:
The feature is designed to not impact the current grid drawing logic.
We still have a first step yo create
Box
from the model content,and a second step to draw the
Box
in the canvas. The animationsare a step in between, where we change the
Box
depending on theanimation progress, and possibly add some additional
Box
to be drawn.Task: 4805149
review checklist