From 545508987903be8c2f361bbee8b3beae683c73b5 Mon Sep 17 00:00:00 2001
From: bobzel <zzzman@gmail.com>
Date: Thu, 26 Oct 2023 23:23:48 -0400
Subject: a variety of fixes to the animation timeline to make it make some
 sense. lots still broken.

---
 src/client/views/animationtimeline/Track.tsx | 77 +++++++++++++++-------------
 1 file changed, 42 insertions(+), 35 deletions(-)

(limited to 'src/client/views/animationtimeline/Track.tsx')

diff --git a/src/client/views/animationtimeline/Track.tsx b/src/client/views/animationtimeline/Track.tsx
index 1010332f5..2fd062a88 100644
--- a/src/client/views/animationtimeline/Track.tsx
+++ b/src/client/views/animationtimeline/Track.tsx
@@ -1,17 +1,19 @@
 import { action, computed, intercept, observable, reaction, runInAction } from 'mobx';
 import { observer } from 'mobx-react';
 import * as React from 'react';
-import { Doc, DocListCast, Opt, DocListCastAsync } from '../../../fields/Doc';
+import { Doc, DocListCast, DocListCastAsync, Opt } from '../../../fields/Doc';
 import { Copy } from '../../../fields/FieldSymbols';
 import { List } from '../../../fields/List';
 import { ObjectField } from '../../../fields/ObjectField';
 import { listSpec } from '../../../fields/Schema';
 import { Cast, NumCast } from '../../../fields/Types';
 import { Transform } from '../../util/Transform';
