# Experiment: Shape Points

**URL:** https://forum.kirupa.com/t/experiment-shape-points/26879
**Category:** Uncategorized
**Created:** [July 27, 2003, 8:56pm UTC](https://forum.kirupa.com/t/experiment-shape-points/26879 "2003-07-27T20:56:57Z")
**Posts on this page:** 13
**Page:** 1

<div class="post-metadata">

### Author: ![955](https://avatars.discourse-cdn.com/v4/letter/9/4bbf92/32.png) [@955](https://forum.kirupa.com/u/955)
#### Post date: [July 27, 2003, 8:56pm UTC](https://forum.kirupa.com/t/experiment-shape-points/26879/1 "2003-07-27T20:56:57Z")

</div>

[swf=“[http://www.skehin.com/misc/points.swf](http://www.skehin.com/misc/points.swf) height=400 width=400”][/swf]

This is my first posted flash experiment, other than my footers… Source code  
below 🙂

Also, feel free to move this if it isn’t in the right place. I wasn’t sure where to post this in the in the first place.  
[AS]  
this.createEmptyMovieClip(“drawing\_mc”, 1000);  
drawing\_mc.\_x = 0; drawing\_mc.\_y = 0;  
var xArray\_array = [0];  
var yArray\_array = [0];  
for (var i = 0; i\<(random(10)+10); i++) {  
xArray\_array.push(random(401));  
yArray\_array.push(random(401));  
}  
drawing\_mc.lineStyle(1, 0x000000, 100);  
drawing\_mc.moveTo(xArray\_array[0], yArray\_array[0]);  
this.onMouseDown = function() {  
drawing\_mc.removeMovieClip();  
this.createEmptyMovieClip(“drawing\_mc”, 1000);  
drawing\_mc.\_x = 0; drawing\_mc.\_y = 0;  
var xArray\_array = [0];  
var yArray\_array = [0];  
for (var i = 0; i\<(random(10)+10); i++) {  
xArray\_array.push(random(401));  
yArray\_array.push(random(401));  
}  
drawing\_mc.lineStyle(1, 0x000000, 100);  
for (var i = 0; i\<xArray\_array.length; i++) {  
for (var h = 0; h\<yArray\_array.length; h++) {  
drawing\_mc.lineTo(xArray\_array[h], yArray\_array[h]);  
drawing\_mc.moveTo(xArray\_array\*, yArray\_array\*);  
}  
}  
};  
for (var i = 0; i\<xArray\_array.length; i++) {  
for (var h = 0; h\<yArray\_array.length; h++) {  
drawing\_mc.lineTo(xArray\_array[h], yArray\_array[h]);  
drawing\_mc.moveTo(xArray\_array\*, yArray\_array\*);  
}  
}

[/AS]

---

<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: [July 27, 2003, 9:00pm UTC](https://forum.kirupa.com/t/experiment-shape-points/26879/2 "2003-07-27T21:00:18Z")

</div>

Ok nice, but there isn’t something “crazy”, you’re just connecting lines from what I’m seeing, njs, I would instead make it more “interactive” and add events and such…

Anyhow, Good Job. 🙂

---

<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: [July 27, 2003, 9:01pm UTC](https://forum.kirupa.com/t/experiment-shape-points/26879/3 "2003-07-27T21:01:36Z")

</div>

it would be nice if you could add a refresh on like a mouse click or with a button or something 🙂

---

<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: [July 27, 2003, 9:08pm UTC](https://forum.kirupa.com/t/experiment-shape-points/26879/4 "2003-07-27T21:08:34Z")

</div>

thats cool but i agree with the refresh thing.

---

<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: [July 27, 2003, 9:20pm UTC](https://forum.kirupa.com/t/experiment-shape-points/26879/5 "2003-07-27T21:20:24Z")

</div>

Done. 😉

You might have to clear your cache though. (Tools-\>Internet Options-\>Clear Files)

Also, when I post swfs I don’t see the file, all I see is blank space the size of the swf. If I right-click the space, I see “Movie not loaded” and the rest of the flash player menu.

---

<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: [July 27, 2003, 9:24pm UTC](https://forum.kirupa.com/t/experiment-shape-points/26879/6 "2003-07-27T21:24:07Z")

</div>

njs,

Add this instead,

[\<i\>\</i\>swf=“[http://www.skehin.com/misc/points.swf](http://www.skehin.com/misc/points.swf) height=400 width=400”][/swf]

---

<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: [July 27, 2003, 11:06pm UTC](https://forum.kirupa.com/t/experiment-shape-points/26879/7 "2003-07-27T23:06:33Z")

</div>

How about

```auto
NUM_DOTS = 10 ;
dot_arr = [] ;
this.createEmptyMovieClip ( "drawing", -1 ) ;

MovieClip.prototype.moveRandom = function () {
	var dx = this.targx - this._x ;
	var dy = this.targy - this._y ;
	this._x += dx / 5 ;
	this._y += dy / 5 ;
	if ( Math.abs(dx) + Math.abs(dy) < 10 ) {
		this.targx = random (400) ;
		this.targy = random (400) ;
	}
}
function generatePoints () {
	for ( var i = 0 ; i < NUM_DOTS ; i++ ) {
		dot_arr.push ( this.createEmptyMovieClip ( "d" + i, i ) ) ;
		dot_arr*.targx = dot_arr*._x = random (400) ;
		dot_arr*.targy = dot_arr*._y = random (400) ;
		dot_arr*.onEnterFrame = moveRandom ;
	}
}
function renderLines () {
	drawing.clear () ;
	drawing.lineStyle ( 0 ) ;
	for ( var j = 0 ; j < NUM_DOTS ; j++ ) {
		for ( var k = j+1 ; k < NUM_DOTS ; k++ ) {
			drawing.moveTo ( dot_arr[j]._x, dot_arr[j]._y ) ;
			drawing.lineTo ( dot_arr[k]._x, dot_arr[k]._y ) ;
		}
	}
}
generatePoints () ;
this.onEnterFrame = renderLines ;

```

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: [July 27, 2003, 11:08pm UTC](https://forum.kirupa.com/t/experiment-shape-points/26879/8 "2003-07-27T23:08:36Z")

</div>

Pretty cool animation there njs 😉

---

<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: [July 28, 2003, 10:25am UTC](https://forum.kirupa.com/t/experiment-shape-points/26879/9 "2003-07-28T10:25:01Z")

</div>

Wow Ilyas, that code is amazing! I could never write something like that! I hope one day I’m as good at scripting as you.

---

<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: [July 28, 2003, 10:27am UTC](https://forum.kirupa.com/t/experiment-shape-points/26879/10 "2003-07-28T10:27:32Z")

</div>

its a lot like lost’s random points in kirupa-lab. Have you seen that njs?

[http://www.kirupa.com/lab/randompoints.htm](http://www.kirupa.com/lab/randompoints.htm)

---

<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: [July 28, 2003, 10:28am UTC](https://forum.kirupa.com/t/experiment-shape-points/26879/11 "2003-07-28T10:28:46Z")

</div>

would be nice if the lines eased into new shape instead of just appearing in new position. Other than that, very nice work!

(and yes, i think i will join you on the ‘wanting to script like Ilyas’ thought)

---

<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: [July 28, 2003, 10:35am UTC](https://forum.kirupa.com/t/experiment-shape-points/26879/12 "2003-07-28T10:35:43Z")

</div>

Orange, yeah, that’s what Ilyas’s one does.

Yeah, I’ve seen that experiment before. It’s a pretty nice script (although coming from Lost, you would expect it to be).

---

<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: [July 28, 2003, 11:42am UTC](https://forum.kirupa.com/t/experiment-shape-points/26879/13 "2003-07-28T11:42:23Z")

</div>

Yep, it looks a bit like Lost’s experiment. I guess the functions look a bit alike, the main difference being in the number of lines drawn 🙂

And the code is not really complicated. All you have to do, really, is to use complicated names, like _render_, or _generate_ instead of _draw_ and _make_… 😉
