x


Something like basic READ and DATA commands?

I want to hard code some AnimationCurves. At the moment I'm doing the following:

var ks : Keyframe[] = new Keyframe[3];
ks[0] = Keyframe(0,0);
ks[1] = Keyframe(1,2);
ks[2] = Keyframe(2,7);
var anim : AnimationCurve = new AnimationCurve(ks);
... [etc]

I'd rather do something like this, which used to be possible in Spectrum Basic :-)

var anims = 6;
var ks : Keyframe[];
var anim : AnimationCurve[];
anim = new AnimationCurve(anims);

for (var a=0;a<anims;a++) {
   var numkeys = <READ_INT>; // number of keys in this anim
   ks = new Keyframe[numkeys];
   for (var k=0;k<numkeys;k++) {
      var t = <READ_FLOAT>; // time
      var v = <READ_FLOAT>; // value
      numkeys[k] = Keyframe( t, v );
   }
   anim[a] = new AnimationCurve(ks);
}

Data 3
Data 0,0
Data 1,2
Data 2,7

Data 2
Data 0,0
Data 1,5

Data 4
Data 0,1
Data 1,0
Data 2,3
Data 3,-9
... [etc]

I want to be able to do it within the same js file, rather than parse a separate txt file, as this is for iPhone.

more ▼

asked Feb 22 '11 at 09:51 AM

robinking gravatar image

robinking
756 61 68 81

(comments are locked)
10|3000 characters needed characters left

0 answers: sort voted first
Be the first one to answer this question
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x150
x78

asked: Feb 22 '11 at 09:51 AM

Seen: 280 times

Last Updated: Feb 22 '11 at 09:51 AM