Archive for the ‘Programming’ Category

Pixel Shading and Adobe AIF

Thursday, May 1st, 2008

Pixel shading is a feature supported on graphics hardware starting with the Radeon R200 based cards (8500-9250) and the GeForce FX series. Though pixel shading was first specified in OpenGL 1.1 and DirectX 8, it wasn’t implemented by consumer grade hardware until OpenGL 1.4 and DirectX 8.1. These consumer grade cards are enumerated on the Adobe Labs AIF toolkit page . Before shaders existed the graphics pipeline for real-time rasterisation (via a GPU) was fully procedural and the only means by which a programmer could interact with that processing pipeline was to use the standard APIs. However with shaders, any 3D author has the power to fully control the rasterisation algorithm at the frame buffer level. The only downside to this level of control is that the shader must be pre-compiled before put into use. Nvidia has recently opened the doors up more by introducing CUDA. It would be really interesting to see Adobe produce something similar (but cross-platform) with some future version of Flash. Whether that would be a good or bad thing can be debated and discussed for a long time.

Last night I decided to break out the AIF toolkit again and work some mathy expressions into a filter. Up to this point most of the filters that I’ve seen are along the lines of what you will find in Photoshop’s menus. Those filters certainly aren’t bad, but I’ve always been more interested in how an image can be sampled and reconstructed in a manner not unlike what’s found in the 90’s DJ scene. So with that introduction I’d like to demonstrate my latest filter.

Ripped Filter (v3) image 01

Ripped Filter (v3) image 02

Just like in Flash, you can think of the canvas as a 2D coordinate plane. For this filter I used a few trigonometric and polynomial expressions in combination. Most of the polynomial coefficients are also parameters that you can manipulate which is where all the fun is. More to come, stay tuned.

Download the filter.

A review of popular tweening library (UPDATED)

Tuesday, April 15th, 2008

The goal of next version of my (your) animation engine KitchenSync, is to be arguably the best and most complete library for animation and sequencing out there. To do this, I’ve spent the last couple of months analyzing the top existing tween libraries trying to pinpoint their strengths and weaknesses. With lots of help from the Draw Logic Blog, I think I’ve identified the contenders and put together a decent list of what (in my opinion) are their highest and lowest points. The next step will be to create a product backlog for KitchenSync based on matching these features and fixing the problems. I know there are other tween engines but these seemed to be the most prolific ones at the time. The tween engines analyzed were:

  • Tweener
  • TweenLite (and flavours)
  • Boostworthy Animation System
  • FuseKit
  • Go
  • and KitchenSync 1.1

Note: After some helpful feedback from readers (THANK YOU!) I added TweenLite to the list of libraries I reviewed. I should add here that these are fairly superficial observations about how things work and don’t go into incredible detail. If I steal any features, I’ll look closer ;-D

Keep the comments coming!

Tween Engine Comparisons (updated)

Reader Question: Why isn’t event bubbling working

Tuesday, March 18th, 2008

A reader sent me this question. Thanks in advance to Michael:

i’m dispatching an event from a sprite after it fades in completely
dispatchEvent(new Event(Main.ENTER_SCREEN_COMPLETE));

i’m trying to listen for to this event but for some reason it doesn’t get picked up when the capturing parameter is set to false.. that is for bubbling and the target phase.

This works
container.addEventListener(Main.ENTER_SCREEN_COMPLETE, screenTweenComplete, true, 0, true);

This does NOT work
container.addEventListener(Main.ENTER_SCREEN_COMPLETE, screenTweenComplete, false, 0, true);

Where container, is an ancestor to everything on the screen. Essentially its the the stage.

Any clues why this is happening?

Answer after the jump.
(more…)

KitchenSync News: Patch released v1.0.1, source files for Flash CS3, more docs

Friday, February 8th, 2008

kitchenSync

Hey KS Fans,

KitchenSync version 1.0.1 was released last week. This version is just a patch that fixes a few minor issues. Here’s the change log for this version.


===== v1.0.1 (2008.02.04) ======
Fixed Cubic.easeOut bug.
Made getters for Tween's toValue and fromValue.
Added source code to main download.
Added metadata for events.
Updated docs and added summaries to all wiki pages.

I received some feedback from people who were having trouble setting up KitchenSync for use with Flash CS3. I didn’t know this before but you cannot use .swc files compiled with the Flex SDK in a .fla file (WTF, Adobe!) Also, some people were confused by having to use SVN to get the source. To help solve these problems, I’ve added the latest source code as its own download.

I’ve also written EVEN MORE documentation including help for downloading and setting up the source code.

Finally, if you’re using KS, drop me a line or post to the mailing list. I’d love to hear any feedback you may have!

The State pattern in Flex – combining view states with logical states

Wednesday, January 23rd, 2008

If you’ve used Flex, you’ve no doubt (er, hopefully) been using View States (AKA <mx:State>) to change the look of your RIA as it progresses through different situations of use. While this is immeasurably useful, it does not necessarily qualify as an implementation of the State Design Pattern which allows you to change not only how a component looks but how it functions as well.
(for more on design patterns, read my favorite book Head first design patterns).
(more…)