Contents Articles Behaviors Books Director News Director Web Sites FAQ Games Mailing Lists News Groups Project Examples Reviews Software Tools Useful Web Sites Utilities Xtras

Don't miss these
 Read Text from a file MelixDB Xtra version 1.0 released. Fill using setPixel Reverse a list Creating a Game Environment Director 8 Primer TetonPop Xtra Animated Slider Puzzle by J.R.D.R. Final text box resizer for text members Wait for a DirectMedia CuePoint (Index ID as Reference)

# Vector Shape - Create Sine Wave

Added on 2/7/2006

 Compatibilities: This item has not yet been rated

Author: Chunick (website)

Create a sine wave shape with this custom handler. It returns a vertex list. Pass the width and height of the wave from crest to crest, the number of waves, the start as a boolean value (0 or 1) and autoSize as a boolean as well. AutoSize will allow you to specify an overall width and height and it will figure out the size of the waves for you based on the number of waves, the width and the height.

 on createSineWave (width, height, waves, start, autoSize)      vertList = []      if autoSize then     w = width / float(waves)   else       w = width   end if      pts = waves * 2   hw = w / 2   qw = w / 4      repeat with i = 0 to pts     x = hw * i     if i mod 2 = start then       vertList.add([#vertex: point(x, height), #handle1: point(qw,0), #handle2: point(-qw,0)])     else       vertList.add([#vertex: point(x, 0), #handle1: point(qw,0), #handle2: point(-qw,0)])     end if        end repeat      return vertList    end

 Contact MMI 36 South Court Sq Suite 300 Newnan, GA 30263 USA Send e-mail