Adding a shadow to a frame via a plugin

Based on the plugin Effect API page, I would assume this is the right format for assigning an drop shadow to a node:

newFrame.effects = [{
type: “DROP_SHADOW”,
color: {r: 0, g: 0, b: 0, a: 1},
offset: { x: 0, y: 4},
radius: 4,

Unfortunately it fails silently. Anyone know how to do this properly?

Also, for any Figma team members out there, would be great to:

  • Get an error that highlights the malformed property causing this to fail
  • Have an example on the API page

Add all required properties (including blendMode, visible).

You should see errors in the console.

Hey @tank666, thanks!

I didn’t notice the ? syntax on the variable names. That fixed it! :raised_hands:

Notes to the Figma team:

  • Why are properties like visible and blendMode not given very obvious defaults of true and NORMAL respectively? The blendMode description even says, "The typical default value is “NORMAL”.
  • Showing an error for what’s missing would be amazing!
  • Stating required in plain text in the description would be way harder to miss.

Oops. Was missing the error amongst other noise.