For a transform, I need to have a user defined s-curve, that can be controlled using sliders.

For the first half I have been able to create the correct formula,

but I can’t get the second part of the curve to have the correct behaviour.

Is there anyone with a good Math brain that can get the second part of the formula to work?

Now, the lower left of the curve (x<0.5) behaves as I would like,

but the upper right (n>0.5) is fixed,

and I would like to have the s-curve react in the same way to changes in s and e as the other part.

[code]dim p as new Picture(300,300,32)

dim x as double

dim y as double

// s is a double in the range of 0 to 1

// e is a double in the range of 1 to 5

// Both controlled by sliders

for n as double =0 to 1 step 0.005

x=n

if n<0.5 then

y=((1-s)*x + s*0.5*(x/0.5)^e) // This is the left part which works well

else

y=1-(1-x)^2*2 // this should mimic the behavior of the lower-left part of the curve
end
p.Graphics.ForeColor=rgb(0,0,0)
p.Graphics.FillOval(x*300,300-(y*(300)),2,2)

next

Canvas1.Backdrop=p

// Canvas1 is 300x300 pixels[/code]