File tree Expand file tree Collapse file tree
packages/data-structure/src/data-structures/array-bar Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ export const Chart: FC = () => {
2121 }
2222 const arrayBar = new ArrayBar < number > ( [ ...schema . structures [ 0 ] . array ] , {
2323 id : schema . structures [ 0 ] . id ,
24- interval : 300 ,
24+ interval : 1000 ,
2525 structure : { } ,
2626 } ) ;
2727 schema . actions . forEach ( ( action ) => {
@@ -35,6 +35,9 @@ export const Chart: FC = () => {
3535 if ( action . type === 'appear' ) {
3636 arrayBar . appear ( ) ;
3737 }
38+ if ( action . type === 'reverse' ) {
39+ arrayBar . reverse ( ) ;
40+ }
3841 }
3942 } ) ;
4043
Original file line number Diff line number Diff line change @@ -106,6 +106,30 @@ export class ArrayBar<T> {
106106 } ) ;
107107 }
108108
109+ reverse ( ) {
110+ this . _data = this . _data . reverse ( ) ;
111+ const id = this . _id ;
112+ const dataId = this . _dataId ;
113+ const interval = this . _interval ;
114+ const length = this . _actions . length ;
115+ const action = {
116+ action : "update" ,
117+ startTime : interval * length ,
118+ payload : {
119+ id : dataId ,
120+ animation : {
121+ duration : interval ,
122+ } ,
123+ values : cloneDeep ( this . _data ) ,
124+ } ,
125+ } ;
126+ this . _actions . push ( {
127+ characterId : id ,
128+ characterActions : [ action ] ,
129+ } ) ;
130+ return this ;
131+ }
132+
109133 appear ( ) {
110134 this . _actions . push ( {
111135 characterId : this . _id ,
You can’t perform that action at this time.
0 commit comments