# Last experiment

**URL:** <https://forum.kirupa.com/t/last-experiment/6493>\
**Category:** Uncategorized\
**Created:** [October 8, 2002, 10:44pm UTC](https://forum.kirupa.com/t/last-experiment/6493 "2002-10-08T22:44:27Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![pom](https://avatars.discourse-cdn.com/v4/letter/p/f07891/32.png) [@pom](https://forum.kirupa.com/u/pom)\
**Post date:** [October 8, 2002, 10:44pm UTC](https://forum.kirupa.com/t/last-experiment/6493/1 "2002-10-08T22:44:27Z")

</div>

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:

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [October 9, 2002, 3:26am UTC](https://forum.kirupa.com/t/last-experiment/6493/2 "2002-10-09T03:26:53Z")

</div>

pretty cool… well, give it up!

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [October 9, 2002, 2:24pm UTC](https://forum.kirupa.com/t/last-experiment/6493/3 "2002-10-09T14:24:11Z")

</div>

nice

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [October 9, 2002, 7:27pm UTC](https://forum.kirupa.com/t/last-experiment/6493/4 "2002-10-09T19:27:00Z")

</div>

OMG how do you do these things?  
so cool  
:crazy::crazy::crazy:

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [October 9, 2002, 10:34pm UTC](https://forum.kirupa.com/t/last-experiment/6493/5 "2002-10-09T22:34:07Z")

</div>

That is realy quite impressive. I have no idea how that could even be made.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [October 10, 2002, 12:27pm UTC](https://forum.kirupa.com/t/last-experiment/6493/6 "2002-10-10T12:27:48Z")

</div>

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:

```auto
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,onRelease: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 :-\

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [October 10, 2002, 2:34pm UTC](https://forum.kirupa.com/t/last-experiment/6493/7 "2002-10-10T14:34:15Z")

</div>

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.🙂

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [October 10, 2002, 2:36pm UTC](https://forum.kirupa.com/t/last-experiment/6493/8 "2002-10-10T14:36:52Z")

</div>

## 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?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [October 10, 2002, 6:42pm UTC](https://forum.kirupa.com/t/last-experiment/6493/9 "2002-10-10T18:42:12Z")

</div>

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 :-\

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [October 10, 2002, 7:55pm UTC](https://forum.kirupa.com/t/last-experiment/6493/10 "2002-10-10T19:55:07Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [October 10, 2002, 8:21pm UTC](https://forum.kirupa.com/t/last-experiment/6493/11 "2002-10-10T20:21:40Z")

</div>

Oups sorry, I didn’t read your question till the end Syko. And yep, Lost, that’s exactly what it does.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [October 11, 2002, 1:16pm UTC](https://forum.kirupa.com/t/last-experiment/6493/12 "2002-10-11T13:16:53Z")

</div>

Now that makes a bit sense now…  
Thanx y’all

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [October 11, 2002, 7:03pm UTC](https://forum.kirupa.com/t/last-experiment/6493/13 "2002-10-11T19:03:24Z")

</div>

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:

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [October 12, 2002, 8:23am UTC](https://forum.kirupa.com/t/last-experiment/6493/14 "2002-10-12T08:23:31Z")

</div>

quite nice pom…u could fill it with a gradient to make it even more blob like…dunno just a sugestion 🙂

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [October 12, 2002, 9:02am UTC](https://forum.kirupa.com/t/last-experiment/6493/15 "2002-10-12T09:02:35Z")

</div>

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:

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [October 12, 2002, 9:06am UTC](https://forum.kirupa.com/t/last-experiment/6493/16 "2002-10-12T09:06:24Z")

</div>

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 🙂
