@@ -457,7 +457,8 @@ class TestScene extends Scene {
457457 const secant = new Line ( { from : p , to : q , length : 6 , lineColor : Colors . blue ( ) } ) ;
458458 const tangent = new TangentLine ( { plot, x : 0.5 , length : 4 , color : Colors . pink ( ) } ) ;
459459 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 ( ) ) ;
461462 // const secantText = new Text(`m_{\\sec}`).nextTo(secant.to()).changeColor(Colors.blue());
462463
463464 this . add (
@@ -471,8 +472,10 @@ class TestScene extends Scene {
471472 pText , qText ,
472473 tangentText ,
473474 secantText ,
475+ secantSlope ,
474476 ) ;
475477
478+ // Need to throttle how quickly tex is updated since an image is being generated and rendered
476479 const updateText = utils . throttle ( text => secantText . changeText ( text ) , 200 ) ;
477480
478481 this . add ( new Updater ( ( pctComplete : number , starting : boolean ) => {
@@ -486,7 +489,8 @@ class TestScene extends Scene {
486489 secantText . nextTo ( secant . to ( ) ) //.changeText(`m_{\\sec} = ${m.toFixed(2)}`);
487490
488491 // 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 ) } ` ) ;
490494
491495 } , { duration : 5000 , easing : Easing . linear , repeat : true , yoyo : true , } ) ) ;
492496 // }, { duration: 5000, easing: x => Easing.easeStep(x, 10), repeat: true, yoyo: true, }));
0 commit comments