Skip to content

Instantly share code, notes, and snippets.

@mash
Created December 18, 2008 06:36
Show Gist options
  • Save mash/37416 to your computer and use it in GitHub Desktop.
Save mash/37416 to your computer and use it in GitHub Desktop.
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
xmlns:dcterms="http://purl.org/rss/1.0/modules/dcterms/"
xmlns:blogChannel="http://backend.userland.com/blogChannelModule"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
>
<channel>
<title>mash recent codes</title>
<link>http://wonderfl.o/user/mash</link>
<description>mash recent codes @ http://wonderfl.kayac.com</description>
<item>
<title>code on 2008-12-18</title>
<link>http://wonderfl.o/code/6f7f71f481b4903b87532ccf93184361e770eec4</link>
<author>mash, rss generated by wonderfl</author>
<guid isPermaLink="true">http://wonderfl.o/code/6f7f71f481b4903b87532ccf93184361e770eec4</guid>
<dcterms:modified>2008-12-18T14:48:59+09:00</dcterms:modified>
<content:encoded>package {
import flash.display.*;
import net.hires.debug.Stats;
public class TestStats extends Sprite {
public function TestStats() {
addChild( new Stats() );
}
}
}
</content:encoded>
</item>
<item>
<title>code on 2008-12-18</title>
<link>http://wonderfl.o/code/d9569cc87dfee7d1a4b65b5b4da70ca32a10c071</link>
<author>mash, rss generated by wonderfl</author>
<guid isPermaLink="true">http://wonderfl.o/code/d9569cc87dfee7d1a4b65b5b4da70ca32a10c071</guid>
<dcterms:modified>2008-12-18T14:29:52+09:00</dcterms:modified>
<content:encoded>// write as3 code here..
</content:encoded>
</item>
<item>
<title>it&#x27;s wonderFL world.</title>
<link>http://wonderfl.o/code/356553f7049de0565252614ca301e6cf4e0d1aa8</link>
<author>mash, rss generated by wonderfl</author>
<guid isPermaLink="true">http://wonderfl.o/code/356553f7049de0565252614ca301e6cf4e0d1aa8</guid>
<dcterms:modified>2008-12-15T15:36:42+09:00</dcterms:modified>
<content:encoded>// forked from Murai&#x27;s wonderFl_KeyVisual_v2
// write as3 code here..
package
{
/**
*
* @author Takashi Murai(KAYAC)
*/
import flash.display.*
import flash.events.*
import flash.text.*
import flash.filters.*;
import flash.geom.*;
import flash.utils.*
[SWF(width=&#x22;465&#x22;, height=&#x22;465&#x22;, backgroundColor=&#x22;0x000000&#x22;, frameRate=&#x22;15&#x22;)]
public class WonderFL extends MovieClip
{
//
var txtLayer:Sprite=new Sprite()
var drawPos:Sprite=new Sprite()
var textPos:Sprite=new Sprite()
var txtFmt:TextFormat = new TextFormat();
var textFields:TextField=new TextField()
//message
var messages=[
&#x22;&#x3C;_&#x3C;_&#x3C;_&#x3C;__write code__________&#x22;,
&#x22;_&#x3C;_&#x3C;_&#x3C;_&#x3C;_write code__________&#x22;,
&#x22;&#x3C;_&#x3C;_&#x3C;_&#x3C;__write code__________&#x22;,
&#x22;_&#x3C;_&#x3C;_&#x3C;_&#x3C;_write code__________&#x22;,
&#x22;&#x3C;_&#x3C;_&#x3C;_&#x3C;__write code__________&#x22;,
&#x22;_&#x3C;_&#x3C;_&#x3C;_&#x3C;_write code__________&#x22;,
&#x22;&#x3C;_&#x3C;_&#x3C;_&#x3C;__write code__________&#x22;,
&#x22;_&#x3C;_&#x3C;_&#x3C;_&#x3C;_write code__________&#x22;,
&#x22;&#x3C;_&#x3C;_&#x3C;_&#x3C;__write code__________&#x22;,
&#x22;_&#x3C;_&#x3C;_&#x3C;_&#x3C;_write code__________&#x22;,
&#x22;&#x3C;_&#x3C;_&#x3C;_&#x3C;__write code__________&#x22;,
&#x22;_&#x3C;_&#x3C;_&#x3C;_&#x3C;_write code__________&#x22;,
&#x22;&#x3C;_&#x3C;_&#x3C;_&#x3C;__write code__________&#x22;,
&#x22;_&#x3C;_&#x3C;_&#x3C;_&#x3C;_write code__________&#x22;,
&#x22;&#x3C;_&#x3C;_&#x3C;_&#x3C;__write code__________&#x22;,
&#x22;_&#x3C;_&#x3C;_&#x3C;_&#x3C;_write code__________&#x22;,
&#x22;&#x3C;_&#x3C;_&#x3C;_&#x3C;__write code__________&#x22;,
&#x22;_&#x3C;_&#x3C;_&#x3C;_&#x3C;_write code__________&#x22;,
&#x22;&#x3C;_&#x3C;_&#x3C;_&#x3C;__write code__________&#x22;,
&#x22;_&#x3C;_&#x3C;_&#x3C;_&#x3C;_write code__________&#x22;,
&#x22;&#x3C;_&#x3C;_&#x3C;_&#x3C;__write code__________&#x22;,
&#x22;_&#x3C;_&#x3C;_&#x3C;_&#x3C;_write code__________&#x22;,
&#x22;&#x3C;_&#x3C;_&#x3C;_&#x3C;__write code__________&#x22;,
&#x22;_&#x3C;_&#x3C;_&#x3C;_&#x3C;_write code__________&#x22;,
&#x22;and watch it move here.&#x22;,
&#x22;and watch it move here!&#x22;,
&#x22;and watch it move here.&#x22;,
&#x22;and watch it move here!&#x22;,
&#x22;and watch it move here.&#x22;,
&#x22;and watch it move here!&#x22;,
&#x22;and watch it move here.&#x22;,
&#x22;and watch it move here!&#x22;,
&#x22;it&#x27;s a wonderfl world&#x22;
]
//lleasures
var posX:Number = 30
var posY:Number = stage.stageHeight/2
var disX:Number = 40
var disY:Number = 5
var deg:Number = 0
var count:Number = 0;
var step:Number =2
var cx:Number = stage.stageWidth /2
var cy:Number = stage.stageHeight /2
var xPos:Number = 0
var yPos:Number = 0
//gladationLine
var mtx:Matrix = new Matrix();
var gradCount=1
var gradDir=1
var life=0
var lifeLmt=100
//fader
var blurVall=4
var faderAlpha=0.8
var interval=100
var _bdTxt:BitmapData
var _bmpTxt:Bitmap
var _bdLine:BitmapData
var _bmpLine:Bitmap
var _blurF:BlurFilter
public function WonderFL() {
init()
initFader()
this.addChild(_bmpLine)
this.addChild(_bmpTxt)
txtLayer.addChild(textPos)
textPos.addChild(textFields)
}
function init(){
initLissajous()
setMessage(&#x22;&#x22;,&#x22;normal&#x22;,0xFFFFFF)
faderAlpha=0.9
var timerLmt=(messages.length-1)
var phaseCnt=0
var phase1:Timer = new Timer(interval, timerLmt);
phase1.addEventListener(TimerEvent.TIMER, function(e:Event){
setMessage(messages[phaseCnt++],&#x22;normal&#x22;,0xFF0000)
});
phase1.start();
var phase2:Timer = new Timer((timerLmt)*interval+1500, 1);
phase2.addEventListener(TimerEvent.TIMER_COMPLETE, function(e:Event){
setMessage(messages[messages.length-1],&#x22;normal&#x22;,0xFFFFFF)
startLissajous()
faderAlpha=0.999
});
phase2.start();
var phase3:Timer = new Timer((timerLmt)*interval+1500+10000, 1);
phase3.addEventListener(TimerEvent.TIMER_COMPLETE, function(e:Event){
reset()
});
phase3.start();
}
function reset(){
stage.removeEventListener(Event.ENTER_FRAME, drawLissajous);
init()
}
function setMessage(mes:String,blend:String,hex:Number){
txtFmt.font=&#x22;Arial&#x22;
txtFmt.align = TextFormatAlign.CENTER;
txtFmt.color=hex
txtFmt.size=30
textFields.defaultTextFormat = txtFmt;
textFields.multiline=true
textFields.autoSize=TextFieldAutoSize.LEFT
textFields.x =0
textFields.y = 0
textFields.text=mes
textPos.alpha=0.5
textPos.blendMode=blend
textPos.x=stage.stageWidth/2-textFields.width/2
textPos.y=stage.stageHeight/2-textFields.height/2
}
function initFader(){
_bdTxt=new BitmapData(stage.stageWidth,stage.stageHeight,true,0x000000);
_bmpTxt=new Bitmap(_bdTxt);
_blurF=new BlurFilter(blurVall,blurVall,3);
_bdLine=new BitmapData(stage.stageWidth,stage.stageHeight,true,0x000000);
_bmpLine=new Bitmap(_bdLine);
_blurF=new BlurFilter(blurVall,blurVall,3);
stage.addEventListener(Event.ENTER_FRAME, render);
}
function render(e:Event):void {
_bdLine.colorTransform(_bdLine.rect, new ColorTransform(1, 1, 1,faderAlpha, 0, 0, 0, 0));
_bdLine.applyFilter(_bdLine,_bdLine.rect,new Point(0,0),_blurF);
_bdTxt.colorTransform(_bdTxt.rect, new ColorTransform(1, 1, 1,0.9, 0, 0, 0, 0));
_bdTxt.applyFilter(_bdTxt,_bdTxt.rect,new Point(0,0),_blurF);
_bdLine.scroll(8,0)
_bdLine.draw(drawPos);
_bdTxt.draw(txtLayer);
}
function initLissajous(){
mtx.createGradientBox(400, 400, 0, 0, 0);
drawPos.graphics.clear()
drawPos.graphics.lineStyle(4);
drawPos.graphics.lineGradientStyle(GradientType.LINEAR, [0xFF0000, 0x0000FF], [1,0.2],[gradCount,255-gradCount], mtx, SpreadMethod.REFLECT);
drawPos.graphics.moveTo(xPos,yPos);
}
function startLissajous(){
stage.addEventListener(Event.ENTER_FRAME, drawLissajous);
}
function drawLissajous(e:Event):void {
count+= step;
xPos = posX * Math.sin(disX * count + deg)
yPos = (posY) * Math.sin(disY * count) + cy
if(gradCount&#x3E;=255 || 0&#x3E;=gradCount){
gradDir*=-1
}
gradCount+=gradDir
life=life&#x3E;lifeLmt?0:life+1
if (life&#x3E;lifeLmt) {
drawPos.graphics.clear()
drawPos.graphics.lineStyle(1);
drawPos.graphics.moveTo(xPos,yPos)
}
drawPos.graphics.lineGradientStyle(GradientType.LINEAR, [0xFF0000, 0x0000FF], [(gradCount/255),((255-gradCount)/255)],[1,255], mtx, SpreadMethod.REFLECT);
drawPos.graphics.lineTo(xPos,yPos);
}
}
}
</content:encoded>
</item>
<item>
<title>code on 2008-12-14</title>
<link>http://wonderfl.o/code/2c13c4de32d392814f9098bcc9bb3af5ae3c127f</link>
<author>mash, rss generated by wonderfl</author>
<guid isPermaLink="true">http://wonderfl.o/code/2c13c4de32d392814f9098bcc9bb3af5ae3c127f</guid>
<dcterms:modified>2008-12-15T10:16:41+09:00</dcterms:modified>
<content:encoded>// write as3 code here..
package {
import flash.display.*;
import flash.text.*;
import flash.events.*;
import flash.net.*;
public class stratus_client_test extends Sprite {
private const StratusAddress:String = &#x22;rtmfp://stratus.adobe.com&#x22;;
private const DeveloperKey:String = &#x22;8a14abc90aa5f71df2078d32-85d31918b8cd&#x22;;
private var nc :NetConnection;
private var cht_tf :TextField;
private var log_tf :TextField;
private var btn :Sprite;
private var listener_ns :NetStream;
private var control_ns :NetStream;
private var outgoing_ns :NetStream;
private var incoming_ns :NetStream;
public function stratus_client_test() {
nc = new NetConnection();
nc.addEventListener(NetStatusEvent.NET_STATUS,function(e :NetStatusEvent) :void {
log( e.info.code+&#x22; nearId: &#x22;+nc.nearID );
listener_ns = create_listener_ns();
control_ns = create_control_ns();
outgoing_ns = create_outgoing_ns();
incoming_ns = create_incoming_ns();
});
nc.connect(StratusAddress + &#x22;/&#x22; + DeveloperKey);
init_view();
}
private function net_status_logger( e :NetStatusEvent ) :void {
log(&#x22;[ns]&#x22;+e.info.code );
}
private function create_listener_ns() :NetStream {
var ns :NetStream = new NetStream(nc, NetStream.DIRECT_CONNECTIONS);
ns.addEventListener(NetStatusEvent.NET_STATUS, function(e:NetStatusEvent) :void {
log(&#x22;[li]&#x22;+e.info.code);
} );
ns.publish(&#x22;control_mash_ff&#x22;);
var c :Object = new Object;
c.onPeerConnect = function(caller :NetStream) :Boolean {
log(&#x22;[onPeerConnect]caller: &#x22;+caller.farID);
return true;
}
ns.client = c;
return ns;
}
private function create_control_ns() :NetStream {
var ns :NetStream = new NetStream(nc, &#x22;5148a9098df8a523a2393fd570e5841bd482b3ea53be3168421197274190792f&#x22;);
ns.addEventListener(NetStatusEvent.NET_STATUS, function(e:NetStatusEvent) :void {
log(&#x22;[co]&#x22;+e.info.code);
} );
ns.play(&#x22;control_mash_ie&#x22;);
return ns;
}
private function create_outgoing_ns() :NetStream {
var ns :NetStream = new NetStream(nc, NetStream.DIRECT_CONNECTIONS);;
ns.addEventListener(NetStatusEvent.NET_STATUS, function(e:NetStatusEvent) :void {
log(&#x22;[ou]&#x22;+e.info.code);
} );
ns.publish(&#x22;media-caller&#x22;);
return ns;
}
private function create_incoming_ns() :NetStream {
var ns :NetStream = new NetStream(nc, &#x22;mash1&#x22;);
ns.addEventListener(NetStatusEvent.NET_STATUS, function(e:NetStatusEvent) :void {
log(&#x22;[in]&#x22;+e.info.code);
} );
ns.play(&#x22;media-callee&#x22;);
var c :Object = new Object;
c.onCallAccepted = function(callee:String) :void {
log(&#x22;[onCallAccepted]\n&#x22;);
}
c.onIm = function(name :String, text :String ) :void {
log(&#x22;[onIm]name: &#x22;+name+&#x22; text: &#x22;+text);
}
ns.client = c;
return ns;
}
private function init_view() :void {
cht_tf = new TextField;
cht_tf.type = TextFieldType.DYNAMIC;
cht_tf.width = 1000;
cht_tf.background = true;
cht_tf.backgroundColor = 0xEEEEEE;
addChild( cht_tf );
btn = new Sprite;
var g :Graphics = btn.graphics;
g.beginFill(0x333333);
g.drawRect(0,0,40,20);
addChild(btn);
btn.x = (465-40);
log_tf = new TextField;
log_tf.type = TextFieldType.INPUT;
log_tf.width = 1000;
log_tf.y = 100;
addChild( log_tf );
}
private function log(str :String ) :void {
log_tf.appendText(str+&#x22;\n&#x22;);
}
}
}</content:encoded>
</item>
<item>
<title>red rectangle</title>
<link>http://wonderfl.o/code/fe06920acea3d95b8cca3ba8985c9a53adb572d8</link>
<author>mash, rss generated by wonderfl</author>
<guid isPermaLink="true">http://wonderfl.o/code/fe06920acea3d95b8cca3ba8985c9a53adb572d8</guid>
<dcterms:modified>2008-12-13T21:50:20+09:00</dcterms:modified>
<content:encoded>package {
import flash.display.*;
import flash.text.*;
public class test extends Sprite {
public function test() {
var g :Graphics = graphics;
g.beginFill(0xFF0000);
g.drawRect(0,0,100,100);
}
}
}
</content:encoded>
</item>
<item>
<title>red rectangle</title>
<link>http://wonderfl.o/code/ba067041a398d1e5005f6f382788f42a82fc7441</link>
<author>mash, rss generated by wonderfl</author>
<guid isPermaLink="true">http://wonderfl.o/code/ba067041a398d1e5005f6f382788f42a82fc7441</guid>
<dcterms:modified>2008-12-13T19:19:06+09:00</dcterms:modified>
<content:encoded>// write as3 code here..
package {
import flash.display.*;
import flash.text.*;
public class test extends Sprite {
public function test() {
var g :Graphics = graphics;
g.beginFill(0xFF0000);
g.drawRect(0,0,100,100);
}
}
}
</content:encoded>
</item>
<item>
<title>code on 2008-12-13</title>
<link>http://wonderfl.o/code/d39bb856e300144068b82f675bcdedcde67b14ba</link>
<author>mash, rss generated by wonderfl</author>
<guid isPermaLink="true">http://wonderfl.o/code/d39bb856e300144068b82f675bcdedcde67b14ba</guid>
<dcterms:modified>2008-12-13T19:04:01+09:00</dcterms:modified>
<content:encoded>// write as3 code here..
</content:encoded>
</item>
<item>
<title>code on 2008-12-12</title>
<link>http://wonderfl.o/code/edfaba3ac647de4fb3a193197882b49de19ac943</link>
<author>mash, rss generated by wonderfl</author>
<guid isPermaLink="true">http://wonderfl.o/code/edfaba3ac647de4fb3a193197882b49de19ac943</guid>
<dcterms:modified>2008-12-12T18:38:33+09:00</dcterms:modified>
<content:encoded>// write as3 code here..
</content:encoded>
</item>
<item>
<title>forked from: it&#x27;s wonderFL world.</title>
<link>http://wonderfl.o/code/8c86818f169d9a6c9bd9b94a0baac9ec05b50d05</link>
<author>mash, rss generated by wonderfl</author>
<guid isPermaLink="true">http://wonderfl.o/code/8c86818f169d9a6c9bd9b94a0baac9ec05b50d05</guid>
<dcterms:modified>2008-12-11T17:12:11+09:00</dcterms:modified>
<content:encoded>// forked from mash&#x27;s it&#x27;s wonderFL world.
package
{
/**
*
* @author Takashi Murai(KAYAC)
*/
import flash.display.*
import flash.events.*
import flash.text.*
import flash.filters.*;
import flash.geom.*;
import flash.utils.*
public class WonderFL extends MovieClip
{
//
var Layer:Sprite=new Sprite()
var drawPos:Sprite=new Sprite()
var textPos:Sprite=new Sprite()
var txtFmt:TextFormat = new TextFormat();
var textFields:TextField=new TextField()
//message
var mes1=&#x22;hello world&#x22;
var mes2=&#x22;it&#x27;s wonderFL world.&#x22;
//lleasures
var posX:Number = stage.stageWidth / 2;
var posY:Number = stage.stageHeight /2;
var disX:Number = Math.random()*30
var disY:Number = Math.random()*20
var deg:Number = Math.random()*360
var count:Number = 0;
var step:Number =64
var cx:Number = stage.stageWidth /2;
var cy:Number = stage.stageHeight /2;
var xPos:Number = posX * Math.sin(disX * count + deg) + cx;
var yPos:Number = posY * Math.sin(disY * count) + cy;
//gladationLine
var mtx:Matrix = new Matrix();
var gradCount=1
var gradDir=1
var life=0
var lifeLmt=200
//fader
var blurVall=4
var _bd:BitmapData
var _bmp:Bitmap
var _blurF:BlurFilter
public function WonderFL() {
initFader()
setMessage(mes1,&#x22;normal&#x22;,0xFF0000)
var phase1:Timer = new Timer(3000, 1);
phase1.addEventListener(TimerEvent.TIMER_COMPLETE, function(e:Event){
setMessage(&#x22;&#x22;,&#x22;normal&#x22;,0xFFFFFF)
});
phase1.start();
var phase2:Timer = new Timer(6000, 1);
phase2.addEventListener(TimerEvent.TIMER_COMPLETE, function(e:Event){
setMessage(mes2,&#x22;screen&#x22;,0xFFFFFF)
initLissajous()
});
phase2.start();
this.addChild(_bmp)
Layer.addChild(drawPos)
Layer.addChild(textPos)
textPos.addChild(textFields)
}
function setMessage(mes:String,blend:String,hex:Number){
txtFmt.size = 40
txtFmt.font=&#x22;Arial&#x22;
txtFmt.align = TextFormatAlign.CENTER;
txtFmt.color=hex
textFields.defaultTextFormat = txtFmt;
textFields.autoSize=TextFieldAutoSize.LEFT
textFields.x =0
textFields.y = 0
textFields.text=mes
textPos.alpha=0.5
textPos.blendMode=blend
textPos.x=stage.stageWidth/2-textFields.width/2
textPos.y=stage.stageHeight/2-textFields.height/2
}
function initFader(){
_bd=new BitmapData(stage.stageWidth,stage.stageHeight,true,0x000000);
_bmp=new Bitmap(_bd);
_blurF=new BlurFilter(blurVall,blurVall,3);
stage.addEventListener(Event.ENTER_FRAME, function(e:Event){
render()
});
}
function render():void {
_bd.colorTransform(_bd.rect, new ColorTransform(1, 1, 1,0.999, 0, 0, 0, 0));
_bd.applyFilter(_bd,_bd.rect,new Point(0,0),_blurF);
_bd.draw(Layer);
}
function initLissajous(){
mtx.createGradientBox(400, 400, 0, 0, 0);
drawPos.graphics.lineStyle(1);
drawPos.graphics.lineGradientStyle(GradientType.LINEAR, [0xFF0000, 0x0000FF], [0.5,0.5],[gradCount,255-gradCount], mtx, SpreadMethod.REFLECT);
drawPos.graphics.moveTo(xPos,yPos);
stage.addEventListener(Event.ENTER_FRAME, function(e:Event){
drawLissajous()
});
}
function drawLissajous():void {
count+= step;
xPos = posX * Math.sin(disX * count + deg) + cx;
yPos = posY * Math.sin(disY * count) + cy;
if(gradCount&#x3E;=255 || 0&#x3E;=gradCount){
gradDir*=-1
}
gradCount+=gradDir
life=life&#x3E;lifeLmt?0:life+1
if (life&#x3E;lifeLmt) {
drawPos.graphics.clear()
drawPos.graphics.lineStyle(0.5);
drawPos.graphics.moveTo(xPos,yPos)
}
drawPos.graphics.lineGradientStyle(GradientType.LINEAR, [0xFF0000, 0xFF0000], [(gradCount/255),((255-gradCount)/255)],[0,255], mtx, SpreadMethod.REFLECT);
drawPos.graphics.lineTo(xPos,yPos);
}
}
}
</content:encoded>
</item>
<item>
<title>Splouch by Gr&#xC3;&#xA9;goire Divaret</title>
<link>http://wonderfl.o/code/8c4e2e6e57f5ee69da143bf792e115326e05eed6</link>
<author>mash, rss generated by wonderfl</author>
<guid isPermaLink="true">http://wonderfl.o/code/8c4e2e6e57f5ee69da143bf792e115326e05eed6</guid>
<dcterms:modified>2008-12-10T13:30:26+09:00</dcterms:modified>
<content:encoded>// forked from mash&#x27;s Bottle Glass Mountains
// package, import, class definition added by mash
// others are from
// http://www.25lines.com/finalists/0812/073.txt
package {
import flash.display.*;
import flash.events.*;
import flash.text.*;
import flash.utils.*;
import flash.filters.*;
import flash.geom.*;
public class project73 extends Sprite {
public function project73() {
/**
* 25-Line ActionScript Contest Entry
*
* Project: Splouch
* Author: Gr&#xC3;&#xA9;goire Divaret // grgrdvrt.com/blog // gdivaret@gmail.com
* Date: Thursday, November 27
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the &#x22;Software&#x22;), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED &#x22;AS IS&#x22;, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
// 3 free lines! Alter the parameters of the following lines or remove them.
// Do not substitute other code for the three lines in this section
[SWF(width=1000, height=500, backgroundColor=0xCCCCCC, frameRate=24)]
//stage.align = StageAlign.TOP_LEFT;
stage.scaleMode = StageScaleMode.NO_SCALE;
// 25 lines begins here!
//use your mouse, click!
var tentacles:Array = [], ran:Function = Math.random, stw:int = stage.stageWidth, r:Number, sth:int = stage.stageHeight, sh:Shape = new Shape(), bd:BitmapData = (addChild(new Bitmap(new BitmapData(stw, sth, false, 0xFFDEDEDE))) as Bitmap).bitmapData, gr:int = 25 + Math.random() * 180, gv:int = 25 + Math.random() * 180, gb:int = 25 + Math.random() * 180, hop:Boolean = true;
for(var i:int = 0; i &#x3C; 15; i++) tentacles.push({x:stw/2, y:sth/2, vx:(mouseX - stw/2) / 100, vy:(mouseY - sth/2) / 100, pts:[], life:35 + ran() * 15, dir:true, r:gr + ran() * 50, v: gv + ran() * 50, b:gb + ran() * 50});
stage.addEventListener(MouseEvent.CLICK, function(e:Event){hop = !hop});
addEventListener(Event.ENTER_FRAME, animate);
function animate(e:Event):void
{
bd.lock();
bd.fillRect(bd.rect, 0xFFDEDEDE);
for each (var t:Object in tentacles)
{
if(t.dir)t.pts.push({vx:0, vy:0, x:t.x += (t.vx = (t.vx += ran() * 4 - 2 + (mouseX - stw/2) / 2000) * 0.95), y:t.y += (t.vy = (t.vy += ran() * 4 - 2 + (mouseY - sth/2) / 2000)* 0.95)});
else t.pts.splice(t.pts.length-1, 1);
sh.graphics.moveTo(t.pts[t.pts.length-1].x, t.pts[t.pts.length-1].y);
for(var i:int = t.pts.length-1; i &#x3E;= 0 ; i--)
{
sh.graphics.lineStyle(Math.pow((1 - (r = i / t.pts.length)) * 10, 2) * (100 - Math.abs(t.life)) / 100, (r*r * t.r) &#x3C;&#x3C; 16 | (r * r * t.v) &#x3C;&#x3C; 8 | (r*r * t.b) );
sh.graphics.lineTo(t.pts[i].x+= (t.pts[i].vx = (t.pts[i].vx += (hop ? r : 1-r) * (mouseX - t.pts[i].x) / 1500) * 0.95), t.pts[i].y+= (t.pts[i].vy = (t.pts[i].vy +=(hop ? r : 1-r) * (mouseY - t.pts[i].y) / 1500) * 0.95));
}
bd.draw(sh);
sh.graphics.clear();
if((t.life-=0.5) &#x3C;= 0 &#x26;&#x26; t.dir) t.dir = false;
else if(!t.dir &#x26;&#x26; t.pts.length &#x3C;= 1) tentacles[tentacles.indexOf(t)] = {x:t.pts[0].x, y:t.pts[0].y, vx:t.pts[0].vx, vy:t.pts[0].vy, pts:[], life:35 + ran() * 15, dir:true, r:gr + ran() * 50, v: gv + ran() * 50, b:gb + ran() * 50}
}
bd.unlock();
}
// 25 lines ends here!
}
}
}
</content:encoded>
</item>
</channel>
</rss>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment