Re: [css3-values] About calc()

L. David Baron wrote:
> On Sunday 2009-02-01 13:43 +0100, Giovanni Campagna wrote:
> 
>> 3) some base maths functions, like pow(<base>,<exp>), to allow a
>> greater extensibility (trigonometry or logarithms may be useful, but
>> I'm not sure they're required)
> 
> Do you have actual use cases for them?
> 

Pie-menus[1] would be good example I think.

Sort of:

menu.pie > li
{
   left: calc(50% + 50% * cos( Pi2 * self.index / parent.children)  );
   top: calc(50% + 50% * sin( Pi2 * self.index / parent.children) );
}

But if to go further we will end up with something close to this:

   http://www.terrainformatica.com/htmlayout/csss!-calc-function.htm
   http://www.terrainformatica.com/htmlayout/csss!.htm

I know that it looks a bit wild but things like:

.container
{
   width: calc( 2 * text-width( nth-child(2):text ) );
}

are quite popular.

Or something like animations in WebKit[2]. Say:

div:animating
{
   width: calc( exp( animation-step() ) );
}


[1] http://en.wikipedia.org/wiki/Pie_menu
[2] http://webkit.org/blog/324/css-animation-2

-- 
Andrew Fedoniouk.

http://terrainformatica.com

Received on Tuesday, 10 February 2009 04:24:37 UTC