npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

sparkar-autofit

v0.3.3

Published

A Spark AR tool that keeps the texture of object in correct ratio.

Downloads

6

Readme

Autofit

indexAutofit is a Spark AR utility to make object's texture keep in correct ratio.

Both Patch and Script version are included.

You can also Click Here to Download Sample Projects. The PickerHandler in script-usage demo projects is not necessary, it's just used to assist in demo.

For Patch Editor

Install

  1. Download Autofit.arp

  2. Drag/Drop or import it to Spark AR

Usage

image-20200524193954384

Input

| Value | Type | Description | | ---------------- | ------- | ------------------------------------------------------------ | | Plane Scale | Vector2 | Generally is the the scale of a **plane'**s transform, or scale of rectangle. | | Texture Size | Vector2 | The Dimensions value of input texture. Find the value and fill it manually. | | Texture | Texture | 🖼️ | | Expand / Shrink | Boolean | If true, the mode is Expand. If false, the mode is Shrink. | | Background Color | Color | The background color is filled in the empty space in ENVELOPE mode. |

Output

| Value | Type | Description | | ------ | ------- | ------------------------------------------------ | | Output | Texture | The result can be used in material texture slot. | | UV | Vector2 | The scaled UV. |

For Script

Import

  1. Download Autofit.js (Right click and Save as)

  2. Drag/Drop or import it to Spark AR.

  3. Load in the required module.

    const Autofit = require('./Autofit');
    // Your script...

npm

  1. Add package with yarn or npm.

    yarn add sparkar-autofit

    or

    npm i sparkar-autofit
  2. Load in the required module.

    const Autofit = require('sparkar-autofit');
    // Your script...

Usage

const Scene = require('Scene');
const Autofit = require('./Autofit');

Scene.root.findFirst('plane0').then(plane0 =>
   Autofit.fitTexture(plane0, Autofit.TextureScaleMode.FIT))
);

Scene.root.findFirst('plane0').then(plane0 =>
   Autofit.fitObject(plane0, Autofit.ObjectScaleMode.BASED_ON_HEIGHT))
);

Reference

Autofit

| Method | Description | | ------------------------------------------------------------ | ------------------------------------------------------------ | | fitTexture(sceneObject: SceneObjectBase, scaleMode: Autofit.TextureScaleMode, backgroundColor: Point4DSignal): Promise<void> | Fit object's texture scale in ratio. | | getFitTextureUV(sceneObject: SceneObjectBase, scaleMode: Autofit.TextureScaleMode): Promise<ScaleSignal> | Get the ScaleSignal that for object to fit scale by texture's ratio. | | fitObject(sceneObject: SceneObjectBase, scaleMode: Autofit.ObjectScaleMode): Promise<void> | Fit object's scale by texture's ratio. | | getFitObjectScale(sceneObject: SceneObjectBase, scaleMode: Autofit.ObjectScaleMode): Promise<ScaleSignal> | Get the ScaleSignal that for object to fit scale by texture's ratio. |

Autofit.ObjectScaleMode

| Value | Description | | ---------- | --------- | | BASED_ON_HEIGHT | Scale based on height mode. | | BASED_ON_WIDTH | Scale based on width mode. | | BASED_ON_1024 | Scale based on resolution 1024 mode. |

Autofit.TextureScaleMode

| Value | Description | | ---------- | --------- | | Expand | Scale in expand mode. | | Shrink | Scale in shrink mode. | | Stretch | Scale in strech mode. |

Donations

If this is useful for you, please consider a donation🙏🏼. One-time donations can be made with PayPal.