Description
let po = this . model . toModelPosition ( new PIXI . Point ( offsetX , offsetY ) ) ,
hitAreas ;
if ( Object . keys ( this . model . internalModel . hitAreas ) . length == 0 ) {
hitAreas = this . hitTest ( po . x , po . y ) ;
if ( hitAreas . includes ( "TouchHead" ) ) {
this . model . internalModel . motionManager . startMotion (
"" ,
motionIndex [ 0 ]
) ;
} else if ( hitAreas . includes ( "TouchSpecial" ) ) {
this . model . internalModel . motionManager . startMotion (
"" ,
motionIndex [ 1 ]
) ;
} else if ( hitAreas . includes ( "TouchBody" ) ) {
this . model . internalModel . motionManager . startMotion (
"" ,
motionIndex [ 2 ]
) ;
} else {
this . model . internalModel . motionManager . startRandomMotion ( "" ) ;
}
} else {
hitAreas = this . model . internalModel . hitTest ( po . x , po . y ) ;
if ( hitAreas . includes ( "head" ) || hitAreas . includes ( "Head" ) ) {
this . model . expression ( ) ;
this . model . motion ( "Tap" ) ;
} else if ( hitAreas . includes ( "body" ) || hitAreas . includes ( "Body" ) ) {
this . model . motion ( "tap_body" ) ;
this . model . motion ( "Tap" ) ;
} else this . model . motion ( "Tap" ) ;
}
console . log ( "Start motion: " , hitAreas . join ( " / " ) ) ;
这块的逻辑虽然并不乱, 但是不是很优雅灵活
Reactions are currently unavailable
You can’t perform that action at this time.
Live2dLoader/src/Live2dLoader.js
Lines 176 to 209 in 15424bc
这块的逻辑虽然并不乱, 但是不是很优雅灵活