Implement Image::translate for positioning floating images
This commit is contained in:
parent
e64c58d032
commit
a2a7c18c9d
3 changed files with 81 additions and 22 deletions
|
|
@ -210,6 +210,12 @@ fn card<'a>(
|
|||
.content_fit(ContentFit::Cover)
|
||||
.opacity(thumbnail.fade_in.interpolate(0.0, 1.0, now))
|
||||
.scale(thumbnail.zoom.interpolate(1.0, 1.1, now))
|
||||
.translate(move |bounds, viewport| {
|
||||
let final_bounds = bounds.zoom(1.1);
|
||||
|
||||
final_bounds.offset(&viewport.shrink(10))
|
||||
* thumbnail.zoom.interpolate(0.0, 1.0, now)
|
||||
})
|
||||
.float(true)
|
||||
.style(move |_theme| image::Style {
|
||||
shadow: Shadow {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue