Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reorganize files, update code documentation a bit.
- Loading branch information
Sepand Parhami
committed
Oct 16, 2018
1 parent
7c792e9
commit 7a4a1df
Showing
16 changed files
with
90 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export {prepareImageAnimation} from './src/transform-img/index.js'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Transform Img | ||
|
||
## Overview | ||
|
||
This directory contains logic for transforming an image from one location to | ||
another. The animation is comprised of 3 parts: | ||
|
||
* Scaling up the image in the x and y directions to the final scale | ||
* Translating the image in the x and y directions to the final location | ||
* Changing the crop in the x and y directions to the final crop | ||
|
||
Each of these are implemented in seprate file. | ||
|
||
## Implementation | ||
|
||
In order to have the animation perform well, including on older devices, only | ||
CPU accelrated animatable properties. As a result, the 'crop' portion of the | ||
animation is implemented by scaling up a cropping container (with | ||
`overflow: hidden`) and counteracting the scaling with an inverse scale on a | ||
child container. | ||
|
||
The animations are implemented by taking the larger size and animating using | ||
that as a reference point for scaling. That is, when the transition is where | ||
the larger image is (whether that is the starting state or ending state), the | ||
scale values will all be `1.0`. This is done to avoid rounding errors from | ||
the various scale animations from having a user perceivable impact. The errors | ||
are much less or not at all noticable for the smaller image. When we are going | ||
from a small image to a large image (say scaling by 5x), we will animate the | ||
scale from `0.2` to `1.0`. If we were to run the reverse operation, we would | ||
scale from `1.0` to `0.2`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export {prepareImageAnimation} from './transform-img.js'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,6 +19,7 @@ | |
"sourceMap": true | ||
}, | ||
"include": [ | ||
"src/*.ts" | ||
"index.ts", | ||
"src/**/*.ts", | ||
] | ||
} |