scenejs icon indicating copy to clipboard operation
scenejs copied to clipboard

how to update keyframes? i try to use this way to update keyframes,but it is no change?

Open qikong333 opened this issue 5 years ago • 3 comments

html

<div class="wrapper">
  <div class="circle-area">
    <ngx-scene
      #scene
      [keyframes]="keyframes2"
      fillMode="forwards"
      easing="ease-in-out"
      (sceneAnimate)="onAnimate($event)"
      (scenePlay)="onPlay($event)"
      (scenePaused)="onPaused($event)"
    >
      <div class="circles">
        <div class="circle circle1"></div>
        <div class="circle circle2"></div>
        <div class="circle circle3"></div>
      </div>
    </ngx-scene>
    <div class="player">
      <div [class]="playState" (click)="onClick()"></div>
      <input
        class="progress"
        type="range"
        [value]="time"
        min="0"
        max="100"
        (input)="onInput($event)"
      />
    </div>
  </div>
</div>

ts

keyframes2 = {};
 
 ngAfterViewInit() {
   this.keyframes2 = {
     item1: {
       0: {
         display: 'none',
       },
       1: {
         display: 'block',
         opacity: 0,
       },
       2: {
         opacity: 1,
       },
     },
     item2: {
       2: {
         opacity: 1,
       },
     },
   };
  
   const tl = new Timeline(this.scene.getItem(), this.timeline.nativeElement, {
     keyboard: true,
   });
   tl.on('select', (e: SelectEvent) => {
     console.log(e.selectedItem);
   });

 }
 }

image

I try to use this way to update keyframes,but it is no change?

qikong333 avatar May 15 '20 09:05 qikong333

ngAfterViewInit() {
    const frame = {
      item1: {
        0: {
          display: 'none',
        },
        1: {
          display: 'block',
          opacity: 0,
        },
        2: {
          opacity: 1,
        },
      },
      item2: {
        2: {
          opacity: 1,
        },
      },
    };
    const a = this.scene.getItem();
    a.set(frame);
    console.log(a);
}

is it right? This way can change it

image

qikong333 avatar May 15 '20 09:05 qikong333

@qikong333

Oh sorry. The scenejs for the framework can only be set at the init.

You have to do it like you did.

daybrush avatar May 15 '20 12:05 daybrush

@qikong333

Oh sorry. The scenejs for the framework can only be set at the init.

You have to do it like you did.

ok ,thinks

qikong333 avatar May 17 '20 00:05 qikong333