> For the complete documentation index, see [llms.txt](https://frangiordano96.gitbook.io/ae-expressions/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://frangiordano96.gitbook.io/ae-expressions/quick-tips/after-effects-dynamic-shadows.md).

# After Effects - Dynamic Shadows

Full Tutorial:

{% embed url="<https://www.youtube.com/watch?v=D6o22WoLkTw&t=>" %}

Code for Slant value:

```javascript
function getWorldPos(theLayerName){
  var L = thisComp.layer(theLayerName);
  return L.toWorld(L.anchorPoint);
}

var lightPos = thisComp.layer("LIGHT").transform.position;
var myWorldPos = getWorldPos(name);
var xDistance = myWorldPos[0] - lightPos[0];

linear(xDistance, -thisComp.width, thisComp.width, 200, -200);
```

Code for Height value:

```javascript
function getWorldPos(theLayerName){
  var L = thisComp.layer(theLayerName);
  return L.toWorld(L.anchorPoint);
}

var lightPos = thisComp.layer("LIGHT").transform.position;
var myWorldPos = getWorldPos(name);
var yDistance = myWorldPos[1] - lightPos[1];

linear(yDistance, 0, thisComp.height, 100, 0);
```

Code for Floor value:

```javascript
toWorld(anchorPoint);
```
