@@ -457,7 +457,8 @@ class TestScene extends Scene {
457
457
const secant = new Line ( { from : p , to : q , length : 6 , lineColor : Colors . blue ( ) } ) ;
458
458
const tangent = new TangentLine ( { plot, x : 0.5 , length : 4 , color : Colors . pink ( ) } ) ;
459
459
const tangentText = new Tex ( `m` ) . changeColor ( Colors . pink ( ) ) . nextTo ( tangent . to ( ) ) ;
460
- const secantText = new Tex ( `m_{\sec}` ) . nextTo ( secant . to ( ) ) . changeColor ( Colors . blue ( ) ) ;
460
+ const secantText = new Tex ( `m_{\sec} = ` ) . nextTo ( secant . to ( ) ) . changeColor ( Colors . blue ( ) ) ;
461
+ const secantSlope = new Text ( '' ) . changeColor ( Colors . blue ( ) ) . nextTo ( secantText , RIGHT ( ) ) ;
461
462
// const secantText = new Text(`m_{\\sec}`).nextTo(secant.to()).changeColor(Colors.blue());
462
463
463
464
this . add (
@@ -471,8 +472,10 @@ class TestScene extends Scene {
471
472
pText , qText ,
472
473
tangentText ,
473
474
secantText ,
475
+ secantSlope ,
474
476
) ;
475
477
478
+ // Need to throttle how quickly tex is updated since an image is being generated and rendered
476
479
const updateText = utils . throttle ( text => secantText . changeText ( text ) , 200 ) ;
477
480
478
481
this . add ( new Updater ( ( pctComplete : number , starting : boolean ) => {
@@ -486,7 +489,8 @@ class TestScene extends Scene {
486
489
secantText . nextTo ( secant . to ( ) ) //.changeText(`m_{\\sec} = ${m.toFixed(2)}`);
487
490
488
491
// console.log(m, pctComplete)
489
- updateText ( `m_{\\sec} = ${ m . toFixed ( 2 ) } ` ) ;
492
+ // updateText(`m_{\\sec} = ${m.toFixed(2)}`);
493
+ secantSlope . nextTo ( secantText , RIGHT ( ) ) . changeText ( `${ m . toFixed ( 2 ) } ` ) ;
490
494
491
495
} , { duration : 5000 , easing : Easing . linear , repeat : true , yoyo : true , } ) ) ;
492
496
// }, { duration: 5000, easing: x => Easing.easeStep(x, 10), repeat: true, yoyo: true, }));
0 commit comments