-
Notifications
You must be signed in to change notification settings - Fork 14
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
fix(dataroom): Counter animation responsiveness #454
base: main
Are you sure you want to change the base?
Conversation
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.
let placeValue = latest % 10 | ||
let offset = (10 + number - placeValue) % 10 |
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.
why did you change these variables to let
?
const Number = ({ mv, number }: NumberProps) => { | ||
const height = useIsMediumScreen() ? DIGIT_HEIGHT_SM : DIGIT_HEIGHT_MD | ||
const yPosition = useTransform(mv, (latest: number) => calculateYPosition(latest, number, height)) | ||
function Number({ mv, number }: { mv: MotionValue<number>; number: 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.
Why did you modified the function signature?
const height = useIsMediumScreen() ? DIGIT_HEIGHT_SM : DIGIT_HEIGHT_MD | ||
const yPosition = useTransform(mv, (latest: number) => calculateYPosition(latest, number, height)) | ||
function Number({ mv, number }: { mv: MotionValue<number>; number: number }) { | ||
let y = useTransform(mv, (latest) => calculateYPosition(latest, 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.
Why starting to use let
?
function Digit({ place, value }: { place: number; value: number }) { | ||
let valueRoundedToPlace = Math.floor(value / place) % 10 | ||
let animatedValue = useSpring(valueRoundedToPlace, { |
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.
no need to change the const
nor the function signature
Addresses Issue #433