[Papervision3D] Tweener Object Brightness

br at elbjoern.com br at elbjoern.com
Thu Oct 11 16:16:20 PDT 2007


hi list,
try to get the code below running.
this is the code i tried:
1.
var colorObj:Color = new Color ();
colorObj.brightness = .5;
Tweener.addTween(vc1.container.transform, {colorTransform:colorObj,  
time:aniLength*2, transition:"easeInOutCubic"});
2.
var brightnessOffset = -100;
var transformer:ColorTransform = new ColorTransform(1, 1, 1, 1,  
brightnessOffset, brightnessOffset, brightnessOffset, 0);
Tweener.addTween(vc1.container.transform,  
{colorTransform:transformer, time:aniLength*2,  
transition:"easeInOutCubic"});

both won't work, but why?
to set the colorTransform without tweener isn't the problem  
(vc1.container.transform.colorTransform = colorObj)
can anybody give me a hint?
cheers, björn


>
> ----- Original Message -----
> From: "Zeh Fernando" <zehfernando at zeh.com.br>
> To: <Papervision3D at osflash.org>
> Sent: Wednesday, June 06, 2007 2:36 PM
> Subject: Re: [Papervision3D] Tweener Object Brightness
>
>
>> Hello Donovan
>>
>>> I know this can be done with:
>>> var colorObj:Color = new Color ( );
>>> colorObj.brightness = .5;
>>> plane.container.transform.colorTransform = colorObj;
>>> But can this be done with Tweener?
>>
>> Natively - no. This is one of the "special" properties Tweener  
>> still lack.
>>
>> You can do this, however.. this is what will be added to Tweener in a
>> few days:
>>
>> var _bg_get:Function = function (p_obj:Object):Number {
>> return p_obj.transform.colorTransform.brightness;
>> };
>>
>> var _bg_set:Function = function (p_obj:Object, p_value:Number):void {
>> var tf:ColorTransform = p_obj.transform.colorTransform;
>> tf.brightness = p_value;
>> p_obj.transform.colorTransform = tf;
>> };
>> Tweener.registerSpecialProperty("_brightness", _bg_get, _bg_set);
>>
>>
>> This bunch of code creates a new special property called  
>> "_brightness"
>> that controls the brightness of objects using the
>> transform.colorTransform object. After that's done, you can use this
>> kind of code to tween the brightness of something:
>>
>> Tweener.addTween(cubeArray[q][i].container, {_brightness:-0.9,  
>> time:.3,
>> transition:"easeinoutexpo"});
>>
>> Etc.
>>
>>> I tried this but to no avail:
>>> var colorObj:Color = new Color ( );
>>> colorObj.brightness = -.9;
>>> Tweener.addTween(cubeArray[q][i].container.transform,  
>>> {colorTransform:
>>> colorObj, time:.3, transition:"easeinoutexpo"});
>>
>> The problem with some of the approach MM took with the most  
>> advanced AS2
>> and AS3 classes and properties is that you don't just change their
>> value.. you need to reapply them to their container. That's why  
>> tweening
>> filter properties is so clumsy, regardless of the solution... also  
>> why
>> tweening the new colorTransform properties is less straightforward  
>> than
>> it should. In a perfect world, you'd just tween the .brightness  
>> value of
>> whatever.transform.colorTransform, or .blurX of a BlurFilter  
>> instance,
>> but that doesn't work since you need to reapply that to the container
>> object. So developers are forced to take an extra step.
>>
>> We do have some things in store to make that kind of tweening  
>> easier on
>> Tweener, but right now using special properties (which work kinda  
>> like a
>> proxy) is the closest or most straightforward solution the engine  
>> has.
>> Not VERY straightforward on this case since the new special  
>> property has
>> to be registered, but at least those special properties for color
>> tweening (brightness, hue, contrast, etc) will show up on the next
>> version.
>>
>> Hope that helps,
>> Zeh
>>
>> _______________________________________________
>> Papervision3D mailing list
>> Papervision3D at osflash.org
>> http://osflash.org/mailman/listinfo/papervision3d_osflash.org
>>
>
>
> _______________________________________________
> Papervision3D mailing list
> Papervision3D at osflash.org
> http://osflash.org/mailman/listinfo/papervision3d_osflash.org




More information about the Papervision3D mailing list