Search code examples
spark-ar-studio

Effect preview on different devices


Does the device selected in Spark AR Studio simulator affect the generated Instagram test links?

As I see, test links look different on Instagram camera depending on what device is selected in the simulator, but I am not sure as I do some rectangle calculations in script according to device width and height. These calculations work fine in Studio on app restart, but not on Instagram camera on app start.


Solution

  • So I've found a solution. My mistake was to get screen sizes in script from canvas with .pinLastValue().
    But it should be done with Patches module and Device Info to script bridging.

    Spark Ar Screenshot

    const screenSize = await Patches.outputs.getPoint2D('screenSize');
    const screenScale = await Patches.outputs.getScalar('screenScale');
    const scale = screenScale.pinLastValue();
    const screenX = screenSize.x.pinLastValue();
    const screenY = screenSize.y.pinLastValue();