Blend Bits 11: Effects

Silverlight supports built-in and custom effects that you can easily use in Blend on the artboard.

I’ve got some text here inside a ViewBox on the artboard;

image

and I can find the properties of either the TextBlock or the Viewbox and apply an effect to it over in the Properties panel under the Appearance section;

image

as you’d expect, I can take particular effects and make them into resources and then reference them wherever those resources are “in scope”. Hitting the New button raises a dialog;

image

with the BlurEffect and DropShadowEffect available but if I go out and reference Microsoft.Expression.Effects.dll;

image

then I get a lot more to play with;

image

Some of these ( the names are descriptive ) are regular effects such as RippleEffect whereas others are transition effects ( more on those in another post ).

Choosing an effect lets me set its specific properties;

image

and you should be able to animate those properties in the standard way.

One of the limitations of effects is that you can only apply a single effect to a particular element. That is, having applied a DropShadowEffect above to my Viewbox, I can’t now apply a Blur effect to the same ViewBox.

One way around that is to group the element in question into a new container like a Border for instance and then you can just apply the new effect to the Border as I’ve done below where I’ve added a Border around my Viewbox and then set a Blur effect on that Border;

image

image

One of the things that you’ll encounter if you’re playing with effects on the artboard is that the CPUs can go a bit nuts and especially as you zoom around effects.

As I zoom my text here, I notice that the effect disappears when I hit a particular value;

image

and this is controlled on the Options dialog;

image

so that when I hit 400% zoom on my artboard, effects will no longer be rendered to save me from burning my CPU.

I can also control that more locally by switching off effects temporarily;

image

if I’m finding that the way I’m manipulating the effects on the artboard by zooming and so on is causing the environment to become unresponsive and I can do that for individual effects of course in the Objects/Timeline panel;

image

The picture above illustrates that I’ve turned off the BlurEffect for a moment but left on the DropShadowEffect.