Re: [css shaders] Request for additional UA uniform variables

On Oct 14, 2011, at 5:15 PM, Dean Jackson wrote:

> 
> On 13/10/2011, at 4:16 AM, Chris Subagio wrote:
> 
>> First, I'd like you to consider a clock parameter. 
>> 
>> This would be a constantly increasing value that you could use for ambient animations, like say a waving flag or lapping waves.
>> 
>> Ideally this u_clock would be something like a (float) seconds since 1970, unix style. Someone might find a neat use for the actual absolute time, versus just an incrementing number. Unfortunately the precision on these constant registers can vary wildly from hardware to hardware, and it's unlikely that such large numbers would work. So perhaps running time since page load would be sufficient, with some way to also pass in the absolute clock time when the page was loaded?
>> 
>> As an optimization, the clock parameter could be an option enabled from the filter declaration (defaulted to off!), effectively switching the element from a transition only animation to an ambient animation.
> 
> I think this should be done with a parameter to the shader and animated via CSS.
> 
> Just adding it automatically is saying "please redraw this as often as possible for the entire time the effect is applied" which could kill battery. It's much better to be explicit. For example:
> 
> filter: shader("flag.vs", "flag.fs", ….. timeoffset 0);
> animation: wave-the-flag 3s 10;  /* wave the flag over 3s, repeat 10 times */
> 
> keyframes {
> 
> from {
>    filter: shader("flag.vs", "flag.fs", ….. timeoffset 0);
> }
> 
> to {
>    filter: shader("flag.vs", "flag.fs", ….. timeoffset 1);
> }
> 
> }

Yeah, this looks right. It's too bad that we have to be so wordy with the keyframes. Imagine a lengthy filter where only one parameter of one filter function changes. And then imagine an animation with 20 or 30 keyframes. That's a lot of repeated text. It would be nice if we had some keyframe shorthand to allow us to elide all that text.

-----
~Chris
cmarrin@apple.com

Received on Monday, 17 October 2011 17:31:15 UTC