View Full Version : Last experiment...
pom
October 8th, 2002, 06:44 PM
Since everybody's showcasing their work on the design forum...
The Blob (http://membres.lycos.fr/museebranly/flash/contest/blob2Bit07c.html)
Pretty unaesthetic, but I like it. Try to click and drag it a bit.
pom :cowboy:
Iammontoya
October 8th, 2002, 11:26 PM
pretty cool... well, give it up!
cybergold
October 9th, 2002, 10:24 AM
nice
andr.in
October 9th, 2002, 03:27 PM
OMG how do you do these things?
so cool
:crazy::crazy::crazy:
sintax321
October 9th, 2002, 06:34 PM
That is realy quite impressive. I have no idea how that could even be made.
pom
October 10th, 2002, 08:27 AM
Well, I have a few points that move randomly, and I use a little trick with the curveTo method to get that blob shape. Here is the source:
function doDrag(){
this.pressed=true;
this.startDrag();}
function noDrag(){
this.pressed=false;
this.stopDrag();}
MovieClip.prototype.effect=function(){
if (!this.pressed)
if (!(this.loop=(++this.loop)%(5))) {
this.brownX = (Math.random() - .5) * .35;
this.brownY = (Math.random() - .5) * .35;}
this.velX += (-.002 * (this._x - this.centx)) + this.brownX;
this.velY += (-.002 * (this._y - this.centy)) + this.brownY;
this._x += (this.velX *= (this.frictionX=.96));
this._y += (this.velY *= this.frictionX);};
_root.createEmptyMovieClip("ball",0).lineStyle(70,0,0);
ball.lineTo(.15,.45);
for (var p=0;p < (nClip=10);p++)
mc=ball.duplicateMovieClip("ball"+p,p+1,{centx:(radius=50)*Math.cos(p*Math.PI*2/nClip)+250,centy:radius*Math.sin(p*Math.PI*2/nClip)+200,onEnterFrame:effect,onPress:doDrag,onRe lease:noDrag});
_root.onEnterFrame=function(){
mid=new Array();
for (var j=0;j < nClip;j++)
mid.push({x:(_root["ball"+j]._x+_root["ball"+(j+1)%nClip]._x)/2,y:(_root["ball"+j]._y+_root["ball"+(j+1)%nClip]._y)/2});
this.clear();
this.lineStyle(1, 0, 100);
this.beginFill(0x384862, 50);
this.moveTo(mid[0].x, mid[0].y);
for (j=1;j <= nClip;j++)
this.curveTo(_root["ball"+j%nClip]._x, _root["ball"+j%nClip]._y, mid[j%nClip].x, mid[j%nClip].y);};Sorry, it's a bit messy, I had to crush everything in 25 lines :-\
sintax321
October 10th, 2002, 10:34 AM
My God! I hope I can code like that some day. I thought that the Blob looked so cool because it looked organic. You don't see much organic stuff in flash or at least I don't.:)
andr.in
October 10th, 2002, 10:36 AM
I want to code that way too some day...
omg! Gotta start learning flash!
--
Cool
if you delete the line:
mid.push({x:(_root["ball"+j]._x+_root["ball"+(j+1)%nClip]._x)/2, y:(_root["ball"+j]._y+_root["ball"+(j+1)%nClip]._y)/2});
Then only lines come out of that corner.
I have no idea what's happening but hey... cool!
:crazy:
I think I understood what each action does
but what does this "%" really do?
I read the flash help but I didn't understand anything there...
12 % 5 = 2
how??????
what does the "%" do?
pom
October 10th, 2002, 02:42 PM
Actually, what I do is the following:
For each point, draw a line till the next point. My points are put in an array, so I draw a line from point 0 to 1, 1 to 2... 10 to 0.
If I had written ["ball"+(j+1)] only, I wouldn't have gone back to point 0. With the % trick, (j+1)%nClip will equal 0 when j+1=nClip which is the case at the last turn of the loop.
I hope it's clearer now :) I'll try and make a readable version of the code, because it's is really unreadable...
pom :-\
lostinbeta
October 10th, 2002, 03:55 PM
12 % 5 = 2
2 is the remainder after 12 is divided by 5.
The % symbol gets the remainder after the first digit is divided by the second digit.
Am I right Ilyas?
pom
October 10th, 2002, 04:21 PM
Oups sorry, I didn't read your question till the end Syko. And yep, Lost, that's exactly what it does.
andr.in
October 11th, 2002, 09:16 AM
Now that makes a bit sense now...
Thanx y'all
andr.in
October 11th, 2002, 03:03 PM
I see that you have 10 buttons there and each button streches a part of the ..."thing".
But isn't there any way to stop the button that you are currently holding down moving itself? You see if you hold a button down for too long it moves away and then if you release the mouse button it's still streching the ..."thing" like if you have moved out of the .swf area...
I hope I'm making sense here... :crazy:
Bezzer
October 12th, 2002, 04:23 AM
quite nice pom...u could fill it with a gradient to make it even more blob like...dunno just a sugestion :)
pom
October 12th, 2002, 05:02 AM
Well, I suppose I could, Bezzer, but I don't know how. Maybe if I put the gradient behind, and mask it with the blob... I'll have to think about that, it sounds like a good idea.
pom :cowboy:
Bezzer
October 12th, 2002, 05:06 AM
well if ur using api u can just use beginGradientFill instead of begin fill...and then u have to put ur colours and stuff...theres a thing on it in the as dictionary...just look for beginGradientFill :)
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.