# Wave code

**URL:** <https://forum.kirupa.com/t/wave-code/38176>\
**Category:** Uncategorized\
**Created:** [December 19, 2003, 1:21am UTC](https://forum.kirupa.com/t/wave-code/38176 "2003-12-19T01:21:41Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![LifeEnder](https://avatars.discourse-cdn.com/v4/letter/l/bbce88/32.png) [@LifeEnder](https://forum.kirupa.com/u/LifeEnder)\
**Post date:** [December 19, 2003, 1:21am UTC](https://forum.kirupa.com/t/wave-code/38176/1 "2003-12-19T01:21:41Z")

</div>

I was wondering if anyone had a code that could help make a wave effect. The image im useing is a really simple upside down v shape but I want it to look like its actually coming in like a wave. If anyone has any ideas please share :bounce:

Thanks a bunch =) =)

---

<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:** [December 21, 2003, 10:35am UTC](https://forum.kirupa.com/t/wave-code/38176/2 "2003-12-21T10:35:17Z")

</div>

This could be an idea, but I honnestly don’t know how you could adapt it:

```auto
//RIPPLES: EBEN ELIASON, MAY, 2003 (KINETIC-THOUGHT)
//Edited by pom
//
//The following additional lines of code are given for dynamic experimentation.
//As such, all values were initially hard coded and therefore these lines
//do not count toward the 25 line limit, which my code excalty hits.    

size = 300 //the size of the "pool" (multiples of 15)
amplitude = 30 //initial wavefront amplitude (0-100)
viscocity = .1 //determines how "thick" the fluid is (0-1)
elasticity = .5 //essentially determines freq of ripples (0-2)

_global.root = this ;

//sets a time for each drop indicating when the wavefront from click will reach it
this.onMouseDown = function(){
	for(i = 1; i <= k; i++) {
		var dx, dy ;
		var clip = root["Drop"+i] ;
		clip.distance = ((dx = clip._x - root._xmouse)*dx + (dy = clip._y - root._ymouse)*dy)/10;
		clip.ripples.push(getTimer() + clip.distance/2);
	}
}
for(i = 0; i < size; i+=25) for(j = 0; j < size; j+=25){
	Drop = this.createEmptyMovieClip("Drop"+(++k), k);
	Drop.lineStyle(45,0x002255,60);
	Drop.lineTo(.15,.45);
	Drop._x = j;
	Drop._y = i;
	Drop.ripples = new Array();
	Drop.col = new Color (Drop);
	Drop.onEnterFrame = function(){
		for(i = 0; i < this.ripples.length; i++){
			if(getTimer() > this.ripples*){
				this.ripples.splice(i, 1);
				this._xscale -= amplitude ;
				this._yscale -= amplitude ;
			}
		}
		this.Az = (100 - this._xscale)*(elasticity)
		this.Vz = (this.Vz + this.Az)*(1-viscocity)
		this._xscale = this._yscale += this.Vz ;
		dif = 100 - this._xscale ;
		var difO = {aa:50,rb:0,gb:0,bb:this.vc=100+1.5*dif};
		this.col.setTransform(difO);}}

```

---

<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:** [December 22, 2003, 6:58am UTC](https://forum.kirupa.com/t/wave-code/38176/3 "2003-12-22T06:58:19Z")

</div>

Ah I wish I could take a look at that code now but I cant until I get home on Tuesday. Your ideas are always good so im sure that I can use it in some way.
