Stateful skins with Degrafa

animation, Degrafa, Flash, Flex 1 Comment »

I’ve been using Degrafa lately to build programmatic skins for a Flex theme. Degrafa is a ‘Declarative Graphics Format’ that allows you to draw graphics using MXML. This isn’t all it does though. You can use binding to dynamically adapt the graphics and it also extends your ability to change the styles of skins with CSS. I’ll be looking closely at that next as it does look rather interesting.

Degrafa is very powerful and I think I will continue to use it even when I’m deep into Flex 4 and FXG which uses very similar syntax.

The latest version of Degrafa allows you to add states to a skin so you can easily change the visual appearance based on the state of the skinned object. Here’s an example …

If you view the source (right-click in the iFrame) and take a look at the PopButtonSkin class you can see how this simple PopMenuButton component was skinned without any graphics files.

And here’s the Application file for you to look over. You can also grab the source from the example above by right-clicking and ‘viewing the source’.

The main thing to know about PopButton components in Flex is that they have extra button states that you need to know about. They are the pop-up-over and pop-up-down states. It is these states that are triggered when the user is interacting with the ‘arrow’ part of the popButton although this symbol is only part of the default halo skin. Also, the arrow can be changed for any icon. Remember that the skin for these states covers the entire button and isn’t an overlay over the hit area. In my example I’m drawing a backslash where my arrow should be until you roll over and it prompts the interaction.

Notice in the skin file that the fills and strokes are created separately from the Geometry. This is very useful as it means you could create a completely separate file to manage the palette of your app. I don’t just mean the colour scheme though. You can set out all your grads, stroke weights and fills and then reference them in different skins to ensure consistency.

The geometry is very straightforward and the skinWidth and skinHeight properties ensure the skin fits the component perfectly. Notice my borders are comprised of three rectangles overlaid and I’m offsetting them to create a border around my button. I could have used two rectangles with strokes to get the same result. The strokes use gradients too.

Before Degrafa introduced states you would have a whole bunch of objects declared in your geometry and would differentiate each object with the button state by using the objects state property. This could get quite messy. Now you will notice that the states are set separately and work in just the same way that you would expect. You can adjust the properties of objects, add and remove children and you can base one state on another to avoid any duplication of code. Overall this is a very neat way of creating skins.

Notice I add the IsocelesTriangle AutoShape to the geometry only on the over state. The down state is based on the over state so it will retain the arrow. This arrow could also be animated when you click by creating a tween and effecting the RotateTransform angle property.

The next step is to add filter support and transitions. I’ve seen some animation done with Degrafa that seemed very easy to implement … it’s time to play some more.

Papervision & Go3D CubeWall

Actionscript, animation, Flash, Flex, Papervision, Uncategorized 1 Comment »

I must be mad to publish something I intend to use as the basis for my new website but what the heck, no-one reads my blog anyway!

I’ve been playing around with John Grden’s wonderful Go3D which is an implementation of the GoASAP tweening ‘architecture’ developed by Moses Gunesch who gave us the legendary Fuse kit for AS2 … {sigh} … those were the days.

cubewall

Launch demo

Right-click, View Source to grab the code and if anyone has any input regarding some of the comments in the code please do get in touch. You will need the Go3D and PaperVision 2 classes and there’s also a reference to the Thunderbolt Logging classes which I would urge people to check out if they regularly use Firefox and would like to Log their Flex apps in firebug as part of their day-to-day development.

Something that is bothering me is the way the Wall pops out of its container. This is something to do with using a UIComponent in Flex and seems to be related to a previous post of mine regarding the drawing of graphics onto a Canvas in Flex. You need to set the dimensions so it masks properly. If anyone has any feedback on this please let me know. I’m going to look into it when I have five minutes.

This CubeWall could just as easily be a SphereWall or PlaneWall and although it is a very basic look at what is possible it will act as a basis for anyone (like myself) starting out with PaperVision. I need to look into the lighting and shading now. More soon!

Flash 10 sneak peek

animation, Flash, Software No Comments »

From the FITC Flickr pool some screen shots of Flash 10 showing off a neat After-Effects style interface and finally, bones for proper character animation.

New Flash 10 Animation Features

There’s no word on advanced audio functionality as yet but here’s hoping Andre gets his way.

It looks like, now that the developers have Flex, Flash can concentrate on what it was originally designed for. I can see myself sitting down and whacking my Wacom again … just like the old days!

Good things should never end

animation, illustration, marketing, media, vector No Comments »

unlimited orange

Lovely bit of marketing from orange. Nice to see some simple, well-executed, back-to-basics Flash animation all held together in a friendly, easy to use interface. Especially interesting for me as I viewed it on my portrait monitor and the long vertical scrolling made the whole experience very appealing. Some lovely little touches too … check out the mute button bottom-right. The audio is great too … I will definitely be trying this site out with my daughter later as I think she’ll love all the strange sound effects and cute little characters (she’s just turned one). Can anyone enlighten me on who produced the site and who the illustrator was? It looks like the work of Al Murphy but I could be wrong. Could Airside have been the agency responsible? They love their cute little vector creatures.

UPDATE: Incidentally if you press the red button while watching Orange’s new ad on TV you get this secret ad for the same campaign …

WP Theme & Icons by N.Design Studio
Entries RSS Comments RSS Log in