PDA

View Full Version : Ripplecloth 300000



freeskier89
January 16th, 2009, 02:40 AM
I'm off to bed. Flash is addictive :D

Thanks darkmotion for the beautiful title :D


_root.createEmptyMovieClip("container",1);
var d = 1;
var radius = 5;
function addCircleShadow(x,y,z,scale){
var mc = container.attachMovie("CircleShadow", "circle"+d, d++);
mc.x = x;
mc.y = y;
mc.z = z;
mc.t = Math.atan2(mc.z-50,mc.x);
mc.r = Math.sqrt((mc.z-50)*(mc.z-50)+mc.x*mc.x);
mc._alpha=100;
mc._xscale=mc._yscale=20;
mc.onEnterFrame=function()
{
this.rotate(.02);
this.update3D();
}
}
function addCircle(x, y, z, scale) {
var mc = container.attachMovie("Circle", "circle"+d, d++);
mc.x = x;
mc.y = y;
mc.z = z;
mc.vx = 0;//Math.random()-.5;
mc.vy = 0;//Math.random()-.5;
mc.vz = 0;
mc.t = Math.atan2(mc.z-50,mc.x);
mc.r = Math.sqrt((mc.z-50)*(mc.z-50)+mc.x*mc.x);
mc.scale=scale;
mc.colorobj = new Color(mc.coloroverlay);
mc.setHue(.3);
mc.update3D();
mc.onEnterFrame = function() {
this.z += this.vz;
this.y = basey+1.5*Math.sin((t+this.d));
this.x += this.vx;
//this.setHue(this.z/100+.3);
//trace(this.z);
this.setHue(this.y/8+.3,1+Math.pow((this.z+45)/50,2));
this.rotate(.02);
this.update3D();
};
return mc;
}
MovieClip.prototype.rotate=function(t){
this.t+=t;
this.z=this.r*Math.sin(this.t);
this.x=this.r*Math.cos(this.t);
//this.update3D();
}
MovieClip.prototype.setHue = function(x,a) {
//x = 0 - 1
x = Math.max(x*2*Math.PI, 0.01);
var r = 128+128*Math.cos(x)/a;
var g = 128+128*Math.cos(x+Math.PI*2/3)/a;
var b = 128+128*Math.cos(x+Math.PI*4/3)/a;
var hex = r << 16 | g << 8 | b;
this.colorobj.setRGB(hex);
};
MovieClip.prototype.update3D = function() {
var normalizedz = 1-(this.z-cam_z)/maxdepth;
if (normalizedz<=0) {
this._visible = false;
} else {
this._x = (this.x*5-cam_x)*normalizedz+250;
this._y = (this.y*5-cam_y)*normalizedz+300-300;
this._xscale = this._yscale=this.scale*(normalizedz);
this.swapDepths(normalizedz*10000);
this._visible = true;
}
};
MovieClip.prototype.hopTo = function(x, y) {
this.vx = (x-this.x)/40;
this.vy = (y-this.y)/40;
var d = Math.sqrt(Math.pow(x-this.x,2)+Math.pow(y-this.y,2));
var v = Math.sqrt(this.vx*this.vx+this.vy*this.vy);
this.vz = -.5*g*(d/v);
};
var g = .1;
var cam_z = 1;
var cam_x = 0;
var cam_y = -150;
var t = 0;
var maxdepth = 60;
var basey=0;
for(var x =-23;x<23;x+=5){
for(var z =-23+50;z<23+50;z+=5){
var mc = addCircle(x,basey,z,15);
mc.d = Math.sqrt(x*x+Math.pow(z-50,2))/4;
}
}
onEnterFrame=function(){
t+=.1;
}
mx = _xmouse;
my=_ymouse;
var rt=0;

for(var x =-23;x<23;x+=5){
for(var z =-23+50;z<23+50;z+=5){
var mc = addCircleShadow(x+1,basey+5,z+1);
//mc._alpha=10;
//mc.filters=[new flash.filters.BlurFilter(15,15,1.5)];
//mc.d = Math.sqrt(x*x+Math.pow(z-50,2))/4;
}
}

http://ffiles.com/flash/3_dimensional/3d_sine_grid_2193.html

Pasquale
January 16th, 2009, 02:43 AM
Gosh dude, you are on fire!

Krilnon
January 16th, 2009, 02:47 AM
I love how you left some commented-out code with the source that you posted. :P

Anyway, I've been looking at all of your entries in the past few weeks, but I have yet to comment on them. They're pretty great!

I started an entry right after the contest was announced, but I only got as far as generating a really neat background, but I never figured out what sort of motion would make it look interesting. You seem to have no problem coming up with such motion.

freeskier89
January 16th, 2009, 02:57 AM
I love how you left some commented-out code with the source that you posted. :P

Anyway, I've been looking at all of your entries in the past few weeks, but I have yet to comment on them. They're pretty great!

I started an entry right after the contest was announced, but I only got as far as generating a really neat background, but I never figured out what sort of motion would make it look interesting. You seem to have no problem coming up with such motion.
haha thanks! :P Ya its a mess, and in a couple, there are a few variables that are never used... they were speedy entries lol.

Other than my first and second entries, they've all just kind of evolved from an unrelated base idea. Like this one literally started out as a bunch of abstract crickets jumping around sending out "chirp" signals and I dropped it and just went for grid effects lol. I would love to see what you come up with for yours :).

kirupa
January 16th, 2009, 04:45 AM
Added :)