W3C home > Mailing lists > Public > www-style@w3.org > February 2009

Re: [css3-values] About calc()

From: Andrew Fedoniouk <news@terrainformatica.com>
Date: Mon, 09 Feb 2009 20:24:01 -0800
Message-ID: <49910161.8050706@terrainformatica.com>
To: "L. David Baron" <dbaron@dbaron.org>
CC: www-style@w3.org

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 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:16 GMT