A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: drawing sine curves w/ curveTo() or lineTo()

Hybrid View

  1. #1
    Junior Member
    Join Date
    Nov 2000
    Posts
    12
    hi, has anyone tried to draw a sine curve with the flashMX drawing functions? everything I've done with drawTo() is pretty ugly looking. anyone had any sucess w/ this?

    -fish

  2. #2
    Senior Member
    Join Date
    Jan 2002
    Posts
    368
    lets see...maybe something like...

    Code:
    resolution=10;
    wavelength=.5;
    amplitude=50;
    x=0;
    y=200;
    lineStyle(1,0,100);
    moveTo(x,y);
    onEnterFrame=function(){
      if(x<550){
        lineTo(x, y);
        x+=resolution;
        angle+=wavelength;
        y=200+Math.sin(angle)*amplitude;
      }
    }
    or something like that. play around with the wavelength, resolution and amplitude.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center