⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 aqualook.as

📁 太烦了
💻 AS
📖 第 1 页 / 共 5 页
字号:
		return Math.round(red * 2.55) * 65536 +
			Math.round(gre * 2.55) * 256 +
			Math.round(blu * 2.55);
	}

	private function drawOvalRect(movie:MovieClip, x:Number, y:Number,
		w:Number, h:Number, color:Number, nAlpha:Number, nSize:Number):Void
	{
		var rx:Number = Math.abs(w / 2);
		var ry:Number = Math.abs(h / 2);
		drawOval(movie, x + rx, y + ry, rx, ry, color, nAlpha, nSize);
	}

	private function fillOvalRect(movie:MovieClip, x:Number, y:Number, w:Number, h:Number,
		bgCol:Number, bgAlpha:Number, lineCol:Number, lineAlpha:Number):Void
	{
		if(!bgAlpha) bgAlpha = 100;
		movie.beginFill(bgCol, bgAlpha)
		drawOvalRect(movie, x, y, w, h, lineCol, lineAlpha);
		movie.endFill();
	}

	private function drawOval(movie:MovieClip, x:Number, y:Number,
		radius:Number, yRadius:Number, color:Number, nAlpha:Number, nSize:Number):Void
	{
		if (arguments.length < 3) return;
		if(nSize == undefined || nSize == null) nSize = 1;
		if(nAlpha == undefined) nAlpha = 100;
		if(color != null && color != undefined) movie.lineStyle(nSize, color, nAlpha);
		else movie.lineStyle(null, null, null);
		// init variables
		var theta, xrCtrl, yrCtrl, angle, angleMid, px, py, cx, cy:Number;
		// if only yRadius is undefined, yRadius = radius
		if (yRadius == undefined) yRadius = radius;
		// convert 45 degrees to radians for our calculations
		theta = Math.PI / 4;
		// calculate the distance for the control point
		xrCtrl = radius / Math.cos(theta / 2);
		yrCtrl = yRadius / Math.cos(theta / 2);
		// start on the right side of the circle
		angle = 0;
		movie.moveTo(x + radius, y);
		// this loop draws the circle in 8 segments
		for (var i = 0; i < 8; i++)
		{
			// increment our angles
			angle += theta;
			angleMid = angle - (theta / 2);
			// calculate our control point
			cx = x + Math.cos(angleMid) * xrCtrl;
			cy = y + Math.sin(angleMid) * yrCtrl;
			// calculate our end point
			px = x + Math.cos(angle) * radius;
			py = y + Math.sin(angle) * yRadius;
			// draw the circle segment
			movie.curveTo(cx, cy, px, py);
		}
	}
	
	function drawDrop(movie:MovieClip, x:Number, y:Number, w:Number, h:Number, col:Number, data:Object):Void
	{
		movie.beginFill(0, 60);
		drawOvalRect(movie, x, y, w, h);
		movie.endFill();

		var hsb:Object = rgb2hsb(col);
		var colors:Array = new Array(
			hsb2rgb({h:hsb.h, s:Math.max(0, hsb.s - 60), b:Math.min(100, hsb.b + 30)}),
			hsb2rgb({h:hsb.h, s:Math.max(0, hsb.s - 55), b:Math.min(100, hsb.b + 25)}),
			hsb2rgb({h:hsb.h, s:Math.max(0, hsb.s), b:Math.min(100, hsb.b - 12)}),
			hsb2rgb({h:hsb.h, s:Math.max(0, hsb.s), b:Math.min(100, hsb.b - 65)}));//0xdffeab, 0xbfff55, 0x136806, 0);
		var alphas:Array = new Array(100, 100, 100, 100);
		var ratios:Array = new Array(0, 60, 140, 255);
		var w1:Number = w - 2;
		var h1:Number = h - 2;
		var matrix:Object = {a:w1 * 1.55, b:0, c:0, d:0, e:h1 * 1.55, f:0, g:x + 1 + w1 / 2, h:y + 1 + h1 * 0.85, i:1};
		movie.beginGradientFill("radial", colors, alphas, ratios, matrix);
		drawOvalRect(movie, x + 1, y + 1, w1, h1);
		movie.endFill();
		colors.splice(0);
		alphas.splice(0);
		ratios.splice(0);
		colors.push(0xffffff, 0xffffff);
		alphas.push(80, 10);
		ratios.push(65, 255);
		matrix = {a:w1 * 0.9, b:0, c:0, d:0, e:h1 * 0.5, f:0, g:x + w / 2, h:y + 1 + h1 * 0.1, i:1};
		movie.beginGradientFill("radial", colors, alphas, ratios, matrix);
		drawOvalRect(movie, x + (w - w1 * 0.7) / 2, y + 1 + h1 * 0.02, w1 * 0.7, h1 * 0.35);
		movie.endFill();
		delete colors;
		delete alphas;
		delete ratios;
		if(data.mode == "press") fillOvalRect(movie, x, y, w, h, 0, 20);
		else if(data.mode == "over") fillOvalRect(movie, x, y, w, h, 0xffffff, 20);
	}

	//
	// round green button
	//
	private function drawRoundRect(movie:MovieClip, nX1:Number, nY1:Number, nX2:Number,
		nY2:Number, cornerRadius:Number, color:Number, alpha:Number, nSize:Number):Void
	{
		if(nSize == undefined || nSize == null) nSize = 1;
		if(alpha == undefined) alpha = 100;
		if(color == null || color == undefined) movie.lineStyle(undefined);
		else movie.lineStyle(nSize, color, alpha);
		var x:Number = Math.min(nX1, nX2);
		var y:Number = Math.min(nY1, nY2);
		var w:Number = Math.abs(nX2 - nX1);
		var h:Number = Math.abs(nY2 - nY1);
		// ==============
		// mc.drawRect() - by Ric Ewing (ric@formequalsfunction.com) - version 1.1 - 4.7.2002
		// 
		// x, y = top left corner of rect
		// w = width of rect
		// h = height of rect
		// cornerRadius = [optional] radius of rounding for corners (defaults to 0)
		// ==============
		if (arguments.length < 4) return;
		// if the user has defined cornerRadius our task is a bit more complex. :)
		if (cornerRadius > 0)
		{
			// init vars
			var theta, angle, cx, cy, px, py;
			// make sure that w + h are larger than 2*cornerRadius
			var cr:Number = Math.min(w, h) / 2;
			if (cornerRadius > cr)
				cornerRadius = cr;
			// theta = 45 degrees in radians
			theta = Math.PI / 4;
			// draw top line
			movie.moveTo(x + cornerRadius, y);
			movie.lineTo(x + w - cornerRadius, y);
			//angle is currently 90 degrees
			angle = -Math.PI / 2;
			// draw tr corner in two parts
			cx = x + w - cornerRadius + (Math.cos(angle + (theta / 2)) * cornerRadius / Math.cos(theta / 2));
			cy = y + cornerRadius + (Math.sin(angle + (theta / 2)) * cornerRadius / Math.cos(theta / 2));
			px = x + w - cornerRadius + (Math.cos(angle + theta) * cornerRadius);
			py = y + cornerRadius + (Math.sin(angle + theta) * cornerRadius);
			movie.curveTo(cx, cy, px, py);
			angle += theta;
			cx = x + w - cornerRadius + (Math.cos(angle + (theta / 2)) * cornerRadius / Math.cos(theta / 2));
			cy = y + cornerRadius + (Math.sin(angle + (theta / 2)) * cornerRadius / Math.cos(theta / 2));
			px = x + w - cornerRadius + (Math.cos(angle + theta) * cornerRadius);
			py = y + cornerRadius + (Math.sin(angle + theta) * cornerRadius);
			movie.curveTo(cx, cy, px, py);
			// draw right line
			movie.lineTo(x + w, y + h - cornerRadius);
			// draw br corner
			angle += theta;
			cx = x + w - cornerRadius + (Math.cos(angle + (theta / 2)) * cornerRadius / Math.cos(theta / 2));
			cy = y + h - cornerRadius + (Math.sin(angle + (theta / 2)) * cornerRadius / Math.cos(theta / 2));
			px = x + w - cornerRadius + (Math.cos(angle + theta) * cornerRadius);
			py = y + h - cornerRadius + (Math.sin(angle + theta) * cornerRadius);
			movie.curveTo(cx, cy, px, py);
			angle += theta;
			cx = x + w - cornerRadius + (Math.cos(angle + (theta / 2)) * cornerRadius / Math.cos(theta / 2));
			cy = y + h - cornerRadius + (Math.sin(angle + (theta / 2)) * cornerRadius / Math.cos(theta / 2));
			px = x + w - cornerRadius + (Math.cos(angle + theta) * cornerRadius);
			py = y + h - cornerRadius + (Math.sin(angle + theta) * cornerRadius);
			movie.curveTo(cx, cy, px, py);
			// draw bottom line
			movie.lineTo(x+cornerRadius, y+h);
			// draw bl corner
			angle += theta;
			cx = x + cornerRadius + (Math.cos(angle + (theta / 2)) * cornerRadius / Math.cos(theta / 2));
			cy = y + h - cornerRadius + (Math.sin(angle + (theta / 2)) * cornerRadius / Math.cos(theta / 2));
			px = x + cornerRadius + (Math.cos(angle + theta) * cornerRadius);
			py = y + h - cornerRadius + (Math.sin(angle + theta) * cornerRadius);
			movie.curveTo(cx, cy, px, py);
			angle += theta;
			cx = x + cornerRadius + (Math.cos(angle + (theta / 2)) * cornerRadius / Math.cos(theta / 2));
			cy = y + h - cornerRadius + (Math.sin(angle + (theta / 2)) * cornerRadius / Math.cos(theta / 2));
			px = x + cornerRadius + (Math.cos(angle + theta) * cornerRadius);
			py = y + h - cornerRadius + (Math.sin(angle + theta) * cornerRadius);
			movie.curveTo(cx, cy, px, py);
			// draw left line
			movie.lineTo(x, y + cornerRadius);
			// draw tl corner
			angle += theta;
			cx = x + cornerRadius + (Math.cos(angle + (theta / 2)) * cornerRadius / Math.cos(theta / 2));
			cy = y + cornerRadius + (Math.sin(angle + (theta / 2)) * cornerRadius / Math.cos(theta / 2));
			px = x + cornerRadius + (Math.cos(angle+  theta) * cornerRadius);
			py = y + cornerRadius + (Math.sin(angle + theta) * cornerRadius);
			movie.curveTo(cx, cy, px, py);
			angle += theta;
			cx = x + cornerRadius + (Math.cos(angle + (theta / 2)) * cornerRadius / Math.cos(theta / 2));
			cy = y + cornerRadius + (Math.sin(angle + (theta / 2)) * cornerRadius / Math.cos(theta / 2));
			px = x + cornerRadius + (Math.cos(angle + theta) * cornerRadius);
			py = y + cornerRadius + (Math.sin(angle + theta) * cornerRadius);
			movie.curveTo(cx, cy, px, py);
		}
		else
		{
			// cornerRadius was not defined or = 0. This makes it easy.
			movie.moveTo(x, y);
			movie.lineTo(x + w, y);
			movie.lineTo(x + w, y + h);
			movie.lineTo(x, y + h);
			movie.lineTo(x, y);
		}
	}
	
	private function fillRoundRect(movie:MovieClip, x1:Number, y1:Number, x2:Number, y2:Number, r:Number,
		bgCol:Number, bgAlpha:Number, lineCol:Number, lineAlpha:Number):Void
	{
		if(!bgAlpha) bgAlpha = 100;
		movie.beginFill(bgCol, bgAlpha)
		drawRoundRect(movie, x1, y1, x2, y2, r, lineCol, lineAlpha);
		movie.endFill();
	}

		/*movie.beginFill(0, 60);
		var r:Number = Math.min(w, h) / 2;
		drawRoundRect(movie, x, y, w, h, r);
		movie.endFill();
		var hsb:Object = rgb2hsb(col);
		var colors:Array = new Array(
			hsb2rgb({h:hsb.h, s:hsb.s, b:Math.max(0, hsb.b - 30)}),
			hsb2rgb({h:hsb.h, s:hsb.s, b:Math.max(0, hsb.b - 8)}),
			hsb2rgb({h:hsb.h, s:hsb.s, b:Math.min(100, hsb.b + 5)}),
			hsb2rgb({h:hsb.h, s:hsb.s, b:Math.max(0, hsb.b - 8)}),
			hsb2rgb({h:hsb.h, s:hsb.s, b:Math.max(0, hsb.b - 30)}));
		var alphas:Array = new Array(100, 100, 100, 100, 100);
		var ratios:Array = new Array(0, 50, 128, 205, 255);
		var w1:Number = w - 2;
		var h1:Number = h - 2;
		var r1:Number = Math.min(w1, h1) / 2;
		var matrix:Object = {matrixType:"box", x:x + 1, y:y + 1, w:w1, h:h1, r:w > h ? Math.PI / 2 : 0};
		movie.beginGradientFill("linear", colors, alphas, ratios, matrix);
		drawRoundRect(movie, x + 1, y + 1, w - 1, h - 1, r);
		movie.endFill();
	
		colors.splice(0);
		alphas.splice(0);
		ratios.splice(0);
		colors.push(0xffffff, 0xffffff, 0xffffff);
		alphas.push(80, 80, 2);
		ratios.push(20, 30, 255);
		var offX:Number = w > h ? x + 1 - r1 * 0.2 : x + r;
		var offY:Number = w > h ? y + r : y + 1 - r1 * 0.2;
		matrix = {a:r1 * 2, b:0, c:0, d:0, e:r1 * 2, f:0, g:offX, h:offY, i:1};
		movie.beginGradientFill("radial", colors, alphas, ratios, matrix);
		drawOvalRect(movie, x + 1, y + 1, r1 * 2, r1 * 2);
		movie.endFill();
	
		colors.splice(0);
		alphas.splice(0);
		ratios.splice(0);
		colors.push(0xffffff, 0xffffff, 0xffffff);
		alphas.push(80, 65, 2);
		ratios.push(65, 100, 255);
		offX = w > h ? x + w - 1 - r1 * 0.3 : x + r;
		offY = w > h ? y + r : y + h - 1 - r1 * 0.3;
		var rw:Number = r1 * (2 + (w > h ? 0 : 1));
		var rh:Number = r1 * (2 + (w > h ? 1 : 0));
		matrix = {a:rw, b:0, c:0, d:0, e:rh, f:0, g:offX, h:offY, i:1};
		movie.beginGradientFill("radial", colors, alphas, ratios, matrix);
		offX = w > h ? x + w - 1 - r1 * 2 : x + 1;
		offY = w > h ? y + 1 : y + h - 1 - r1 * 2;
		drawOvalRect(movie, offX, offY, r1 * 2, r1 * 2);
		movie.endFill();
		if(data.mode == "press") fillRoundRect(movie, x, y, w, h, r, 0, 20);*/


/*	private function drawRoundDrop(movie:MovieClip, x:Number, y:Number, w:Number, h:Number, col:Number, data:Object):Void
	{
		var r:Number = Math.min(w, h) / 2;
		var w1:Number = w - 2;
		var h1:Number = h - 2;
		var r1:Number = Math.min(w1, h1) / 2;
		movie.beginFill(col, 100);
		drawRoundRect(movie, x + 1, y + 1, w - 1, h - 1, r - 1);
		movie.endFill();
	
		if(w < h)
		{
			var hsb:Object = rgb2hsb(col);
			var colors:Array = new Array(
				hsb2rgb({h:hsb.h, s:hsb.s, b:Math.max(0, hsb.b - 30)}),
				col,
				col,
				hsb2rgb({h:hsb.h, s:hsb.s, b:Math.max(0, hsb.b - 30)}));
			var alphas:Array = new Array(100, 100, 100, 100);
			var ratios:Array = new Array(0, 90, 165, 255);
			var matrix:Object = {matrixType:"box", x:x + 1, y:y + 1, w:w1, h:h1, r:0};
			movie.beginGradientFill("linear", colors, alphas, ratios, matrix);
			drawRoundRect(movie, x + 1, y + 1, w - 1, h - 1, r);
			movie.endFill();
		}
		else
		{
			var colors:Array = new Array(0, 0);
			var alphas:Array = new Array(0, 50);
			var ratios:Array = new Array(160, 255);
			var matrix:Object = new Object({a:r1 * 3, b:0, c:0, d:0, e:r1 * 3, f:0, g:x + r * 1.4, h:y + r});
			movie.beginGradientFill("radial", colors, alphas, ratios, matrix);
			drawOvalRect(movie, x + 1, y + 1, r1 * 2, r1 * 2);
			movie.endFill();
			colors.splice(0);
			alphas.splice(0);
			ratios.splice(0);
			colors.push(0, 0);
			alphas.push(0, 50);
			ratios.push(160, 255);
			var matrix:Object = new Object({a:r1 * 3, b:0, c:0, d:0, e:r1 * 3, f:0, g:x + w - r * 1.4, h:y + r});
			movie.beginGradientFill("radial", colors, alphas, ratios, matrix);
			drawOvalRect(movie, x + w - r1 * 2 - 1, y + 1, r1 * 2, r1 * 2);
			movie.endFill();
		}
		colors.splice(0);
		alphas.splice(0);
		ratios.splice(0);
		colors.push(0xffffff, 0xffffff, 0xffffff);
		alphas.push(100, 40, 35);
		ratios.push(0, 30, 100);
		var offX:Number = 1;
		var offY:Number = 1;
		matrix = {matrixType:"box", x:offX, y:offY, w:w1, h:r1 * 2, r:Math.PI / 2};
		movie.beginGradientFill("linear", colors, alphas, ratios, matrix);
		drawRoundRect(movie, x + 1 + r1 / 4, y + 1, w - 1 - r1 / 4, r1 - 0.5, r);
		movie.endFill();
	
		colors.splice(0);
		alphas.splice(0);
		ratios.splice(0);
		var hsb:Object = rgb2hsb(col);
		colors.push(0xffffff,
			hsb2rgb({h:hsb.h, s:Math.max(0, hsb.s - 60), b:Math.min(100, hsb.b + 27)}),
			hsb2rgb({h:hsb.h, s:Math.max(0, hsb.s - 55), b:Math.min(100, hsb.b + 25)}));
		//colors.push(0xffffff, 0xffffff);
		alphas.push(0, 100, 100);
		ratios.push(90, 140, 235);
		var offX:Number = 1;
		var offY:Number = y + h - r1 * 2 - 1;
		matrix = {matrixType:"box", x:offX, y:offY, w:w1, h:r1 * 2, r:Math.PI / 2};
		movie.beginGradientFill("linear", colors, alphas, ratios, matrix);
		drawRoundRect(movie, x + 1, y + h - r1 * 2 - 1, w - 1, y + h - 1, r);
		movie.endFill();
	
		drawRoundRect(movie, x + 0.5, y + 0.5, w - 0.5, h - 0.5, r - 0.5, 0x444444, 100, 1);
		movie.lineStyle(undefined);
		if(data.mode == "press") fillRoundRect(movie, x, y, w, h, r, 0, 20);
	}
*/
	private function drawRoundDrop(movie:MovieClip, x:Number, y:Number, w:Number, h:Number, col:Number, data:Object):Void
	{
		var r:Number = Math.min(w, h) / 2;
		var w1:Number = w - 2;
		var h1:Number = h - 2;
		var r1:Number = Math.min(w1, h1) / 2;
		movie.beginFill(col, 100);
		drawRoundRect(movie, x + 1, y + 1, x + w - 1, y + h - 1, r - 1);
		movie.endFill();

		if(w < h)
		{
			var colors:Array = new Array(0, 0);
			var alphas:Array = new Array(0, 50);
			var ratios:Array = new Array(160, 255);
			var matrix:Object = new Object({a:r1 * 3, b:0, c:0, d:0, e:r1 * 3, f:0, g:x + r, h:y + r * 1.4});
			movie.beginGradientFill("radial", colors, alphas, ratios, matrix);
			drawOvalRect(movie, x + 1, y + 1, r1 * 2, r1 * 2);
			movie.endFill();
			colors.splice(0);
			alphas.splice(0);
			ratios.splice(0);
			colors.push(0, 0);
			alphas.push(0, 50);
			ratios.push(160, 255);
			matrix = new Object({a:r1 * 3, b:0, c:0, d:0, e:r1 * 3, f:0, g:x + r, h:y + h - r * 1.4});
			movie.beginGradientFill("radial", colors, alphas, ratios, matrix);
			drawOvalRect(movie, x + 1, y + h - r1 * 2 - 1, r1 * 2, r1 * 2);
			movie.endFill();
	
			colors.splice(0);
			alphas.splice(0);
			ratios.splice(0);
			colors.push(0xffffff, 0xffffff, 0xffffff);
			alphas.push(65, 40, 35);
			ratios.push(10, 50, 100);
			var offX:Number = 1;
			var offY:Number = 1;
			matrix = {matrixType:"box", x:offX, y:offY, w:r1 * 2, h:h1, r:0};
			movie.beginGradientFill("linear", colors, alphas, ratios, matrix);
			drawRoundRect(movie, x + 1, y + 1 + r1 / 4, r1 - 0.5, h - 1 - r1 / 4, r);
			movie.endFill();
		
			colors.splice(0);
			alphas.splice(0);
			ratios.splice(0);
			colors.push(0xffffff, 0xffffff);
			alphas.push(0, 85);
			ratios.push(90, 235);
			offX = x + w - r1 * 2 - 1;
			offY = 1;
			matrix = {matrixType:"box", x:offX, y:offY, w:r1 * 2, h:h1, r:0};
			movie.beginGradientFill("linear", colors, alphas

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -