+
Skip to content

lottie: issue with adding an expression via slots (dotlottie) #3693

@theashraf

Description

@theashraf

The following expression is supposed to make rect2 rotate to face rect1 while it’s moving. It works correctly in lottie-web, but it’s not working in thorvg.

"slots": {
  "rect2_rotate": {
    "p": {
      "a": 0,
      "x": "var $bm_rt;\nvar rect1 = thisComp.layer('Rectangle 1');\nvar rect2 = thisComp.layer('Rectangle 2');\nvar rect1Pos = rect1.transform.position.value;\nvar rect2Pos = rect2.transform.position.value;\nvar dx = rect1Pos[0] - rect2Pos[0];\nvar dy = rect1Pos[1] - rect2Pos[1];\n$bm_rt = Math.atan2(dy, dx) * 180 / Math.PI;"
    }
  }
}

I’ve attached the Lottie file for your reference.

Main Scene (1).json

Screen.Recording.2025-08-06.at.6.16.15.PM.mov

Metadata

Metadata

Assignees

Labels

bugSomething isn't workinglottieLottie animation

Type

No type

Projects

Status

Done 1.0

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载