|
-
power to a power
*flash8
*actionscript2
I've been having problems with this math command
this._xscale = ((2.71828)^(-(this._x-120)/100)^2)+1;
this._yscale = this._xscale;
that it does as the symbols ._x approaches 120 it's scale increases.
When i graph out this function i get the results i want a nice bell shaped curve that increases at 120 to a value of 2 and sloops down to 1 around ~300.
after experimenting with flash it appears that it doesn't like power raised to a power such as 2^2^2 or 2^(2^2).
Anyone have any ideas?
if you would like to see what the graph looks like enter
(2.71828)^(-((x-120)/100)^2)+1
into Java Grapher
note: change Xmax to 500
Last edited by FireTime; 05-27-2007 at 11:10 PM.
-
亲爱钰
I'm no expert on this but I'm unsure where you got your syntax from. "^" doesn't seem to have anything to do with raising to a power. 2^2^2 (sic) would be written
d = Math.pow(Math.pow(2,2),2);
in actionscript. Anyhow perhaps I'm missing something.
-
FK'n_dog
a FWIW ...
ActionScript 2.0 Language Reference
ActionScript language elements >
Operators >
^ bitwise XOR operator
var x:Number = 15 ^ 9;
trace(x);
// 15 decimal = 1111 binary
// 9 decimal = 1001 binary
// 1111 ^ 1001 = 0110
// returns 6 decimal (0110 binary)
-
thanks allot!
I feel stupid now for not realizing the ^ was not for exponents.
here is the finished line of code
Code:
this._xscale = (Math.pow(2.71828, -Math.pow(((this._x-120)/50), 2))+1)*100;
this._yscale = this._xscale;
//as the objects x value approaches 120 it doubles in size
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|