# Sines 2

**URL:** <https://forum.kirupa.com/t/sines-2/176532>\
**Category:** flash\
**Created:** [January 24, 2006, 8:39pm UTC](https://forum.kirupa.com/t/sines-2/176532 "2006-01-24T20:39:37Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ice987](https://avatars.discourse-cdn.com/v4/letter/i/779978/32.png) [@ice987](https://forum.kirupa.com/u/ice987)\
**Post date:** [January 24, 2006, 8:39pm UTC](https://forum.kirupa.com/t/sines-2/176532/1 "2006-01-24T20:39:37Z")

</div>

Hi

The following code generates sine results from 0 to 1 from 100 loops

How to I change it to generate the following 4 results

a)0 to 1 to 0

and

b)-1 to 0 to 1

and

c)-1 to 0 to 1 to 0 to -1

and

d) 1 to 0

from 100 loops

Here’s the code

//100 loops to produce sin results from 0 to 1;  
var loopCount=0;  
var desiredLoops=100;  
for (var i:Number=0;i\<=Math.PI/2;i+= Math.PI/(desiredLoops\*2)){  
trace("loopCount = "+loopCount);  
trace("Sin = "+Math.sin(i));  
loopCount++;  
}
