@@ -39,7 +39,7 @@ class TestAnimation extends BaseAnimation {
39
39
40
40
class TestScene extends Scene {
41
41
compose ( ) {
42
- this . add ( new GridLines ( ) ) ;
42
+ // this.add(new GridLines());
43
43
44
44
// const a = this.add(new Axes({
45
45
// xRange: [-1, 5],
@@ -432,68 +432,79 @@ class TestScene extends Scene {
432
432
// l.changeendpoints(d1, d2);
433
433
// }, { duration: 3000, easing: easing.linear, repeat: true, yoyo: true, }));
434
434
435
- const axes = new Axes ( {
436
- xLength : 8 ,
437
- yLength : 6 ,
438
- xRange : [ 0 , 1 ] ,
439
- xStep : 0.25 ,
440
- yRange : [ 0 , 35 ] ,
441
- yStep : 5 ,
442
- showLabels : false ,
443
- showTicks : false ,
444
- xLabel : 'time (h)' ,
445
- yLabel : 'distance (miles)'
446
- } ) ;
435
+ // const axes = new Axes({
436
+ // xLength: 8,
437
+ // yLength: 6,
438
+ // xRange: [0, 1],
439
+ // xStep: 0.25,
440
+ // yRange: [0, 35],
441
+ // yStep: 5,
442
+ // showLabels: false,
443
+ // showTicks: false,
444
+ // xLabel: 'time (h)',
445
+ // yLabel: 'distance (miles)'
446
+ // });
447
447
448
- const fn = x => Math . pow ( Math . E , 12 * x * x - 2.5 ) ;
449
- const plot = axes . plot ( fn ) . changeLineColor ( Colors . green ( ) ) ;
450
-
451
- const p = axes . point ( [ 0.5 , fn ( 0.5 ) ] ) ;
452
- const q = axes . point ( [ 0.69 , fn ( 0.69 ) ] ) ;
453
-
454
- const pText = new Tex ( { text : 'P' } ) . nextTo ( p , [ - 1 , 1 ] ) ;
455
- const qText = new Tex ( { text : 'Q' } ) . nextTo ( q , RIGHT ( 1.5 ) ) ;
456
- const qDot = new Dot ( { center : q , color : Colors . blue ( ) } ) ;
457
- const secant = new Line ( { from : p , to : q , length : 6 , lineColor : Colors . blue ( ) } ) ;
458
- const tangent = new TangentLine ( { plot, x : 0.5 , length : 4 , color : Colors . pink ( ) } ) ;
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 ( ) ) ;
461
- const secantSlope = new Text ( '' ) . changeColor ( Colors . blue ( ) ) . nextTo ( secantText , RIGHT ( ) ) ;
462
- // const secantText = new Text(`m_{\\sec}`).nextTo(secant.to()).changeColor(Colors.blue());
463
-
464
- this . add (
465
- axes , plot ,
448
+ // const fn = x => Math.pow(Math.E, 12 * x * x - 2.5);
449
+ // const plot = axes.plot(fn).changeLineColor(Colors.green());
450
+
451
+ // const p = axes.point([0.5, fn(0.5)]);
452
+ // const q = axes.point([0.69, fn(0.69)]);
453
+
454
+ // const pText = new Tex({ text: 'P' }).nextTo(p, [-1, 1]);
455
+ // const qText = new Tex({ text: 'Q' }).nextTo(q, RIGHT(1.5));
456
+ // const qDot = new Dot({ center: q, color: Colors.blue() });
457
+ // const secant = new Line({ from: p, to: q, length: 6, lineColor: Colors.blue() });
458
+ // const tangent = new TangentLine({ plot, x: 0.5, length: 4, color: Colors.pink() });
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());
461
+ // const secantSlope = new Text('').changeColor(Colors.blue()).nextTo(secantText, RIGHT());
462
+ // // const secantText = new Text(`m_{\\sec}`).nextTo(secant.to()).changeColor(Colors.blue());
463
+
464
+ // this.add(
465
+ // axes, plot,
466
466
467
- secant ,
468
- tangent ,
469
- new Dot ( { center : p , color : Colors . pink ( ) } ) ,
467
+ // secant,
468
+ // tangent,
469
+ // new Dot({ center: p, color: Colors.pink() }),
470
470
471
- qDot ,
472
- pText , qText ,
473
- tangentText ,
474
- secantText ,
475
- secantSlope ,
476
- ) ;
477
-
478
- // Need to throttle how quickly tex is updated since an image is being generated and rendered
479
- const updateText = utils . throttle ( text => secantText . changeText ( text ) , 200 ) ;
480
-
481
- this . add ( new Updater ( ( pctComplete : number , starting : boolean ) => {
482
- const rx = math . lerp ( 0.5 , 0.75 , 1 - pctComplete ) ;
483
- const m = ( 25 * rx * rx - 25 * 0.5 * 0.5 ) / ( rx - 0.5 ) ;
484
-
485
- const x = math . lerp ( 0.51 , 0.69 , 1 - pctComplete ) ;
486
- qDot . moveTo ( plot . pointAtX ( x ) ) ;
487
- secant . changeEndpoints ( p , qDot , true ) ;
488
- qText . nextTo ( qDot . center ( ) , RIGHT ( ) , 0.3 ) ;
489
- secantText . nextTo ( secant . to ( ) ) //.changeText(`m_{\\sec} = ${m.toFixed(2)}`);
490
-
491
- // console.log(m, pctComplete)
492
- // updateText(`m_{\\sec} = ${m.toFixed(2)}`);
493
- secantSlope . nextTo ( secantText , RIGHT ( ) ) . changeText ( `${ m . toFixed ( 2 ) } ` ) ;
494
-
495
- } , { duration : 5000 , easing : Easing . linear , repeat : true , yoyo : true , } ) ) ;
471
+ // qDot,
472
+ // pText, qText,
473
+ // tangentText,
474
+ // secantText,
475
+ // secantSlope,
476
+ // );
477
+
478
+ // // Need to throttle how quickly tex is updated since an image is being generated and rendered
479
+ // const updateText = utils.throttle(text => secantText.changeText(text), 200);
480
+
481
+ // this.add(new Updater((pctComplete: number, starting: boolean) => {
482
+ // const rx = math.lerp(0.5, 0.75, 1 - pctComplete);
483
+ // const m = (25 * rx * rx - 25 * 0.5 * 0.5) / (rx - 0.5);
484
+
485
+ // const x = math.lerp(0.51, 0.69, 1 - pctComplete);
486
+ // qDot.moveTo(plot.pointAtX(x));
487
+ // secant.changeEndpoints(p, qDot, true);
488
+ // qText.nextTo(qDot.center(), RIGHT(), 0.3);
489
+ // secantText.nextTo(secant.to()) //.changeText(`m_{\\sec} = ${m.toFixed(2)}`);
490
+
491
+ // // console.log(m, pctComplete)
492
+ // // updateText(`m_{\\sec} = ${m.toFixed(2)}`);
493
+ // secantSlope.nextTo(secantText, RIGHT()).changeText(`${m.toFixed(2)}`);
494
+
495
+ // }, { duration: 5000, easing: Easing.linear, repeat: true, yoyo: true, }));
496
496
// }, { duration: 5000, easing: x => Easing.easeStep(x, 10), repeat: true, yoyo: true, }));
497
+
498
+ const v = new Tex ( { text : '\\mathbb{V}' , color : '#343434' } ) . scale ( 7 ) ;
499
+ v . shift ( LEFT ( 2.25 ) , UP ( 1.5 ) ) ;
500
+
501
+ const circle = new Circle ( { color : '#87c2a5' , lineColor : Colors . transparent ( ) } ) . shift ( LEFT ( ) ) ;
502
+ const square = new Square ( { color : '#525893' , lineColor : Colors . transparent ( ) } ) . shift ( UP ( ) ) ;
503
+ const triangle = new Triangle ( { color : '#e07a5f' , lineColor : Colors . transparent ( ) } ) . shift ( RIGHT ( ) ) ;
504
+
505
+ const logo = new Group ( triangle , square , circle , v ) ;
506
+ logo . moveTo ( ORIGIN ) ;
507
+ this . add ( logo ) ;
497
508
}
498
509
}
499
510
0 commit comments