From: "Lloyd Alvarez" Received: from aescripts.com ([162.252.107.88] verified) by media-motion.tv (CommuniGate Pro SMTP 6.1.0) with ESMTPS id 6451137 for AE-List@media-motion.tv; Wed, 16 May 2018 14:05:55 +0200 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=aescripts.com; s=dkim; h=Content-Type:To:Subject:Message-ID:Date:From: In-Reply-To:References:MIME-Version:Sender:Reply-To:Cc: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=Kj8jnlQqZAL0+qKS6W/YE/1WcyTaV2izLBKrB719g00=; b=eDIkKOmUmNisd/sdG/Z/EN/7g ew1IIvsZnlDM/YjfV9EnAPCic7gIqKokqPDHbbLQMjZwkS7bvrILGlj4OQFmTlYS7nP3BSSG7dA/e vhSVJHkuHMTaDG1c33x4iNZWQjl2zJms4cUX2VbtrDZwci7sQKpe0sRtOIIE3UPC5EReY6YOaDBBx ixnQpYNgbc09ZxxceHpanK5tMrJmABltWPB9a3Yg1WcApUM+lf40qcmB6XbJgrb+Jlse3GRi21ZFz oY1QyraLm1cHbVmp1kiosKtsbcKXoqMTaJhmXFDNEWtT85sXwMNelDudhA9Lmn3bRh8a326PyCIlt fjL+vZvRQ==; Received: from mail-ua0-f172.google.com ([209.85.217.172]) by aescriptsmhm.magemojo.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.90_1) (envelope-from ) id 1fIvI9-000N9H-Kz for AE-List@media-motion.tv; Wed, 16 May 2018 12:12:25 +0000 Received: by mail-ua0-f172.google.com with SMTP id a2-v6so354390uak.2 for ; Wed, 16 May 2018 05:12:25 -0700 (PDT) X-Gm-Message-State: ALKqPwe9d6CbfoutVsVSLFSFhXJrH3qHrzpMGup/FfmjMjlU2Dow2MOC H1QkQN2MrrMeyWrpKnIMA91rQhMPwk1iohn8x9w= X-Google-Smtp-Source: AB8JxZowVMp4xR1BsTR7PdRZHuSKipO9oyg+RRy3lDaHq3lQHnqX6LOFUyPSH3n9GOKpf1xuVz2NtW65yZ4UnHqKvow= X-Received: by 2002:a9f:2466:: with SMTP id 93-v6mr548597uaq.173.1526472740455; Wed, 16 May 2018 05:12:20 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Wed, 16 May 2018 08:12:08 -0400 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [AE] SourceRectAtTime on 3D layers To: After Effects Mail List Content-Type: multipart/alternative; boundary="000000000000744aa5056c51a177" --000000000000744aa5056c51a177 Content-Type: text/plain; charset="UTF-8" Check out this tutorial: https://aescripts.com/learn/after-effects-expressions-nerd-tip-2-tocomp-and-fromcomp--1-minute-tutorial-/ Cheers Lloyd On Wed, May 16, 2018 at 8:04 AM Byron Nash wrote: > I was beating my head against the wall trying to figure out why my > sourcerectattime expression wasn't accurate and then I noticed that it > doesn't take into account the 3D position. I found a forum post related to > this with a possible solution from Dan, but the original post wasn't > exactly my issue so I wanted to make sure there wasn't a simpler solution > to getting the screen space of a 3D layer. > > Dan's expression from the post I found. > --- > Common to position and scale expressions: > > L=thisComp.layer("3d layer"); > R=L.sourceRectAtTime(time,false); > UL = L.toComp([R.left,R.top]); > UR = L.toComp([R.left+R.width,R.top]); > LR = L.toComp([R.left+R.width,R.top+R.height]); > LL = L.toComp([R.left,R.top+R.height]); > maxX = Math.max(UL[0],UR[0],LR[0],LL[0]); > minX = Math.min(UL[0],UR[0],LR[0],LL[0]); > maxY = Math.max(UL[1],UR[1],LR[1],LL[1]); > minY = Math.min(UL[1],UR[1],LR[1],LL[1]); > > Add this for position: > > [maxX+minX,maxY+minY]/2; > > Add this for scale: > > w = maxX - minX; > h = maxY - minY; > [(w/width),h/height]*100 > > > Dan > --- > -- Cheers, Lloyd --000000000000744aa5056c51a177 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Check out this tutorial:

=

=
Cheers
Lloyd


On Wed, May 16, 2018 at 8:0= 4 AM Byron Nash <AE-List@medi= a-motion.tv> wrote:
I w= as beating my head against the wall trying to figure out why my sourcerecta= ttime expression wasn't accurate and then I noticed that it doesn't= take into account the 3D position. I found a forum post related to this wi= th a possible solution from Dan, but the original post wasn't exactly m= y issue so I wanted to make sure there wasn't a simpler solution to get= ting the screen space of a 3D layer.=C2=A0

Dan's exp= ression from the post I found.=C2=A0
---
Common to position and scale expressions:

L=3DthisComp.lay= er("3d layer");
R=3DL.sourceRectAtTime(time,false);
UL =3D L.toComp([R.left,R.top]);
UR =3D L.toComp([R.left+R.width,R.top= ]);
LR =3D L.toComp= ([R.left+R.width,R.top+R.height]);
LL =3D L.toComp([R.left,R.top+R.height]);
maxX =3D Math.max(UL[0],UR[0],LR[0= ],LL[0]);
minX =3D = Math.min(UL[0],UR[0],LR[0],LL[0]);
maxY =3D Math.max(UL[1],UR[1],LR[1],LL[1]);
minY =3D Math.min(UL[1],UR[1],LR[1= ],LL[1]);

Add this for position:

[maxX+minX,maxY+minY]/2;<= br style=3D"font-family:myriad-pro,sans-serif;font-size:16.8px;background-c= olor:rgb(245,245,245)">
Ad= d this for scale:

w =3D maxX - minX;
h =3D maxY - minY;
[(w/width),h/height]*100


Cheers, Lloyd
--000000000000744aa5056c51a177--