feat: z distance scaling for text node

This commit is contained in:
cha0s 2019-04-19 03:12:30 -05:00
parent d5a9fb1fd8
commit b9e3f76750

View File

@ -43,10 +43,11 @@ export class TextNode {
position[1] += realOffset[1];
}
const angle = rotation.x / (Math.PI * 2);
const distanceScale = particle.p.z > 0 ? particle.p.z / 70 : 0;
div.style.transform = `
translate(${position[0]}px, ${-position[1]}px)
rotate(${angle * 360}deg)
scale(${scale})
scale(${scale + distanceScale})
`;
const spanTranslate = 50 * (1 / scale);
span.style.transform = `translate(-${spanTranslate}%, -${spanTranslate}%)`;