#cssmaths — Public Fediverse posts
Live and recent posts from across the Fediverse tagged #cssmaths, aggregated by home.social.
-
Just noticed this little @codepen demo got featured:
https://codepen.io/thebabydino/pen/XJNpeYL
Detailed explanation for the how behind the mathy solution in this thread 👉 https://mastodon.social/@anatudor/116594229219732729
#CSS #cssGradient #code #coding #web #dev #webDev #webDevelopment #frontend #Maths #cssMaths
-
Just noticed this little @codepen demo got featured:
https://codepen.io/thebabydino/pen/XJNpeYL
Detailed explanation for the how behind the mathy solution in this thread 👉 https://mastodon.social/@anatudor/116594229219732729
#CSS #cssGradient #code #coding #web #dev #webDev #webDevelopment #frontend #Maths #cssMaths
-
Just noticed this little @codepen demo got featured:
https://codepen.io/thebabydino/pen/XJNpeYL
Detailed explanation for the how behind the mathy solution in this thread 👉 https://mastodon.social/@anatudor/116594229219732729
#CSS #cssGradient #code #coding #web #dev #webDev #webDevelopment #frontend #Maths #cssMaths
-
Just noticed this little @codepen demo got featured:
https://codepen.io/thebabydino/pen/XJNpeYL
Detailed explanation for the how behind the mathy solution in this thread 👉 https://mastodon.social/@anatudor/116594229219732729
#CSS #cssGradient #code #coding #web #dev #webDev #webDevelopment #frontend #Maths #cssMaths
-
Just noticed this little @codepen demo got featured:
https://codepen.io/thebabydino/pen/XJNpeYL
Detailed explanation for the how behind the mathy solution in this thread 👉 https://mastodon.social/@anatudor/116594229219732729
#CSS #cssGradient #code #coding #web #dev #webDev #webDevelopment #frontend #Maths #cssMaths
-
That is, we need to add:
i*2*α_dxIf k > 1, then we need to add half a turn as well, that is:
round(down, k)*180°Adding these to the angular progress along the edge, we get the conic-gradient angle producing a point that moves at constant speed along the perimeter.
#CSS #cssGradient #code #coding #web #dev #webDev #webDevelopment #frontend #Maths #cssMaths
-
That is, we need to add:
i*2*α_dxIf k > 1, then we need to add half a turn as well, that is:
round(down, k)*180°Adding these to the angular progress along the edge, we get the conic-gradient angle producing a point that moves at constant speed along the perimeter.
#CSS #cssGradient #code #coding #web #dev #webDev #webDevelopment #frontend #Maths #cssMaths
-
That is, we need to add:
i*2*α_dxIf k > 1, then we need to add half a turn as well, that is:
round(down, k)*180°Adding these to the angular progress along the edge, we get the conic-gradient angle producing a point that moves at constant speed along the perimeter.
#CSS #cssGradient #code #coding #web #dev #webDev #webDevelopment #frontend #Maths #cssMaths
-
That is, we need to add:
i*2*α_dxIf k > 1, then we need to add half a turn as well, that is:
round(down, k)*180°Adding these to the angular progress along the edge, we get the conic-gradient angle producing a point that moves at constant speed along the perimeter.
#CSS #cssGradient #code #coding #web #dev #webDev #webDevelopment #frontend #Maths #cssMaths
-
We know the distance from the middle of the rectangle to the middle of the current edge.
It's half the length of the other edge:
j*50cqw + i*50cqhAbsolute value of the absolute distance of the current progress point to the middle of the edge it's on:
(p - .5)*(j*100cqh + i*100cqw)These form a right triangle out of which we can get the angle of their hypotenuse with the axis perpendicular onto the current edge.
#CSS #code #coding #web #dev #webDev #webDevelopment #frontend #Maths #cssMaths
-
We know the distance from the middle of the rectangle to the middle of the current edge.
It's half the length of the other edge:
j*50cqw + i*50cqhAbsolute value of the absolute distance of the current progress point to the middle of the edge it's on:
(p - .5)*(j*100cqh + i*100cqw)These form a right triangle out of which we can get the angle of their hypotenuse with the axis perpendicular onto the current edge.
#CSS #code #coding #web #dev #webDev #webDevelopment #frontend #Maths #cssMaths
-
We know the distance from the middle of the rectangle to the middle of the current edge.
It's half the length of the other edge:
j*50cqw + i*50cqhAbsolute value of the absolute distance of the current progress point to the middle of the edge it's on:
(p - .5)*(j*100cqh + i*100cqw)These form a right triangle out of which we can get the angle of their hypotenuse with the axis perpendicular onto the current edge.
#CSS #code #coding #web #dev #webDev #webDevelopment #frontend #Maths #cssMaths
-
We know the distance from the middle of the rectangle to the middle of the current edge.
It's half the length of the other edge:
j*50cqw + i*50cqhAbsolute value of the absolute distance of the current progress point to the middle of the edge it's on:
(p - .5)*(j*100cqh + i*100cqw)These form a right triangle out of which we can get the angle of their hypotenuse with the axis perpendicular onto the current edge.
#CSS #code #coding #web #dev #webDev #webDevelopment #frontend #Maths #cssMaths
-
Progress along a vertical edge is:
mod(k, 1)/f
Progress along a horizontal one is:
(mod(k, 1) - f)/(1 - f)Progress along a generic edge is:
p = j*mod(k, 1)/f + i*(mod(k, 1) - f)/(1 - f)Length traveled along the current generic edge:
j*mod(k, 1)/f*100cqh +
i*(mod(k, 1) - f)/(1 - f)*100cqwSigned relative distance from middle of the current generic edge: p - .5
We get the absolute value of this difference & its sign.
#CSS #coding #web #dev #webDev #webDevelopment #frontend #cssMaths #code
-
Progress along a vertical edge is:
mod(k, 1)/f
Progress along a horizontal one is:
(mod(k, 1) - f)/(1 - f)Progress along a generic edge is:
p = j*mod(k, 1)/f + i*(mod(k, 1) - f)/(1 - f)Length traveled along the current generic edge:
j*mod(k, 1)/f*100cqh +
i*(mod(k, 1) - f)/(1 - f)*100cqwSigned relative distance from middle of the current generic edge: p - .5
We get the absolute value of this difference & its sign.
#CSS #coding #web #dev #webDev #webDevelopment #frontend #cssMaths #code
-
Progress along a vertical edge is:
mod(k, 1)/f
Progress along a horizontal one is:
(mod(k, 1) - f)/(1 - f)Progress along a generic edge is:
p = j*mod(k, 1)/f + i*(mod(k, 1) - f)/(1 - f)Length traveled along the current generic edge:
j*mod(k, 1)/f*100cqh +
i*(mod(k, 1) - f)/(1 - f)*100cqwSigned relative distance from middle of the current generic edge: p - .5
We get the absolute value of this difference & its sign.
#CSS #coding #web #dev #webDev #webDevelopment #frontend #cssMaths #code
-
Progress along a vertical edge is:
mod(k, 1)/f
Progress along a horizontal one is:
(mod(k, 1) - f)/(1 - f)Progress along a generic edge is:
p = j*mod(k, 1)/f + i*(mod(k, 1) - f)/(1 - f)Length traveled along the current generic edge:
j*mod(k, 1)/f*100cqh +
i*(mod(k, 1) - f)/(1 - f)*100cqwSigned relative distance from middle of the current generic edge: p - .5
We get the absolute value of this difference & its sign.
#CSS #coding #web #dev #webDev #webDevelopment #frontend #cssMaths #code
-
We also compute its complementary j = 1 - i.
Idea https://css-tricks.com/logical-operations-with-css-variables/Basically, we have:
i = max(0, sign(mod(k, 1) - f))
j = 1 - ii = 0, j = 1 on vertical edge (incl. corner)
i = 1, j = 0 on horizontal edge (after corner)Now we compute things for going along vertical & horizontal edges separately and use i & j to switch between them. That is, multiply vertical results with j and horizontal ones with i.
#CSS #code #coding #web #dev #webDev #webDevelopment #frontend #Maths #cssMaths
-
We also compute its complementary j = 1 - i.
Idea https://css-tricks.com/logical-operations-with-css-variables/Basically, we have:
i = max(0, sign(mod(k, 1) - f))
j = 1 - ii = 0, j = 1 on vertical edge (incl. corner)
i = 1, j = 0 on horizontal edge (after corner)Now we compute things for going along vertical & horizontal edges separately and use i & j to switch between them. That is, multiply vertical results with j and horizontal ones with i.
#CSS #code #coding #web #dev #webDev #webDevelopment #frontend #Maths #cssMaths
-
We also compute its complementary j = 1 - i.
Idea https://css-tricks.com/logical-operations-with-css-variables/Basically, we have:
i = max(0, sign(mod(k, 1) - f))
j = 1 - ii = 0, j = 1 on vertical edge (incl. corner)
i = 1, j = 0 on horizontal edge (after corner)Now we compute things for going along vertical & horizontal edges separately and use i & j to switch between them. That is, multiply vertical results with j and horizontal ones with i.
#CSS #code #coding #web #dev #webDev #webDevelopment #frontend #Maths #cssMaths
-
We also compute its complementary j = 1 - i.
Idea https://css-tricks.com/logical-operations-with-css-variables/Basically, we have:
i = max(0, sign(mod(k, 1) - f))
j = 1 - ii = 0, j = 1 on vertical edge (incl. corner)
i = 1, j = 0 on horizontal edge (after corner)Now we compute things for going along vertical & horizontal edges separately and use i & j to switch between them. That is, multiply vertical results with j and horizontal ones with i.
#CSS #code #coding #web #dev #webDev #webDevelopment #frontend #Maths #cssMaths
-
Moving further, we'll be computing the progress of mod(k, 1). Starting from the top left corner, once we go across half a perimeter, the cycle of going along a vertical edge, then along a horizontal one repeats.
There are 2 cases:
mod(k, 1) <=f (going along a vertical edge)
mod(k, 1) > 1 (going along a horizontal one)These two cases repeat once more after the halfway point (bottom left corner since we're starting from the top right).
-
Moving further, we'll be computing the progress of mod(k, 1). Starting from the top left corner, once we go across half a perimeter, the cycle of going along a vertical edge, then along a horizontal one repeats.
There are 2 cases:
mod(k, 1) <=f (going along a vertical edge)
mod(k, 1) > 1 (going along a horizontal one)These two cases repeat once more after the halfway point (bottom left corner since we're starting from the top right).
-
Moving further, we'll be computing the progress of mod(k, 1). Starting from the top left corner, once we go across half a perimeter, the cycle of going along a vertical edge, then along a horizontal one repeats.
There are 2 cases:
mod(k, 1) <=f (going along a vertical edge)
mod(k, 1) > 1 (going along a horizontal one)These two cases repeat once more after the halfway point (bottom left corner since we're starting from the top right).
-
Moving further, we'll be computing the progress of mod(k, 1). Starting from the top left corner, once we go across half a perimeter, the cycle of going along a vertical edge, then along a horizontal one repeats.
There are 2 cases:
mod(k, 1) <=f (going along a vertical edge)
mod(k, 1) > 1 (going along a horizontal one)These two cases repeat once more after the halfway point (bottom left corner since we're starting from the top right).
-
If progress at the bottom left corner (= at half the perimeter starting from the top right corner) is 1, then progress at the bottom right corner is the height 100cqh over half the perimeter (one height 100cqh plus one width 100cqw):
f = 100cqh/(100cqh + 100cqw)
Dividing lengths is supported by Safari & Chrome + we have a Firefox fallback https://frontendmasters.com/blog/count-auto-fill-columns/#getting-the-number-of-columns
#CSS #cssGradient #code #coding #web #dev #webDev #webDevelopment #frontend #Maths #cssMaths
-
If progress at the bottom left corner (= at half the perimeter starting from the top right corner) is 1, then progress at the bottom right corner is the height 100cqh over half the perimeter (one height 100cqh plus one width 100cqw):
f = 100cqh/(100cqh + 100cqw)
Dividing lengths is supported by Safari & Chrome + we have a Firefox fallback https://frontendmasters.com/blog/count-auto-fill-columns/#getting-the-number-of-columns
#CSS #cssGradient #code #coding #web #dev #webDev #webDevelopment #frontend #Maths #cssMaths
-
If progress at the bottom left corner (= at half the perimeter starting from the top right corner) is 1, then progress at the bottom right corner is the height 100cqh over half the perimeter (one height 100cqh plus one width 100cqw):
f = 100cqh/(100cqh + 100cqw)
Dividing lengths is supported by Safari & Chrome + we have a Firefox fallback https://frontendmasters.com/blog/count-auto-fill-columns/#getting-the-number-of-columns
#CSS #cssGradient #code #coding #web #dev #webDev #webDevelopment #frontend #Maths #cssMaths
-
If progress at the bottom left corner (= at half the perimeter starting from the top right corner) is 1, then progress at the bottom right corner is the height 100cqh over half the perimeter (one height 100cqh plus one width 100cqw):
f = 100cqh/(100cqh + 100cqw)
Dividing lengths is supported by Safari & Chrome + we have a Firefox fallback https://frontendmasters.com/blog/count-auto-fill-columns/#getting-the-number-of-columns
#CSS #cssGradient #code #coding #web #dev #webDev #webDevelopment #frontend #Maths #cssMaths
-
Anyway, what we want to animate here linearly isn't a conic-gradient() angle, it's the progress around the perimeter.
This is k, going from 0 to 2. When k is 0, we're at the top right corner. When it's 1, we're at the bottom left corner, having gone across half the perimeter.
What about the progress value at the bottom right? We'll be calling that f, but how much is it?
#CSS #cssGradient #code #coding #web #dev #webDev #webDevelopment #frontend #Maths #cssMaths
-
Anyway, what we want to animate here linearly isn't a conic-gradient() angle, it's the progress around the perimeter.
This is k, going from 0 to 2. When k is 0, we're at the top right corner. When it's 1, we're at the bottom left corner, having gone across half the perimeter.
What about the progress value at the bottom right? We'll be calling that f, but how much is it?
#CSS #cssGradient #code #coding #web #dev #webDev #webDevelopment #frontend #Maths #cssMaths
-
Anyway, what we want to animate here linearly isn't a conic-gradient() angle, it's the progress around the perimeter.
This is k, going from 0 to 2. When k is 0, we're at the top right corner. When it's 1, we're at the bottom left corner, having gone across half the perimeter.
What about the progress value at the bottom right? We'll be calling that f, but how much is it?
#CSS #cssGradient #code #coding #web #dev #webDev #webDevelopment #frontend #Maths #cssMaths
-
Anyway, what we want to animate here linearly isn't a conic-gradient() angle, it's the progress around the perimeter.
This is k, going from 0 to 2. When k is 0, we're at the top right corner. When it's 1, we're at the bottom left corner, having gone across half the perimeter.
What about the progress value at the bottom right? We'll be calling that f, but how much is it?
#CSS #cssGradient #code #coding #web #dev #webDev #webDevelopment #frontend #Maths #cssMaths
-
We can also compute half the perimeter as:
100cqh + 100cqw
---
By the way, this container technique is also what I've used to compute the aspect ratio of images of unknown dimensions (and therefore aspect ratio) in order to determine along which edge they should get a blur extension to square - check out the article! https://frontendmasters.com/blog/non-square-image-blur-extensions/#unknown-aspect-ratio
#CSS #code #coding #web #dev #webDev #webDevelopment #frontend #Maths #cssMaths
-
We can also compute half the perimeter as:
100cqh + 100cqw
---
By the way, this container technique is also what I've used to compute the aspect ratio of images of unknown dimensions (and therefore aspect ratio) in order to determine along which edge they should get a blur extension to square - check out the article! https://frontendmasters.com/blog/non-square-image-blur-extensions/#unknown-aspect-ratio
#CSS #code #coding #web #dev #webDev #webDevelopment #frontend #Maths #cssMaths
-
We can also compute half the perimeter as:
100cqh + 100cqw
---
By the way, this container technique is also what I've used to compute the aspect ratio of images of unknown dimensions (and therefore aspect ratio) in order to determine along which edge they should get a blur extension to square - check out the article! https://frontendmasters.com/blog/non-square-image-blur-extensions/#unknown-aspect-ratio
#CSS #code #coding #web #dev #webDev #webDevelopment #frontend #Maths #cssMaths
-
We can also compute half the perimeter as:
100cqh + 100cqw
---
By the way, this container technique is also what I've used to compute the aspect ratio of images of unknown dimensions (and therefore aspect ratio) in order to determine along which edge they should get a blur extension to square - check out the article! https://frontendmasters.com/blog/non-square-image-blur-extensions/#unknown-aspect-ratio
#CSS #code #coding #web #dev #webDev #webDevelopment #frontend #Maths #cssMaths
-
Idea behind the mathy solution: card's dimensions are given by its text content. It has an absolutely positioned child .back covering its entire area, but placed behind. This .back is sized explicitly relative to its parent, so its pseudos know its dimensions if we make it a container: they're 100cqw and 100cqh. These allow us to compute the angles of the rectangle diagonal with the horizontal α_dx & with the vertical α_dy as:
α_dx = atan2(100cqh, 100cqw)
α_dy = 90° - α_dx -
On gradient borders & common issues with them https://www.reddit.com/r/css/comments/1tfmohm/comment/ombei2n/
If you've ever wanted to create constant length/ speed border segments on non-square boxes, the how behind the mathy, less code + working with border-radius solution & the stacked children solution (no border-radius).
#CSS #cssGradient #code #coding #web #dev #webDev #webDevelopment #frontend #Maths #cssMaths
-
On gradient borders & common issues with them https://www.reddit.com/r/css/comments/1tfmohm/comment/ombei2n/
If you've ever wanted to create constant length/ speed border segments on non-square boxes, the how behind the mathy, less code + working with border-radius solution & the stacked children solution (no border-radius).
#CSS #cssGradient #code #coding #web #dev #webDev #webDevelopment #frontend #Maths #cssMaths
-
On gradient borders & common issues with them https://www.reddit.com/r/css/comments/1tfmohm/comment/ombei2n/
If you've ever wanted to create constant length/ speed border segments on non-square boxes, the how behind the mathy, less code + working with border-radius solution & the stacked children solution (no border-radius).
#CSS #cssGradient #code #coding #web #dev #webDev #webDevelopment #frontend #Maths #cssMaths
-
On gradient borders & common issues with them https://www.reddit.com/r/css/comments/1tfmohm/comment/ombei2n/
If you've ever wanted to create constant length/ speed border segments on non-square boxes, the how behind the mathy, less code + working with border-radius solution & the stacked children solution (no border-radius).
#CSS #cssGradient #code #coding #web #dev #webDev #webDevelopment #frontend #Maths #cssMaths
-
Sometimes, if you notice a teeny tiny misalignment and you cannot understand why because *nothing* in your CSS looks like it could have caused it... try using `round()` to round to an integer number of pixels.
It just solved my own tiny misalignment problem that was driving me batty. 🦇
#CSS #cssMaths #code #coding #frontend #web #dev #webDevelopment #webDev
-
Sometimes, if you notice a teeny tiny misalignment and you cannot understand why because *nothing* in your CSS looks like it could have caused it... try using `round()` to round to an integer number of pixels.
It just solved my own tiny misalignment problem that was driving me batty. 🦇
#CSS #cssMaths #code #coding #frontend #web #dev #webDevelopment #webDev
-
Sometimes, if you notice a teeny tiny misalignment and you cannot understand why because *nothing* in your CSS looks like it could have caused it... try using `round()` to round to an integer number of pixels.
It just solved my own tiny misalignment problem that was driving me batty. 🦇
#CSS #cssMaths #code #coding #frontend #web #dev #webDevelopment #webDev
-
Sometimes, if you notice a teeny tiny misalignment and you cannot understand why because *nothing* in your CSS looks like it could have caused it... try using `round()` to round to an integer number of pixels.
It just solved my own tiny misalignment problem that was driving me batty. 🦇
#CSS #cssMaths #code #coding #frontend #web #dev #webDevelopment #webDev
-
Missed this, made on the 1st of Jan on @codepen:
✨ Sliding border glow on hover for beveled cards, heavily commented https://codepen.io/thebabydino/pen/EayVXKj
Trivial if we have `corner-shape` support & even simpler with `border-area`. But here it's cross-browser.
Detailed explanation of the Maths behind on Ko-fi/ Patreon. This way, you get to both become smarter and support my work so I can continue coding.
#CSS #Maths #cssMaths #cssGradient #cssMask #code #coding #frontend #web #dev #webDev #webDevelopment
-
Missed this, made on the 1st of Jan on @codepen:
✨ Sliding border glow on hover for beveled cards, heavily commented https://codepen.io/thebabydino/pen/EayVXKj
Trivial if we have `corner-shape` support & even simpler with `border-area`. But here it's cross-browser.
Detailed explanation of the Maths behind on Ko-fi/ Patreon. This way, you get to both become smarter and support my work so I can continue coding.
#CSS #Maths #cssMaths #cssGradient #cssMask #code #coding #frontend #web #dev #webDev #webDevelopment
-
Missed this, made on the 1st of Jan on @codepen:
✨ Sliding border glow on hover for beveled cards, heavily commented https://codepen.io/thebabydino/pen/EayVXKj
Trivial if we have `corner-shape` support & even simpler with `border-area`. But here it's cross-browser.
Detailed explanation of the Maths behind on Ko-fi/ Patreon. This way, you get to both become smarter and support my work so I can continue coding.
#CSS #Maths #cssMaths #cssGradient #cssMask #code #coding #frontend #web #dev #webDev #webDevelopment
-
Missed this, made on the 1st of Jan on @codepen:
✨ Sliding border glow on hover for beveled cards, heavily commented https://codepen.io/thebabydino/pen/EayVXKj
Trivial if we have `corner-shape` support & even simpler with `border-area`. But here it's cross-browser.
Detailed explanation of the Maths behind on Ko-fi/ Patreon. This way, you get to both become smarter and support my work so I can continue coding.
#CSS #Maths #cssMaths #cssGradient #cssMask #code #coding #frontend #web #dev #webDev #webDevelopment