Lasso Soft Inc. > Home

[rgb_Row]

Linkrgb_Row
AuthorKe Carlton
CategoryOutput
Version8.x
LicensePublic Domain
Posted16 Apr 2006
Updated16 Apr 2006
More by this author...

Description

This tag generates a colour array that cycles through the colour spectrum and returns a #hex value to represent the current iteration.

You can additionally specify minimum and maximum brightness levels.

Enjoy!

Ke

Sample Usage

[var:'toloop'=15]
[loop:$toloop]
Row: [loop_count]
[/loop]

Source Code

Click the "Download" button below to retrieve a copy of this tag, including the complete documentation and sample usage shown on this page. Place the downloaded ".inc" file in your LassoStartup folder, restart Lasso, and you can begin using this tag immediately.

define_tag: 'rgb_row';
	// Returns a transitional colour based on total number of rows and the current row number
	// PARAMS: Row Number, Total Rows, Min Brightness (optional) , Max Brightness (optional)
	//		Example use:
	//			[var:'toloop'=15]
	//			[loop:$toloop]
	//				Row: [loop_count]
// [/loop] if:params->size >= 2; local:'row'=params->(get:1); local:'count'=params->(get:2); if:#count > 360; local:'row' = (math_ceil:#row * (360.00/#count)); #count = 360; /if; local:'deg'=360/#count; local:'loop'= #count; local:'colours'=(array); local:'min' = 100; // Minimum brightness level local:'max' = 220; // Maxium brightness level params->size >=3 ? #min = params->(get:3); // Overide Minimum Brightness params->size >=4 ? #max = params->(get:4); // Overide Maxium Brightness local:'r'=(array); local:'g'=(array); local:'b'=(array); local:'c'=''; if:(var_defined:'RBG'+#count); #colours = (var:'RBG'+#count); else; // Generate first hue array loop:#loop; local:'ang'=#deg*loop_count; local:'offset' = 120; if:#ang < #offset || #ang >= (#offset+240); #c=#min; else:#ang >(#offset+60) && #ang < (#offset+240)-60; #c=#max; else:#ang <=(#offset+60); #c=#min+((#max-#min) * ((100.00/60)* (#ang-#offset)*0.01)); else; #c= #min+((#max-#min)* ((100.00/60)*((#offset+240)-#ang)*0.01) ); /if; #c = (math_round:#c,1); #c = (math_random:-lower=#c,-upper=#c,-hex); #c->size<2?#c='0'+#c; #b->(insert:#c); /loop; // Cycle for other primarys #r = #b;loop:#b->size/3;local:'x' = #r->(get:1);#r->(removefirst);#r->(insertlast:#x);/loop; #g = #r;loop:#b->size/3;local:'x' = #g->(get:1);#g->(removefirst);#g->(insertlast:#x);/loop; loop:#b->size;#colours->(insert:'#'+#r->(get:loop_count)+#b->(get:loop_count)+#g->(get:loop_count));/loop; var:'RBG'+#count = #colours; // Store colour array for future use /if; if:#row <= #colours->size; local:'colour' = #colours->(get:#row); return:#colour; else; return:'#FFFFFF'; /if; /if; /define_tag;

Comments

No comments

Please log in to comment

Subscribe to the LassoTalk mail list

LassoSoft Inc. > Home

 

 

©LassoSoft Inc 2015 | Web Development by Treefrog Inc | PrivacyLegal terms and Shipping | Contact LassoSoft