Difference between revisions of "Logo.as"

From Organic Design wiki
m
m
 
(85 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 +
{{legacy}}
 +
<source lang="js">
 +
// This is the script which compiles the logo with dynamic changes behind it
 +
// - compiles [[[[Logo_Test|here]]]]
 +
// - the info it renders is obtained from [[[[Special:Recentchanges]]]] and is generated by [[[[transform-changes.php]]]]
 
#include "box-model.as"
 
#include "box-model.as"
  
textcol = '#' + textcol;
+
// Constants
background = parseInt( background, 16 );
+
background = parseInt(background,16);
bg_r = ( background & 0xff0000 ) >> 16;
+
bg_r = (background & 0xff0000)>>16;
bg_g = ( background & 0x00ff00 ) >> 8;
+
bg_g = (background & 0x00ff00)>>8;
bg_b = ( background & 0x0000ff );
+
bg_b = (background & 0x0000ff);
 
fw = 20; // width of fades
 
fw = 20; // width of fades
 
id0 = 1;
 
id0 = 1;
 
changes = [];
 
changes = [];
 
change = false;
 
change = false;
nchanges = 10;
 
 
offset = -200;
 
offset = -200;
 +
stripes = (width >= 200);
 +
lineHeight = height/nchanges; // NOTE: don't use rects for stripes, use multiples positioned textboxes
  
 
// Set up async connection with server
 
// Set up async connection with server
 
server = new LoadVars();
 
server = new LoadVars();
 
recv = new LoadVars();
 
recv = new LoadVars();
server.title = 'RC-Summary'; // wiki page to request
+
server.title = 'Special:Recentchanges'; // wiki page to request
 
recv.onLoad = function(success) {
 
recv.onLoad = function(success) {
 
if (success) {
 
if (success) {
for ( i = 0; i < nchanges; i++ ) {
+
for (i = 0; i<nchanges; i++) {
 
row = recv['item'+i].split(',');
 
row = recv['item'+i].split(',');
 
id = row.shift();
 
id = row.shift();
Line 26: Line 32:
 
id0 = id;
 
id0 = id;
 
}
 
}
time = row.shift();
+
time = row.shift();
user = row.shift();
+
author = row.shift();
user = '<u><a href="/User:'+user+'">'+user+'</a></u>';
+
title = row.shift();
title = row.shift();
+
textcol = row.shift();
title = '<a href="/'+title+'">'+title+'</a>';
+
comment = row.join(',');
comment = row.join(',');
+
if (comment != '') title = comment;
if (comment != '') title = comment;
+
changes[i] = '<font size="9" face="arial, helvetica" color="'+textcol+'">'+time+': (<u><font color="#217A28">'+author+'</font></u>) ';
changes[i] = '<font face="arial, helvetica" color="'+textcol+'"><i><b>'+user+' &nbsp;</b> ';
+
changes[i] += title+'</font><font face="arial" size="10">&nbsp;</font><br>';
changes[i] += title+'</i></font><font face="arial" size="17">&nbsp;</font><br>';
 
 
}
 
}
 
rc.htmlText = changes.join('');
 
rc.htmlText = changes.join('');
 +
// Get info if any returned
 +
if (recv.user) _root.user = recv.user;
 
}
 
}
 
};
 
};
  
 
// Textbox for changes-text
 
// Textbox for changes-text
createTextField( 'rc', 1, 0, 0, width, height );
+
createTextField('rc', 1, 3, 0, width, height);
with ( rc ) {
+
with (rc) {
 +
autosize = 'left';
 
selectable = false;
 
selectable = false;
 
_quality = 'BEST';
 
_quality = 'BEST';
Line 51: Line 59:
 
}
 
}
  
// Top fade
+
if (stripes) {
createSymbol( this, 'linear', 'top', 2 );
+
// Striped background
//col = new Color( top );
+
createEmptyMovieClip('bg',0);
//col.setTransform( { rb:bg_r, gb:bg_g, bb:bg_b } );
+
for (i = 0; i<nchanges; i++) {
top._width = fw;
+
createSymbol(bg,'rect','bg'+i,i);
top._height = width;
+
var bgi = bg['bg'+i];
top._x = width / 2;
+
col = new Color(bgi);
top._y = width / 2; //fw / 2;
+
col.setTransform({rb:0xd4,gb:0xd4,bb:0xd4});
top._rotation = 270;
+
bgi._width = width;
 +
bgi._height = lineHeight;
 +
bgi._x = 0;
 +
bgi._y = i*lineHeight;
 +
if (i%2) bgi._visible = false;
 +
}
 +
bg._x = width/2;
 +
bg._width = width;
 +
bg._height = height;
 +
}
 +
else {
  
// Bottom fade
+
// Logo in background (specified for inclusion in XML properties article)
createSymbol( this, 'linear', 'bot', 3 );
+
attachMovie('xmlwiki','bg',0);
col = new Color( bot );
+
with (bg) {
col.setTransform( { rb:bg_r, gb:bg_g, bb:bg_b } );
+
_xscale = _yscale = 75;
bot._width = fw;
+
_x = (width-_width)/2;
bot._height = width;
+
_y = (height-_height)/2;
bot._x = width / 2;
+
_alpha = 0;
bot._y = height - fw / 2;
+
}
bot._rotation = 270;
+
}
 
 
// Right fade
 
