-
Senior Member
Pointless flash, anyone?
I mean, let's get like 400x400 bitmapdata-or-whatever based flash movie doing something not fancy at all, like drawing random rectangle, and then someone will add something to it, and then another one, etc..........
-
Developing For Dunkets
Get it started, I'm sure more will contribute as time goes by. I'll do something after you. All AS driven? And, AS2 or 3?
-
Senior Member
well, what would it take to start? something like this:
Code:
import flash.display.BitmapData;
var b:BitmapData = new BitmapData (Stage.width, Stage.height, true, 0);
_root.attachBitmap (b, 1);
function onEnterFrame () {
b.setPixel32 (b.width * Math.random (), b.height * Math.random (),
0xFF000000 + Math.floor (256 * 256 * 256 * Math.random ()) );
}
more people know as2 so let's stick with it.
-
Developing For Dunkets
A little more lengthy, but definitely pointless:
PHP Code:
import flash.display.BitmapData;
var i:Number = 0;
var b:BitmapData = new BitmapData (Stage.width, Stage.height, true, 0);
this.attachBitmap (b, 1);
this.onEnterFrame = function(){
b.setPixel32 (b.width * Math.random (), b.height * Math.random (),
0xFF000000 + Math.floor (256 * 256 * 256 * Math.random ()) );
}
var mList:Object = new Object()
mList.onMouseMove = function(){
i++
var rect:MovieClip = createRectangle(50, 40, 0xFF0000 + Math.floor (256 * 256 * 256 * Math.random ()));
rect._y = _ymouse -20;
rect._x = _xmouse -25;
rect._alpha=50
removeMovieClip('mc_'+(i-10))
}
Mouse.addListener(mList);
function createRectangle(width:Number, height:Number, color:Number):MovieClip {
var depth:Number = this.getNextHighestDepth();
var mc:MovieClip = this.createEmptyMovieClip("mc_" + depth, depth);
mc.beginFill(color);
mc.lineTo(0, height);
mc.lineTo(width, height);
mc.lineTo(width, 0);
mc.lineTo(0, 0);
return mc;
}
-
Senior Member
ok, here goes quick mod of above:
Code:
import flash.display.BitmapData;
var i:Number = 0;
var b:BitmapData = new BitmapData (Stage.width, Stage.height, true, 0);
this.attachBitmap (b, 1);
this.onEnterFrame = function(){
b.setPixel32 (b.width * Math.random (), b.height * Math.random (),
0xFF000000 + Math.floor (256 * 256 * 256 * Math.random ()) );
}
var mList:Object = new Object()
mList.onMouseMove = function(){
i++
var poly:MovieClip = createPolygon(50, 40, 0xFF0000 + Math.floor (256 * 256 * 256 * Math.random ()));
poly._y = _ymouse -20;
poly._x = _xmouse -25;
poly._alpha=50
removeMovieClip('mc_'+(i-10))
}
Mouse.addListener(mList);
var polyParameter:Number = 0;
function createPolygon(width:Number, height:Number, color:Number):MovieClip {
polyParameter += 1e-2; if (polyParameter > 2 * Math.PI) polyParameter -= 2 * Math.PI;
var depth:Number = this.getNextHighestDepth();
var mc:MovieClip = this.createEmptyMovieClip("mc_" + depth, depth);
mc.beginFill(color);
var n = 3 + 6 * (1 + Math.sin (polyParameter));
for (var i = 0; i < n; i++)
{
var xx = Math.sin (i * 2 * Math.PI / n) * width;
var yy = Math.cos (i * 2 * Math.PI / n) * height;
if (i < 1) mc.moveTo (xx, yy); else mc.lineTo (xx, yy);
}
return mc;
}
p.s.: never knew pv3d needed any support...
-
Developing For Dunkets
I centered the objects. Not really a change, but it bugged me. I'll hopefully let someone else go:
PHP Code:
import flash.display.BitmapData;
var i:Number = 0;
var b:BitmapData = new BitmapData (Stage.width, Stage.height, true, 0);
this.attachBitmap (b, 1);
this.onEnterFrame = function(){
b.setPixel32 (b.width * Math.random (), b.height * Math.random (),
0xFF000000 + Math.floor (256 * 256 * 256 * Math.random ()) );
}
var mList:Object = new Object()
mList.onMouseMove = function(){
i++
var poly:MovieClip = createPolygon(50, 40, 0xFF0000 + Math.floor (256 * 256 * 256 * Math.random ()));
poly._y = _ymouse;
poly._x = _xmouse;
poly._alpha=50
removeMovieClip('mc_'+(i-10))
}
Mouse.addListener(mList);
var polyParameter:Number = 0;
function createPolygon(width:Number, height:Number, color:Number):MovieClip {
polyParameter += 1e-2; if (polyParameter > 2 * Math.PI) polyParameter -= 2 * Math.PI;
var depth:Number = this.getNextHighestDepth();
var mc:MovieClip = this.createEmptyMovieClip("mc_" + depth, depth);
mc.beginFill(color);
var n = 3 + 6 * (1 + Math.sin (polyParameter));
for (var i = 0; i < n; i++)
{
var xx = Math.sin (i * 2 * Math.PI / n) * width;
var yy = Math.cos (i * 2 * Math.PI / n) * height;
if (i < 1) mc.moveTo (xx, yy); else mc.lineTo (xx, yy);
}
return mc;
}
Of course papervision needs support. It has plenty now, but it could always use more. And, the as2 user group definitely needs help. There is 12 of us on a google group, and little support from the pv3d team- as far as mods and updates go. We're trying to get access so we can maintain it. Not so much me personally, but I'm trying to contribute.
-
Senior Member
I havent played around with AS in a while. Ill contribute my little tweak with fading shapes
PHP Code:
import flash.display.BitmapData;
var i:Number = 0;
var b:BitmapData = new BitmapData(Stage.width, Stage.height, true, 0);
this.attachBitmap(b, 1);
this.onEnterFrame = function() {
b.setPixel32(b.width*Math.random(), b.height*Math.random(), 0xFF000000+Math.floor(256*256*256*Math.random()));
};
var mList:Object = new Object();
mList.onMouseMove = function() {
i++;
var poly:MovieClip = createPolygon(50, 40, 0xFF0000+Math.floor(256*256*256*Math.random()));
poly._y = _ymouse;
poly._x = _xmouse;
poly._alpha = 50;
_root['mc_'+i].onEnterFrame = fadeOut
};
function fadeOut() {
this._alpha -= 3;
if (this._alpha<0) {
this.removeMovieClip();
}
}
Mouse.addListener(mList);
var polyParameter:Number = 0;
function createPolygon(width:Number, height:Number, color:Number):MovieClip {
polyParameter += 1e-2;
if (polyParameter>2*Math.PI) {
polyParameter -= 2*Math.PI;
}
var depth:Number = this.getNextHighestDepth();
var mc:MovieClip = this.createEmptyMovieClip("mc_"+depth, depth);
mc.beginFill(color);
var n = 3+6*(1+Math.sin(polyParameter));
for (var i = 0; i<n; i++) {
var xx = Math.sin(i*2*Math.PI/n)*width;
var yy = Math.cos(i*2*Math.PI/n)*height;
if (i<1) {
mc.moveTo(xx, yy);
} else {
mc.lineTo(xx, yy);
}
}
return mc;
}
-
Senior Member
made it grayscaled:
PHP Code:
import flash.display.BitmapData;
var i:Number = 0;
var b:BitmapData = new BitmapData(Stage.width, Stage.height, true, 0);
this.attachBitmap(b, 1);
this.onEnterFrame = function() {
b.setPixel32(b.width*Math.random(), b.height*Math.random(), 0xFF000000+Math.floor(256*256*256*Math.random()));
};
var mList:Object = new Object();
mList.onMouseMove = function() {
i++;
var t = 0.1 * i; while (t > 2*Math.PI) t -= 2*Math.PI;
var s = Math.floor(128 * (1 + Math.sin (t)));
var poly:MovieClip = createPolygon(50, 40, 0xFF000000 + s + 256 * s + 65536 * s);
poly._y = _ymouse;
poly._x = _xmouse;
poly._alpha = 50;
_root['mc_'+i].onEnterFrame = fadeOut
};
function fadeOut() {
this._alpha -= 3;
if (this._alpha<0) {
this.removeMovieClip();
}
}
Mouse.addListener(mList);
var polyParameter:Number = 0;
function createPolygon(width:Number, height:Number, color:Number):MovieClip {
polyParameter += 5e-2;
if (polyParameter>2*Math.PI) {
polyParameter -= 2*Math.PI;
}
var depth:Number = this.getNextHighestDepth();
var mc:MovieClip = this.createEmptyMovieClip("mc_"+depth, depth);
mc.beginFill(color);
var n = 3+2*(1+Math.sin(polyParameter));
for (var i = 0; i<n; i++) {
var xx = Math.sin(i*2*Math.PI/n)*width;
var yy = Math.cos(i*2*Math.PI/n)*height;
if (i<1) {
mc.moveTo(xx, yy);
} else {
mc.lineTo(xx, yy);
}
}
return mc;
}
-
Senior Member
red menace.
PHP Code:
import flash.display.BitmapData;
var i:Number = 0;
var b:BitmapData = new BitmapData(Stage.width, Stage.height, true, 0);
this.attachBitmap(b, 1);
this.onEnterFrame = function() {
b.setPixel32(b.width*Math.random(), b.height*Math.random(), 0xFF000000+Math.floor(256*256*256*Math.random()));
};
var mList:Object = new Object();
mList.onMouseMove = function() {
i++;
var t = 0.1 * i; while (t > 2*Math.PI) t -= 2*Math.PI;
var s = Math.floor(128 * (1 + Math.sin (t)));
var poly:MovieClip = createPolygon(30, 20, 0xFF000000 /*+ s + 256 * s*/ + 65536 * s);
poly._y = _ymouse;
poly._x = _xmouse;
poly._alpha = 50;
_root['mc_'+i].onEnterFrame = fadeOut
};
function fadeOut() {
this._alpha -= 3;
if (this._alpha<0) {
this.removeMovieClip();
}
}
Mouse.addListener(mList);
var polyParameter:Number = 0;
function createPolygon(width:Number, height:Number, color:Number):MovieClip {
polyParameter += 5e-2;
if (polyParameter>2*Math.PI) {
polyParameter -= 2*Math.PI;
}
var depth:Number = this.getNextHighestDepth();
var mc:MovieClip = this.createEmptyMovieClip("mc_"+depth, depth);
mc.beginFill(color);
var n = 3+4*(1+Math.sin(polyParameter));
for (var i = 0; i<n; i++) {
var ss = 1 + 2*(i%2);
var xx = Math.sin(i*2*Math.PI/n)*ss*width;
var yy = Math.cos(i*2*Math.PI/n)*ss*height;
if (i<1) {
mc.moveTo(xx, yy);
} else {
mc.lineTo(xx, yy);
}
}
return mc;
}
-
Senior Member
I dig the new changes realMC. I changed it so the polygon moves on its own instead of with the mouse. For some reason though the polygon bounces off the right side of the screen very early. Maybe it has to do with Stage.width of poly._width
PHP Code:
import flash.display.BitmapData;
polySpeed = 5;
polyDirX = 1;
polyDirY = 1;
polyX = 300;
polyY = 300;
var i:Number = 0;
var b:BitmapData = new BitmapData(Stage.width, Stage.height, true, 0);
this.attachBitmap(b, 1);
this.onEnterFrame = function() {
b.setPixel32(b.width*Math.random(), b.height*Math.random(), 0xFF000000+Math.floor(256*256*256*Math.random()));
};
var mList:Object = new Object();
//mList.onMouseMove = function() {
_root.onEnterFrame = function() {
i++;
var t = 0.1*i;
while (t>2*Math.PI) {
t -= 2*Math.PI;
}
var s = Math.floor(128*(1+Math.sin(t)));
var poly:MovieClip = createPolygon(30, 20, 0xFF000000+65536*s);
poly._y = polyX;
poly._x = polyY;
polyX += polySpeed*polyDirX;
polyY += polySpeed*polyDirY;
if (polyX<0) {
polyDirX = Math.random()+1;
polyX = 1;
} else if (polyX>Stage.width-poly._width) {
polyDirX = -1*(Math.random()+1);
polyX = Stage.width-poly._width-1;
}
if (polyY<0) {
polyDirY = Math.random()+1;
polyY = 1;
} else if (polyY>Stage.height-poly._height) {
polyDirY = -1*(Math.random()+1);
polyY = Stage.height-poly._height-1;
}
poly._alpha = 50;
_root['mc_'+i].onEnterFrame = fadeOut;
};
function fadeOut() {
this._alpha -= 3;
if (this._alpha<0) {
this.removeMovieClip();
}
}
Mouse.addListener(mList);
var polyParameter:Number = 0;
function createPolygon(width:Number, height:Number, color:Number):MovieClip {
polyParameter += 5e-2;
if (polyParameter>2*Math.PI) {
polyParameter -= 2*Math.PI;
}
var depth:Number = this.getNextHighestDepth();
var mc:MovieClip = this.createEmptyMovieClip("mc_"+depth, depth);
mc.beginFill(color);
var n = 3+4*(1+Math.sin(polyParameter));
for (var i = 0; i<n; i++) {
var ss = 1+2*(i%2);
var xx = Math.sin(i*2*Math.PI/n)*ss*width;
var yy = Math.cos(i*2*Math.PI/n)*ss*height;
if (i<1) {
mc.moveTo(xx, yy);
} else {
mc.lineTo(xx, yy);
}
}
return mc;
}
-
Senior Member
very weird, in fact... it bounces off the right side here:
Code:
} else if (polyY>Stage.height-poly._height) {
polyDirY = -1*(Math.random()+1);
polyY = Stage.height-poly._height-1;
}
I'm puzzled... maybe this bit has to do with it:
Code:
poly._y = polyX;
poly._x = polyY;
also, you killed random pixel thing, so I guess we can omit it from now on...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|