From 7fadee94075c1b732898dad97c5f996007178fa2 Mon Sep 17 00:00:00 2001 From: Florence Hanson <118609247+beautyscribbles@users.noreply.github.com> Date: Thu, 8 Feb 2024 11:11:15 +0100 Subject: [PATCH] refactor JavaScript comment for clarity and readability --- Components/APP.js | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/Components/APP.js b/Components/APP.js index 3563348..9d356a5 100644 --- a/Components/APP.js +++ b/Components/APP.js @@ -139,16 +139,20 @@ const FabAction = () => { const scaleMin = initialChildButtonStyles().scale.val; const scaleMax = finalChildButtonStyles(0).scale.val; - //This function returns target styles for each child button in current animation frame - //according to actual styles in previous animation frame. - //Each button could have one of two target styles - // - defined in initialChildButtonStyles (for collapsed buttons) - // - defined in finalChildButtonStyles (for expanded buttons) - // To decide which target style should be applied function uses css 'scale' property - // for previous button in previous animation frame. - // When 'scale' for previous button passes some 'border' which is a simple combination one of - // two 'scale' values and some OFFSET the target style for next button should be changed. - // + /* + This function calculates the target styles for each child button in the current animation frame + based on the actual styles from the previous animation frame. + + Each button can have one of two target styles: + - defined in initialChildButtonStyles (for collapsed buttons) + - defined in finalChildButtonStyles (for expanded buttons) + + To determine which target style should be applied, the function utilizes the CSS 'scale' property + from the previous button in the previous animation frame. + When the 'scale' for the previous button surpasses a certain 'border', which is determined by a combination + of two 'scale' values and an OFFSET, the target style for the next button should be updated. +*/ + // For example let's set the OFFSET for 0.3 - it this case border's value for closed buttons will be 0.8. // // All buttons are closed