createSymbol( this, 'linear', 'right', 4 );
 
col = new Color( right );
 
col.setTransform( { rb:bg_r, gb:bg_g, bb:bg_b } );
 
right._width = fw;
 
right._height = height;
 
right._x = width - fw / 2;
 
right._y = height / 2;
 
right._rotation = 180;
 
 
 
// Logo (specified for inclusion in XML properties article)
 
//attachMovie( 'xmlwiki', 'xmlwiki', 5 );
 
  
 
// Per-frame function
 
// Per-frame function
Line 90: Line 95:
 
if ( offset < 0 ) offset++;
 
if ( offset < 0 ) offset++;
 
rc._y = offset;
 
rc._y = offset;
 +
if (stripes) bg._y = offset+500;
  
 
// Make request on some regular cycle which seems about right
 
// Make request on some regular cycle which seems about right
Line 95: Line 101:
 
if ( ++_root.ctr%400 == 1 ) {
 
if ( ++_root.ctr%400 == 1 ) {
 
server.SWF = id0;
 
server.SWF = id0;
 +
server.INFO = 1; // request info if user unknown
 
server.sendAndLoad( '/wiki/index.php', recv, 'GET' );
 
server.sendAndLoad( '/wiki/index.php', recv, 'GET' );
 
}
 
}
  
 
}
 
}
 +
</source>

Latest revision as of 13:17, 6 August 2024

Legacy.svg Legacy: This article describes a concept that has been superseded in the course of ongoing development on the Organic Design wiki. Please do not develop this any further or base work on this concept, now this page is for historic record only.
// This is the script which compiles the logo with dynamic changes behind it
// - compiles [[[[Logo_Test|here]]]]
// - the info it renders is obtained from [[[[Special:Recentchanges]]]] and is generated by [[[[transform-changes.php]]]]
#include "box-model.as"

// Constants
background = parseInt(background,16);
bg_r = (background & 0xff0000)>>16;
bg_g = (background & 0x00ff00)>>8;
bg_b = (background & 0x0000ff);
fw = 20; // width of fades
id0 = 1;
changes = [];
change = false;
offset = -200;
stripes = (width >= 200);
lineHeight = height/nchanges; // NOTE: don't use rects for stripes, use multiples positioned textboxes

// Set up async connection with server
server = new LoadVars();
recv = new LoadVars();
server.title = 'Special:Recentchanges';	// wiki page to request
recv.onLoad = function(success) {
	if (success) {
		for (i = 0; i<nchanges; i++) {
			row = recv['item'+i].split(',');
			id = row.shift();
			if ( ( i == 0 ) && ( id != id0 ) ) {
				if ( id0 ) offset = -20;
				id0 = id;
				}
		time = row.shift();
		author = row.shift();
		title = row.shift();
		textcol = row.shift();
		comment = row.join(',');
		if (comment != '') title = comment;
			changes[i] = '<font size="9" face="arial, helvetica" color="'+textcol+'">'+time+': (<u><font color="#217A28">'+author+'</font></u>) ';
			changes[i] += title+'</font><font face="arial" size="10">&nbsp;</font><br>';
			}
		rc.htmlText = changes.join('');
		// Get info if any returned
		if (recv.user) _root.user = recv.user;
		}
	};

// Textbox for changes-text
createTextField('rc', 1, 3, 0, width, height);
with (rc) {
	autosize = 'left';
	selectable = false;
	_quality = 'BEST';
	border = false;
	multiline = true;
	wordWrap = false;
	html = true;
	}

if (stripes) {
	// Striped background
	createEmptyMovieClip('bg',0);
	for (i = 0; i<nchanges; i++) {
		createSymbol(bg,'rect','bg'+i,i);
		var bgi = bg['bg'+i];
		col = new Color(bgi);
		col.setTransform({rb:0xd4,gb:0xd4,bb:0xd4});
		bgi._width = width;
		bgi._height = lineHeight;
		bgi._x = 0;
		bgi._y = i*lineHeight;
		if (i%2) bgi._visible = false;
		}
	bg._x = width/2;
	bg._width = width;
	bg._height = height;
	}
else {

	// Logo in background (specified for inclusion in XML properties article)
	attachMovie('xmlwiki','bg',0);
	with (bg) {
		_xscale = _yscale = 75;
		_x = (width-_width)/2;
		_y = (height-_height)/2;
		_alpha = 0;
		}
	}

// Per-frame function
function reduce() {

	// Scrolling
	if ( offset < 0 ) offset++;
	rc._y = offset;
	if (stripes) bg._y = offset+500;

	// Make request on some regular cycle which seems about right
	// todo: move to socket.onData
	if ( ++_root.ctr%400 == 1 ) {
		server.SWF = id0;
		server.INFO = 1; // request info if user unknown
		server.sendAndLoad( '/wiki/index.php', recv, 'GET' );
		}

	}