Search content:

 

Personal Menu
Username:
Password:
Save password

Become a member

Forgot Password?

 

Don't miss these
Clip Copier
Datagrip Net
myDialog
Volume of Sprite
Shockwave Remote Faq
Popup Xtra
OnStage DVD for Director
Find angles of a right triangle
Universal Movie Pause Button
E-mailExec 2.5
MediaMacros Xtras Mall
 

 

 

Behavior Vector Shape - Create Square Wave

Added on 2/7/2006

 

Compatibilities:
D8 D8_5 D9 Mac PC

This item has not yet been rated

Author: Chunick (website)

Create a square 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 createSquareWave (width, height, waves, start, autoSize)
  
  vertList = []
  
  if autoSize then
    w = width / float(waves)
  else  
    w = width
  end if
  
  pts = waves * 2
  hw = w / 2
  
  repeat with i = 0 to pts
    x = hw * i
    if i mod 2 = start then
      vertList.add([#vertex: point(x, height)])
      vertList.add([#vertex: point(x, 0)])
    else
      vertList.add([#vertex: point(x, 0)])
      vertList.add([#vertex: point(x, height)])
    end if
    
  end repeat
  
  return vertList
  
end  

 


Upload Provided by ABCUpload ASP

Contact

MMI
22 West Court Sq
Suite 2C
Newnan, GA 30263
USA

Fax - (206) 339-5833

Send e-mail