Archive

Archive for August, 2009

Drawing A Sine Wave In Actionscript

August 7th, 2009 Adam 9 comments

Just a simple way to draw a sine wave with a specific amplitude and frequency. Use the sliders to adjust the values.
(Either JavaScript is not active or you are using an old version of Adobe Flash Player. Please install the newest Flash Player.)

Here’s the main function:

function drawWave(amp:int, freq:int):void{
	newSine.graphics.clear();
	newSine.graphics.lineStyle(2, 0xff0000, 0.4);
	newSine.graphics.moveTo(0, yaxis);
	for(var i:int=0; i<=stage.stageWidth; i++){
		var ang:Number = 2 * Math.PI * freq * i/stage.stageWidth;
		newSine.graphics.lineTo(i, yaxis - amp*Math.sin(ang));
	}
}

(EDIT 8/14/09: In the SWF above, the sine wave is upside down. That’s because I had a typo when I wrote it. On line 7 of the code, I had typed “…yaxis + amp…” but it should be minus. The code above is correct, but the SWF hasn’t been updated)

Gray CRX Theme for Google Chrome Dev

August 4th, 2009 Adam 1 comment

I just switched to the latest dev build of Google Chrome, and it supports multiple themes, in an easy-to-install .crx format. So I thought I’d go ahead and make my gray theme (since I can’t stand the default bright blue). Another benefit is finally being able to skin the bookmark bar.

If you want to switch to dev build from stable OR beta, just grab the chrome changer file and switch to dev, then close and restart Chrome. Then click the wrench then click About Google Chrome. Then get the latest version. You can now install crx themes.

Here’s the theme file:
Simply Gray

Categories: misc Tags: , , , , , , , ,