Mojocolors: 色相、彩度、明るさなどを操作するActionScriptライブラリ

「Mojocolors」とは、ActionScriptで色相、彩度、明るさ(HSB: Hue, Saturation, Brightness)などを簡単、自然な方法で操作するオープンソースのActionScriptライブラリです。






// create the first color object, a nice blue:
var blue : Color = new Color(16, 34, 43);

// then the second color
var orange : Color = new Color(226, 240, 214);


// you can now use the .gradient method on color to create a gradient. A
// ColorWheel is created which stores all colors from blue to orange.
var gradient : ColorWheel = blue.gradientTo(orange);


// now we paint rectangles for each color in the wheel.
// you do not have to access a color in the colorwheel by an index. If
// you use the ColorWheel in a loop, then getColor not only gives you
// the current color, it also “rotates” the wheel to the next color.
// When the wheel went through all colors, it starts at it’s beginning.

for (var i : int = 0;i < gradient.length(); i++) { // get the current color var currentColor : Color = gradient.getColor(); // to get the hex values of the color, use getHex; * 10, 0, 10, this.stage.stageHeight / 2);; }


// when you create a ColorWheel with the gradientTo method, all
// colors are sorted. you can mix your ColorWheel by
// calling shuffle():
var theX : Number = 250;
for (var k : int = 0;k < gradient.length(); k++) { // get the current color currentColor = gradient.getColor(); // draw the bars again with a offset.; var random : Number = Math.random()*30;, 0, 5 +random, this.stage.stageHeight / 2);; theX += random; }

[関連リンク] 公式ページ

1 thought on “Mojocolors: 色相、彩度、明るさなどを操作するActionScriptライブラリ”

  1. Simply want to say your article is as tonishing. The clarity in your post is simply striking and i can take for granted you are an expert on this subject. Well with your permission allow me to grab your rss feed to keep up to date with future post. Thanks a million and please keep up the good work.

Leave a Reply

Your email address will not be published. Required fields are marked *