-import { Keyframe, KeyframeFunc, RegionData } from './Keyframe';
+import { Region, RegionData, RegionHelpers } from './Region';
+import { Timeline } from './Timeline';
 import './Track.scss';
 
 interface IProps {
+    timeline: Timeline;
     animatedDoc: Doc;
     currentBarX: number;
     transform: Transform;
@@ -32,14 +34,14 @@ export class Track extends React.Component<IProps> {
     @observable private _newKeyframe: boolean = false;
     private readonly MAX_TITLE_HEIGHT = 75;
     @observable private _trackHeight = 0;
-    private primitiveWhitelist = ['x', 'y', '_width', '_height', 'opacity', '_layout_scrollTop'];
+    private primitiveWhitelist = ['x', 'y', '_width', '_height', '_rotation', 'opacity', '_layout_scrollTop'];
     private objectWhitelist = ['data'];
 
     @computed private get regions() {
         return DocListCast(this.props.animatedDoc.regions);
     }
     @computed private get time() {
-        return NumCast(KeyframeFunc.convertPixelTime(this.props.currentBarX, 'mili', 'time', this.props.tickSpacing, this.props.tickIncrement));
+        return NumCast(RegionHelpers.convertPixelTime(this.props.currentBarX, 'mili', 'time', this.props.tickSpacing, this.props.tickIncrement));
     }
 
     async componentDidMount() {
@@ -85,36 +87,36 @@ export class Track extends React.Component<IProps> {
      */
     @action
     saveKeyframe = async () => {
-        const keyframes = Cast(this.saveStateRegion?.keyframes, listSpec(Doc)) as List<Doc>;
-        const kfIndex = keyframes.indexOf(this.saveStateKf!);
+        if (this.props.timeline.IsPlaying || !this.saveStateRegion || !this.saveStateKf) {
+            this.saveStateKf = undefined;
+            this.saveStateRegion = undefined;
+            return;
+        }
+        const keyframes = Cast(this.saveStateRegion.keyframes, listSpec(Doc)) as List<Doc>;
+        const kfIndex = keyframes.indexOf(this.saveStateKf);
         const kf = keyframes[kfIndex] as Doc; //index in the keyframe
         if (this._newKeyframe) {
-            DocListCast(this.saveStateRegion?.keyframes).forEach((kf, index) => {
+            DocListCast(this.saveStateRegion.keyframes).forEach((kf, index) => {
                 this.copyDocDataToKeyFrame(kf);
                 kf.opacity = index === 0 || index === 3 ? 0.1 : 1;
             });
             this._newKeyframe = false;
         }
         if (!kf) return;
-        if (kf.type === KeyframeFunc.KeyframeType.default) {
-            // only save for non-fades
-            this.copyDocDataToKeyFrame(kf);
-            const leftkf = KeyframeFunc.calcMinLeft(this.saveStateRegion!, this.time, kf); // lef keyframe, if it exists
-            const rightkf = KeyframeFunc.calcMinRight(this.saveStateRegion!, this.time, kf); //right keyframe, if it exists
-            if (leftkf?.type === KeyframeFunc.KeyframeType.fade) {
+        // only save for non-fades
+        if (this.copyDocDataToKeyFrame(kf)) {
+            const leftkf = RegionHelpers.calcMinLeft(this.saveStateRegion, this.time, kf); // lef keyframe, if it exists
+            const rightkf = RegionHelpers.calcMinRight(this.saveStateRegion, this.time, kf); //right keyframe, if it exists
+            if (leftkf?.type === RegionHelpers.KeyframeType.end) {
                 //replicating this keyframe to fades
-                const edge = KeyframeFunc.calcMinLeft(this.saveStateRegion!, this.time, leftkf);
+                const edge = RegionHelpers.calcMinLeft(this.saveStateRegion, this.time, leftkf);
                 edge && this.copyDocDataToKeyFrame(edge);
                 leftkf && this.copyDocDataToKeyFrame(leftkf);
-                edge && (edge.opacity = 0.1);
-                leftkf && (leftkf.opacity = 1);
             }
-            if (rightkf?.type === KeyframeFunc.KeyframeType.fade) {
-                const edge = KeyframeFunc.calcMinRight(this.saveStateRegion!, this.time, rightkf);
+            if (rightkf?.type === RegionHelpers.KeyframeType.end) {
+                const edge = RegionHelpers.calcMinRight(this.saveStateRegion, this.time, rightkf);
                 edge && this.copyDocDataToKeyFrame(edge);
                 rightkf && this.copyDocDataToKeyFrame(rightkf);
-                edge && (edge.opacity = 0.1);
-                rightkf && (rightkf.opacity = 1);
             }
         }
         keyframes[kfIndex] = kf;
@@ -143,7 +145,7 @@ export class Track extends React.Component<IProps> {
                     const r = region as RegionData; //for some region is returning undefined... which is not the case
                     if (DocListCast(r.keyframes).find(kf => kf.time === this.time) === undefined) {
                         //basically when there is no additional keyframe at that timespot
-                        this.makeKeyData(r, this.time, KeyframeFunc.KeyframeType.default);
+                        this.makeKeyData(r, this.time, RegionHelpers.KeyframeType.default);
                     }
                 }
             },
@@ -222,20 +224,20 @@ export class Track extends React.Component<IProps> {
      */
     @action
     timeChange = async () => {
-        if (this.saveStateKf !== undefined) {
-            await this.saveKeyframe();
-        } else if (this._newKeyframe) {
+        if (this.saveStateKf !== undefined || this._newKeyframe) {
             await this.saveKeyframe();
         }
         const regiondata = await this.findRegion(Math.round(this.time)); //finds a region that the scrubber is on
         if (regiondata) {
-            const leftkf: Doc | undefined = await KeyframeFunc.calcMinLeft(regiondata, this.time); // lef keyframe, if it exists
-            const rightkf: Doc | undefined = await KeyframeFunc.calcMinRight(regiondata, this.time); //right keyframe, if it exists
+            const leftkf: Doc | undefined = await RegionHelpers.calcMinLeft(regiondata, this.time); // lef keyframe, if it exists
+            const rightkf: Doc | undefined = await RegionHelpers.calcMinRight(regiondata, this.time); //right keyframe, if it exists
             const currentkf: Doc | undefined = await this.calcCurrent(regiondata); //if the scrubber is on top of the keyframe
             if (currentkf) {
                 await this.applyKeys(currentkf);
-                this.saveStateKf = currentkf;
-                this.saveStateRegion = regiondata;
+                runInAction(() => {
+                    this.saveStateKf = currentkf;
+                    this.saveStateRegion = regiondata;
+                });
             } else if (leftkf && rightkf) {
                 await this.interpolate(leftkf, rightkf);
             }
@@ -277,7 +279,7 @@ export class Track extends React.Component<IProps> {
     @action
     interpolate = async (left: Doc, right: Doc) => {
         this.primitiveWhitelist.forEach(key => {
-            if (left[key] && right[key] && typeof left[key] === 'number' && typeof right[key] === 'number') {
+            if (typeof left[key] === 'number' && typeof right[key] === 'number') {
                 //if it is number, interpolate
                 const dif = NumCast(right[key]) - NumCast(left[key]);
                 const deltaLeft = this.time - NumCast(left.time);
@@ -306,7 +308,7 @@ export class Track extends React.Component<IProps> {
     onInnerDoubleClick = (e: React.MouseEvent) => {
         const inner = this._inner.current!;
         const offsetX = Math.round((e.clientX - inner.getBoundingClientRect().left) * this.props.transform.Scale);
-        this.createRegion(KeyframeFunc.convertPixelTime(offsetX, 'mili', 'time', this.props.tickSpacing, this.props.tickIncrement));
+        this.createRegion(RegionHelpers.convertPixelTime(offsetX, 'mili', 'time', this.props.tickSpacing, this.props.tickIncrement));
     };
 
     /**
@@ -316,10 +318,10 @@ export class Track extends React.Component<IProps> {
     createRegion = (time: number) => {
         if (this.findRegion(time) === undefined) {
             //check if there is a region where double clicking (prevents phantom regions)
-            const regiondata = KeyframeFunc.defaultKeyframe(); //create keyframe data
+            const regiondata = RegionHelpers.defaultKeyframe(); //create keyframe data
 
             regiondata.position = time; //set position
-            const rightRegion = KeyframeFunc.findAdjacentRegion(KeyframeFunc.Direction.right, regiondata, this.regions);
+            const rightRegion = RegionHelpers.findAdjacentRegion(RegionHelpers.Direction.right, regiondata, this.regions);
 
             if (rightRegion && rightRegion.position - regiondata.position <= 4000) {
                 //edge case when there is less than default 4000 duration space between this and right region
@@ -335,7 +337,7 @@ export class Track extends React.Component<IProps> {
     };
 
     @action
-    makeKeyData = (regiondata: RegionData, time: number, type: KeyframeFunc.KeyframeType = KeyframeFunc.KeyframeType.default) => {
+    makeKeyData = (regiondata: RegionData, time: number, type: RegionHelpers.KeyframeType = RegionHelpers.KeyframeType.default) => {
         //Kfpos is mouse offsetX, representing time
         const trackKeyFrames = DocListCast(regiondata.keyframes);
         const existingkf = trackKeyFrames.find(TK => TK.time === time);
@@ -359,16 +361,21 @@ export class Track extends React.Component<IProps> {
 
     @action
     copyDocDataToKeyFrame = (doc: Doc) => {
+        var somethingChanged = false;
         this.primitiveWhitelist.map(key => {
             const originalVal = this.props.animatedDoc[key];
-            doc[key] = originalVal instanceof ObjectField ? originalVal[Copy]() : originalVal;
+            somethingChanged = somethingChanged || originalVal !== doc[key];
+            if (doc.type === RegionHelpers.KeyframeType.end && key === 'opacity') doc.opacity = 0;
+            else doc[key] = originalVal instanceof ObjectField ? originalVal[Copy]() : originalVal;
         });
+        return somethingChanged;
     };
 
     /**
      * UI sstuff here. Not really much to change
      */
     render() {
+        const saveStateKf = this.saveStateKf;
         return (
             <div className="track-container">
                 <div className="track">
@@ -380,7 +387,7 @@ export class Track extends React.Component<IProps> {
                         onPointerOver={() => Doc.BrushDoc(this.props.animatedDoc)}
                         onPointerOut={() => Doc.UnBrushDoc(this.props.animatedDoc)}>
                         {this.regions?.map((region, i) => {
-                            return <Keyframe key={`${i}`} {...this.props} RegionData={region} makeKeyData={this.makeKeyData} />;
+                            return <Region key={`${i}`} {...this.props} saveStateKf={saveStateKf} RegionData={region} makeKeyData={this.makeKeyData} />;
                         })}
                     </div>
                 </div>
-- 
cgit v1.2.3-70-g09d2


From b2233984df663be6554c935fe9e40f4778237e67 Mon Sep 17 00:00:00 2001
From: bobzel <zzzman@gmail.com>
Date: Fri, 27 Oct 2023 10:23:21 -0400
Subject: removed async nonsense from tracks and regions.  added some comments.

---
 src/client/views/animationtimeline/Region.tsx   |  4 +--
 src/client/views/animationtimeline/Timeline.tsx |  9 ++++-
 src/client/views/animationtimeline/Track.tsx    | 47 +++++++++++++------------
 3 files changed, 34 insertions(+), 26 deletions(-)

(limited to 'src/client/views/animationtimeline/Track.tsx')

diff --git a/src/client/views/animationtimeline/Region.tsx b/src/client/views/animationtimeline/Region.tsx
index df00924c6..53c5c4718 100644
--- a/src/client/views/animationtimeline/Region.tsx
+++ b/src/client/views/animationtimeline/Region.tsx
@@ -313,7 +313,7 @@ export class Region extends React.Component<IProps> {
     };
 
     @action
-    createKeyframe = async (clientX: number) => {
+    createKeyframe = (clientX: number) => {
         this._mouseToggled = true;
         const bar = this._bar.current!;
         const offset = RegionHelpers.convertPixelTime(Math.round((clientX - bar.getBoundingClientRect().left) * this.props.transform.Scale), 'mili', 'time', this.props.tickSpacing, this.props.tickIncrement);
@@ -327,7 +327,7 @@ export class Region extends React.Component<IProps> {
     };
 
     @action
-    moveKeyframe = async (e: React.MouseEvent, kf: Doc) => {
+    moveKeyframe = (e: React.MouseEvent, kf: Doc) => {
         e.preventDefault();
         e.stopPropagation();
         this.props.changeCurrentBarX(RegionHelpers.convertPixelTime(NumCast(kf.time!), 'mili', 'pixel', this.props.tickSpacing, this.props.tickIncrement));
diff --git a/src/client/views/animationtimeline/Timeline.tsx b/src/client/views/animationtimeline/Timeline.tsx
index 3675238fd..71517d4fe 100644
--- a/src/client/views/animationtimeline/Timeline.tsx
+++ b/src/client/views/animationtimeline/Timeline.tsx
@@ -22,13 +22,20 @@ import { Track } from './Track';
  * 
  * The hierarchy works this way: 
  * 
- *              Timeline.tsx --> Track.tsx --> Region.tsx
+ *              Timeline.tsx --> Track.tsx --> Region.tsx 
                       |                              |
                       |                   TimelineMenu.tsx (timeline's custom contextmenu)
                       |
                       |
                 TimelineOverview.tsx (youtube like dragging thing is play mode, complex dragging thing in editing mode)
 
+                
+                Timeline (Track[])
+                      Track(Region[],animatedDoc)    ->   Region1(K[])    Region2 ... 
+                                                          F1 K1 K2...FL    K1 K2 K...
+                                                           K(x,y,_width,opacity)
+                      ...
+                      Track
 
     Most style changes are in SCSS file. 
     If you have any questions, email me or text me. 
diff --git a/src/client/views/animationtimeline/Track.tsx b/src/client/views/animationtimeline/Track.tsx
index 2fd062a88..b90ff5eaf 100644
--- a/src/client/views/animationtimeline/Track.tsx
+++ b/src/client/views/animationtimeline/Track.tsx
@@ -44,18 +44,19 @@ export class Track extends React.Component<IProps> {
         return NumCast(RegionHelpers.convertPixelTime(this.props.currentBarX, 'mili', 'time', this.props.tickSpacing, this.props.tickIncrement));
     }
 
-    async componentDidMount() {
-        const regions = await DocListCastAsync(this.props.animatedDoc.regions);
-        if (!regions) this.props.animatedDoc.regions = new List<Doc>(); //if there is no region, then create new doc to store stuff
-        //these two lines are exactly same from timeline.tsx
-        const relativeHeight = window.innerHeight / 20;
-        runInAction(() => (this._trackHeight = relativeHeight < this.MAX_TITLE_HEIGHT ? relativeHeight : this.MAX_TITLE_HEIGHT)); //for responsiveness
-        this._timelineVisibleReaction = this.timelineVisibleReaction();
-        this._currentBarXReaction = this.currentBarXReaction();
-        if (DocListCast(this.props.animatedDoc.regions).length === 0) this.createRegion(this.time);
-        this.props.animatedDoc.hidden = false;
-        this.props.animatedDoc.opacity = 1;
-        // this.autoCreateKeyframe();
+    componentDidMount() {
+        DocListCastAsync(this.props.animatedDoc.regions).then(regions => {
+            if (!regions) this.props.animatedDoc.regions = new List<Doc>(); //if there is no region, then create new doc to store stuff
+            //these two lines are exactly same from timeline.tsx
+            const relativeHeight = window.innerHeight / 20;
+            runInAction(() => (this._trackHeight = relativeHeight < this.MAX_TITLE_HEIGHT ? relativeHeight : this.MAX_TITLE_HEIGHT)); //for responsiveness
+            this._timelineVisibleReaction = this.timelineVisibleReaction();
+            this._currentBarXReaction = this.currentBarXReaction();
+            if (DocListCast(this.props.animatedDoc.regions).length === 0) this.createRegion(this.time);
+            this.props.animatedDoc.hidden = false;
+            this.props.animatedDoc.opacity = 1;
+            // this.autoCreateKeyframe();
+        });
     }
 
     /**
@@ -86,7 +87,7 @@ export class Track extends React.Component<IProps> {
      *
      */
     @action
-    saveKeyframe = async () => {
+    saveKeyframe = () => {
         if (this.props.timeline.IsPlaying || !this.saveStateRegion || !this.saveStateKf) {
             this.saveStateKf = undefined;
             this.saveStateRegion = undefined;
@@ -223,23 +224,23 @@ export class Track extends React.Component<IProps> {
      * when scrubber position changes. Need to edit the logic
      */
     @action
-    timeChange = async () => {
+    timeChange = () => {
         if (this.saveStateKf !== undefined || this._newKeyframe) {
-            await this.saveKeyframe();
+            this.saveKeyframe();
         }
-        const regiondata = await this.findRegion(Math.round(this.time)); //finds a region that the scrubber is on
+        const regiondata = this.findRegion(Math.round(this.time)); //finds a region that the scrubber is on
         if (regiondata) {
-            const leftkf: Doc | undefined = await RegionHelpers.calcMinLeft(regiondata, this.time); // lef keyframe, if it exists
-            const rightkf: Doc | undefined = await RegionHelpers.calcMinRight(regiondata, this.time); //right keyframe, if it exists
-            const currentkf: Doc | undefined = await this.calcCurrent(regiondata); //if the scrubber is on top of the keyframe
+            const leftkf: Doc | undefined = RegionHelpers.calcMinLeft(regiondata, this.time); // lef keyframe, if it exists
+            const rightkf: Doc | undefined = RegionHelpers.calcMinRight(regiondata, this.time); //right keyframe, if it exists
+            const currentkf: Doc | undefined = this.calcCurrent(regiondata); //if the scrubber is on top of the keyframe
             if (currentkf) {
-                await this.applyKeys(currentkf);
+                this.applyKeys(currentkf);
                 runInAction(() => {
                     this.saveStateKf = currentkf;
                     this.saveStateRegion = regiondata;
                 });
             } else if (leftkf && rightkf) {
-                await this.interpolate(leftkf, rightkf);
+                this.interpolate(leftkf, rightkf);
             }
         }
     };
@@ -249,7 +250,7 @@ export class Track extends React.Component<IProps> {
      * need to change the logic here
      */
     @action
-    private applyKeys = async (kf: Doc) => {
+    private applyKeys = (kf: Doc) => {
         this.primitiveWhitelist.forEach(key => {
             if (!kf[key]) {
                 this.props.animatedDoc[key] = undefined;
@@ -277,7 +278,7 @@ export class Track extends React.Component<IProps> {
      * basic linear interpolation function
      */
     @action
-    interpolate = async (left: Doc, right: Doc) => {
+    interpolate = (left: Doc, right: Doc) => {
         this.primitiveWhitelist.forEach(key => {
             if (typeof left[key] === 'number' && typeof right[key] === 'number') {
                 //if it is number, interpolate
-- 
cgit v1.2.3-70-g09d2


From a866baea5fdbf30650cbfbf4aa383019ef61ec3d Mon Sep 17 00:00:00 2001
From: bobzel <zzzman@gmail.com>
Date: Fri, 27 Oct 2023 13:39:04 -0400
Subject: added collection itself to timeline

---
 src/client/views/animationtimeline/Timeline.tsx | 14 +++-----------
 src/client/views/animationtimeline/Track.tsx    |  2 +-
 src/client/views/nodes/DocumentView.tsx         |  2 +-
 3 files changed, 5 insertions(+), 13 deletions(-)

(limited to 'src/client/views/animationtimeline/Track.tsx')

diff --git a/src/client/views/animationtimeline/Timeline.tsx b/src/client/views/animationtimeline/Timeline.tsx
index 71517d4fe..4be3b05ab 100644
--- a/src/client/views/animationtimeline/Timeline.tsx
+++ b/src/client/views/animationtimeline/Timeline.tsx
@@ -543,7 +543,7 @@ export class Timeline extends React.Component<FieldViewProps> {
                                 <div key="timeline_scrubberhead" className="scrubberhead" onPointerDown={this.onScrubberDown}></div>
                             </div>
                             <div key="timeline_trackbox" className="trackbox" ref={this._trackbox} style={{ width: `${this._totalLength}px` }}>
-                                {this.children.map(doc => (
+                                {[...this.children, this.props.Document].map(doc => (
                                     <Track
                                         ref={ref => this.mapOfTracks.push(ref)}
                                         timeline={this}
@@ -562,16 +562,8 @@ export class Timeline extends React.Component<FieldViewProps> {
                         </div>
                         <div className="currentTime">Current: {this.getCurrentTime()}</div>
                         <div key="timeline_title" className="title-container" ref={this._titleContainer}>
-                            {this.children.map(doc => (
-                                <div
-                                    style={{ height: `${this._titleHeight}px` }}
-                                    className="datapane"
-                                    onPointerOver={() => {
-                                        Doc.BrushDoc(doc);
-                                    }}
-                                    onPointerOut={() => {
-                                        Doc.UnBrushDoc(doc);
-                                    }}>
+                            {[...this.children, this.props.Document].map(doc => (
+                                <div style={{ height: `${this._titleHeight}px` }} className="datapane" onPointerOver={() => Doc.BrushDoc(doc)} onPointerOut={() => Doc.UnBrushDoc(doc)}>
                                     <p>{StrCast(doc.title)}</p>
                                 </div>
                             ))}
diff --git a/src/client/views/animationtimeline/Track.tsx b/src/client/views/animationtimeline/Track.tsx
index b90ff5eaf..dfab849a4 100644
--- a/src/client/views/animationtimeline/Track.tsx
+++ b/src/client/views/animationtimeline/Track.tsx
@@ -34,7 +34,7 @@ export class Track extends React.Component<IProps> {
     @observable private _newKeyframe: boolean = false;
     private readonly MAX_TITLE_HEIGHT = 75;
     @observable private _trackHeight = 0;
-    private primitiveWhitelist = ['x', 'y', '_width', '_height', '_rotation', 'opacity', '_layout_scrollTop'];
+    private primitiveWhitelist = ['x', 'y', '_freeform_panX', '_freeform_panY', '_width', '_height', '_rotation', 'opacity', '_layout_scrollTop'];
     private objectWhitelist = ['data'];
 
     @computed private get regions() {
diff --git a/src/client/views/nodes/DocumentView.tsx b/src/client/views/nodes/DocumentView.tsx
index 4a43ffe3e..43be4b724 100644
--- a/src/client/views/nodes/DocumentView.tsx
+++ b/src/client/views/nodes/DocumentView.tsx
@@ -1312,7 +1312,7 @@ export class DocumentViewInternal extends DocComponent<DocumentViewInternalProps
                     pointerEvents: this.pointerEvents === 'visiblePainted' ? 'none' : this.pointerEvents,
                 }}>
                 <>
-                    {DocumentViewInternal.AnimationEffect(renderDoc, this.rootDoc[Animation], this.rootDoc)}
+                    {this._componentView instanceof KeyValueBox ? renderDoc : DocumentViewInternal.AnimationEffect(renderDoc, this.rootDoc[Animation], this.rootDoc)}
                     {borderPath?.jsx}
                 </>
             </div>
-- 
cgit v1.2.3-70-g09d2


From 7e01a1fdad85e5aa3d73f166b7663d34337bb040 Mon Sep 17 00:00:00 2001
From: bobzel <zzzman@gmail.com>
Date: Fri, 27 Oct 2023 13:51:34 -0400
Subject: from last

---
 src/client/views/animationtimeline/Track.tsx | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

(limited to 'src/client/views/animationtimeline/Track.tsx')

diff --git a/src/client/views/animationtimeline/Track.tsx b/src/client/views/animationtimeline/Track.tsx
index dfab849a4..f36b5ade8 100644
--- a/src/client/views/animationtimeline/Track.tsx
+++ b/src/client/views/animationtimeline/Track.tsx
@@ -181,7 +181,7 @@ export class Track extends React.Component<IProps> {
                     this.timeChange();
                 } else {
                     this.props.animatedDoc.hidden = true;
-                    this.props.animatedDoc.opacity = 0;
+                    this.props.animatedDoc !== this.props.collection && (this.props.animatedDoc.opacity = 0);
                     //if (this._autoKfReaction) this._autoKfReaction();
                 }
             }
@@ -280,6 +280,9 @@ export class Track extends React.Component<IProps> {
     @action
     interpolate = (left: Doc, right: Doc) => {
         this.primitiveWhitelist.forEach(key => {
+            if (key === 'opacity' && this.props.animatedDoc === this.props.collection) {
+                return;
+            }
             if (typeof left[key] === 'number' && typeof right[key] === 'number') {
                 //if it is number, interpolate
                 const dif = NumCast(right[key]) - NumCast(left[key]);
-- 
cgit v1.2.3-70-g09d2

