A cute wobbly face generator using beziers in AS3.
Click here to have a wee play.
I was standing in the shower thinking about beziers, (’cause that’s y’know.. what you do) and came to the conclusion it would be interesting to draw some lines through a warped circle and add eyes. That’s about the long and short of it. Enjoy.
Time and time again, AS3 reaffirms its place in my heart as one of the most well planned, well implemented and functional languages I’ve had the pleasure of using. So when I came across this little gem – someone trying to perform a bitwise shift left on a floating point number – I wasn’t sure whether to be intrigued, impressed or confused.
var Y:Number = 5.5;
var X:int = Y << 8;
I found myself asking why this functionality was included, what would be the outcome, why it worked, and if it did work what sort of rounding was going on behind the scenes.(Also why would anyone attempt this, but that was fairly tertiary.)
As it turns out, AS3’s SHL operator can actually be used as a very fast and quite useful form of rounding. Read on for an explanation, some examples and calculated times.