@@ -23,15 +23,15 @@ function generateAnimations({ element }) {
23
23
} else {
24
24
for ( let elem of pathElements ) {
25
25
// console.log('animate', elem);
26
- switch ( elem . type ) {
26
+ switch ( elem . element . type ) {
27
27
case 'userInput' :
28
- generateUserInputAnimation ( elem ) ;
28
+ generateUserInputAnimation ( elem . element ) ;
29
29
break ;
30
30
case 'lut' :
31
- generateLUTAnimation ( elem ) ;
31
+ generateLUTAnimation ( elem . element ) ;
32
32
break ;
33
33
case 'DFF' :
34
- generateDFFAnimation ( elem ) ;
34
+ generateDFFAnimation ( elem . element ) ;
35
35
break ;
36
36
37
37
default :
@@ -99,7 +99,7 @@ async function move(element, distances) {
99
99
if ( index >= steps . length ) return ;
100
100
101
101
element . animate ( [ steps [ index ] ] , {
102
- duration : speedValue ,
102
+ duration : speedValue / speedLevelsInt [ currentSpeedIndex ] ,
103
103
fill : 'forwards'
104
104
} ) . onfinish = ( ) => {
105
105
// Apply styles to maintain position
@@ -150,9 +150,9 @@ async function animatePath(i) {
150
150
}
151
151
152
152
if ( isPaused ) return ;
153
-
154
- let type = pathElements [ i ] . type ;
155
- let id = pathElements [ i ] . id ;
153
+ let type = pathElements [ i ] . element . type ;
154
+ let id = pathElements [ i ] . element . id ;
155
+ console . log ( 'type :' , type , ' id :' , id ) ;
156
156
if ( type == "DFF" ) type = "ff" ;
157
157
158
158
let elem = document . getElementById ( `animation-${ type } -${ id } ` ) ;
@@ -167,10 +167,13 @@ async function animatePath(i) {
167
167
let wiresLength = wire4 != null
168
168
? ( wire5 != null ? 5 : 4 )
169
169
: 3 ;
170
+
171
+ speedValue = pathElements [ i ] . Timing != null ? pathElements [ i ] . Timing * 5 / wiresLength : 2000 ;
170
172
171
173
animateElement ( elem , [ wire1 , wire2 , wire3 , wire4 , wire5 ] ) ;
172
174
173
175
setTimeout ( ( ) => {
176
+ console . log ( 'element' , pathElements [ i ] ) ;
174
177
if ( i < pathElements . length - 2 ) {
175
178
elem . remove ( ) ;
176
179
generateAnimations ( { element : elem } ) ;
@@ -181,5 +184,5 @@ async function animatePath(i) {
181
184
play . firstChild . className = 'fa-solid top-bar fa-circle-play' ;
182
185
isPaused = true ;
183
186
}
184
- } , wiresLength * speedValue ) ;
187
+ } , speedValue * wiresLength / speedLevelsInt [ currentSpeedIndex ] ) ;
185
188
}
0 commit comments