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-picker-handler

v0.7.1

Published

A wrapper of NativeUI.picker in Spark AR

Downloads

4

Readme

PickerHandler

PickerHandler is a wrapper of NativeUI.picker in Spark AR. Please note that this tool is Script Only. Although there is a sample project show how to use this tool with Patch Editor, this libaray is not Patch friendly.

Install

Import

  1. Download PickerHandler (Right click and Save as)

  2. Drap/Import them to Assets caetgory in Spark AR.

  3. Use require to import this module at the top of your script.

    const Picker = require('./PickerHandler');
       
    // Your script...
  4. You can also Click Here to Download Sample Projects.

npm

  1. Add package with yarn or npm

    yarn add sparkar-picker-handler

    or

    npm i sparkar-picker-handler
  2. Use require to import this module

    const Picker = require('sparkar-picker-handler');
    // Your script...

Usage

// Picker.configUsingPattern('img_picker_*').then(subscribeFunctions);
// Picker.configUsingNames(['img_picker_0', 'img_picker_1']).then(subscribeFunctions);
Picker.configUsingDafault().then(subscribeFunctions);

function subscribeFunctions() {
    Picker.subscribeKeywords('0', () => Diagnostics.log('select img_picker_0'));
    Picker.subscribeKeywords('1', () => Diagnostics.log('select img_picker_1'));

    Picker.subscribeIndex(0, () => Diagnostics.log('select picker index 0'));
    Picker.subscribeIndex(1, () => Diagnostics.log('select picker index 1'));

    Picker.subscribeKeywords('picker', ind => Diagnostics.log(`cur: ${ind.newValue}`));
}

Default configure

You need to call the config function manually. For very basic useage, you can just call configUsingDefault().

Picker.configUsingDafault()

And then set the "DEFAULT" field in PickerHandler.js

//–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––– DEFAULT
const initalIndex = 0;
const texturesName = [
    'img_picker_0',
    'img_picker_1',
];

//––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––

Manually configure

First, set the picker visible manually.

Picker.setVisible(true);

You can config picker with array of names or name pattern.

Picker.configUsingNames(['img_picker_red', 'img_picker_black'], 0);
// or
Picker.configUsingPattern('img_picker_*', 0)

Since configUsingPattern() will get picker images in random order, you can pass your prefer sort function.

const mySort = (n1, n2) => n1.substring('pic_'.length) - n2.substring('pic_'.length);

Picker.configUsingPattern('pic_*', 0, mySort);

Subscribe Functions

You can then subscribe your selected function after configuring the picker.

Picker.configUsingDefault().then(() => {
    Picker.subscribeIndex(1, () => Diagnostics.log('index is 1'));
    Picker.subscribeKeywords('red', () => Diagnostics.log("texture name includes 'red'"));
});

Other Functions

unsubscribeAll(): Unsubscribe all selceted function.

setIndex(): Set PickerHandler to desired index.

setVisible(): Set PickerHandler to desired index.

Donations

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