1- import { NgIf } from '@angular/common' ;
1+ import { NgIf , NgTemplateOutlet } from '@angular/common' ;
22import { CUSTOM_ELEMENTS_SCHEMA , Component , Input , effect , signal , type Signal } from '@angular/core' ;
33import { NgtArgs } from 'angular-three' ;
44import { injectNgtsGLTFLoader , type NgtsGLTF } from 'angular-three-soba/loaders' ;
@@ -24,16 +24,18 @@ type YBotGLTF = NgtsGLTF<{
2424 <ngt-group *ngIf="yBotGltf() as yBot" [dispose]="null" [position]="[0, -1, 0]" [ref]="animations.ref">
2525 <ngt-group [rotation]="[Math.PI / 2, 0, 0]" [scale]="0.01">
2626 <ngt-primitive *args="[yBot.nodes.mixamorigHips]" />
27- <ngt-skinned-mesh [geometry]="yBot.nodes.YB_Body.geometry" [skeleton]="yBot.nodes.YB_Body.skeleton">
28- <ngt-mesh-matcap-material [matcap]="matcapBody.texture()" [skinning]="true" />
29- </ngt-skinned-mesh>
30- <ngt-skinned-mesh [geometry]="yBot.nodes.YB_Joints.geometry" [skeleton]="yBot.nodes.YB_Joints.skeleton">
31- <ngt-mesh-matcap-material [matcap]="matcapJoints.texture()" [skinning]="true" />
32- </ngt-skinned-mesh>
27+ <ng-container *ngTemplateOutlet="skin; context: { matcap: matcapBody, yb: yBot.nodes.YB_Body }" />
28+ <ng-container *ngTemplateOutlet="skin; context: { matcap: matcapJoints, yb: yBot.nodes.YB_Joints }" />
3329 </ngt-group>
3430 </ngt-group>
31+
32+ <ng-template #skin let-matcap="matcap" let-yb="yb">
33+ <ngt-skinned-mesh [geometry]="yb.geometry" [skeleton]="yb.skeleton">
34+ <ngt-mesh-matcap-material [matcap]="matcap.texture()" [skinning]="true" />
35+ </ngt-skinned-mesh>
36+ </ng-template>
3537 ` ,
36- imports : [ NgtArgs , NgIf ] ,
38+ imports : [ NgtArgs , NgIf , NgTemplateOutlet ] ,
3739 schemas : [ CUSTOM_ELEMENTS_SCHEMA ] ,
3840} )
3941class DefaultAnimationsStory {
0 commit comments