EriKWDev / nanim

Nanim is an easy-to-use framework to create smooth GPU-accelerated animations that can be previewed live inside a glfw window and, when ready, rendered to videos at an arbitrary resolution and framerate.
MIT License
118 stars 3 forks source link

Fading fades everything, should only fade the specified Entity. #18

Open EriKWDev opened 2 years ago

EriKWDev commented 2 years ago

Example:

import nanim

proc myScene(): Scene =
  let
    scene = newScene()
    dot1 = newDot(100)
    dot2 = newDot(100)

  scene.add(dot1, dot2)

  dot1.moveTo(200, 500)
  dot2.moveTo(800, 500)

  scene.play(dot1.fadeOut())
  scene.play(dot2.fadeOut())

  return scene

when isMainModule:
  render(myScene)

I expect first dot1 to fadeOut, then dot2 to follow. Currently, both fades out at the same time: fade

EriKWDev commented 2 years ago

Found it.

in init(entity: Entity) I use the defaultStyle, which for some reason causes it to be mutated within the interpolations. By changing it to be defaultStlye.deepCopy() in the initialization this is fixed. Will be included in next version bump.