All Projects → expo → Expo Pixi

expo / Expo Pixi

Licence: mit
Tools for using pixi.js in Expo

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Expo Pixi

Expo Crossy Road
🐥🚙 Crossy Road game clone made in Expo (iOS, Android, web), THREE.js, Tween, React Native. 🐔
Stars: ✭ 701 (+177.08%)
Mutual labels:  webgl, cross-platform, expo
Expo Voxel
🎮🌳 Voxel Terrain made in React Native. ∛
Stars: ✭ 169 (-33.2%)
Mutual labels:  webgl, cross-platform, expo
Bulllord Engine
lightspeed lightweight elegant game engine in pure c
Stars: ✭ 539 (+113.04%)
Mutual labels:  webgl, cross-platform
Pixi.js
The HTML5 Creation Engine: Create beautiful digital content with the fastest, most flexible 2D WebGL renderer.
Stars: ✭ 34,982 (+13726.88%)
Mutual labels:  webgl, pixi
Pixi Seed
Pixi.js project seed with ES6 and webpack
Stars: ✭ 149 (-41.11%)
Mutual labels:  webgl, pixi
Ofelia
A real-time cross-platform creative coding tool for multimedia development
Stars: ✭ 269 (+6.32%)
Mutual labels:  webgl, cross-platform
Rabbittoolbox
🤸🏾‍♀️👗开源的动画渲染软件,提倡以简单、易用,高质量的物理演算以及渲染质量和性能,为喜爱二次元动画的用户降低视频制作门槛
Stars: ✭ 309 (+22.13%)
Mutual labels:  webgl, cross-platform
Roslynpad
A cross-platform C# editor based on Roslyn and AvalonEdit
Stars: ✭ 1,310 (+417.79%)
Mutual labels:  cross-platform, signature
React Native Signature Canvas
✒️ React Native Signature Component based WebView Canvas for Android && IOS && expo
Stars: ✭ 169 (-33.2%)
Mutual labels:  expo, signature
Pixi Haxe
Externs of Pixi.js for Haxe
Stars: ✭ 175 (-30.83%)
Mutual labels:  webgl, pixi
Leaflet.pixioverlay
Bring Pixi.js power to Leaflet maps
Stars: ✭ 264 (+4.35%)
Mutual labels:  webgl, pixi
Expo Native Firebase
🔥 Native Firebase Expo App (iOS, Android) Demo for Firestore, Notifications, Analytics, Storage, Messaging, Database 🚨
Stars: ✭ 197 (-22.13%)
Mutual labels:  cross-platform, expo
Sunset Cyberspace
🎮👾Retro-runner Game made in Expo, Three.js, OpenGL, WebGL, Tween. 🕹
Stars: ✭ 54 (-78.66%)
Mutual labels:  webgl, expo
Uiwidgets
UIWidget is a Unity Package which helps developers to create, debug and deploy efficient, cross-platform Apps.
Stars: ✭ 1,901 (+651.38%)
Mutual labels:  webgl, cross-platform
Gown.js
UI system for pixi.js inspired by feathers-ui
Stars: ✭ 195 (-22.92%)
Mutual labels:  webgl, pixi
Pillar Valley
👾A cross-platform video game built with Expo, three.js, and Firebase! 🎮🕹
Stars: ✭ 242 (-4.35%)
Mutual labels:  cross-platform, expo
Asciimatics
A cross platform package to do curses-like operations, plus higher level APIs and widgets to create text UIs and ASCII art animations
Stars: ✭ 2,869 (+1033.99%)
Mutual labels:  cross-platform
Four
Four: WebGL made easier -
Stars: ✭ 248 (-1.98%)
Mutual labels:  webgl
Rsock
The best companion of kcptun
Stars: ✭ 242 (-4.35%)
Mutual labels:  cross-platform
Renamer
Rename files in bulk.
Stars: ✭ 240 (-5.14%)
Mutual labels:  cross-platform

expo-pixi

Tools to use Pixi.js in Expo!

To get started: yarn add expo-pixi in your Expo project and import it with import ExpoPixi from 'expo-pixi';.

Side-Effects

To use Pixi.js with Expo & React Native you will want to import a modified version of Pixi.js like so:

// ✅
import { PIXI } from 'expo-pixi';

// ❌
import * as PIXI from 'pixi.js';

Now you can create a new Application the way you would on the web, but be sure to pass in a WebGLRenderingContext.

// ✅
const app = new PIXI.Application({ context });

// ❌
const app = ExpoPIXI.application({ context });

Finally, because of the way React Native currently works you must load in assets asynchronously.

/*
 * Accepts: 
 * - Expo.Asset: import { Asset } from 'expo-asset'; Asset.fromModule( ... );
 * - URL (with file extension): 'http://i.imgur.com/uwrbErh.png'
 * - Static Resource: require('./icon.png')
 */

// ✅
const sprite = await PIXI.Sprite.fromExpoAsync('http://i.imgur.com/uwrbErh.png');

// OR 

const texture = await PIXI.Texture.fromExpoAsync('http://i.imgur.com/uwrbErh.png');

// ❌
const sprite = await ExpoPIXI.spriteAsync('http://i.imgur.com/uwrbErh.png');

// OR 

const texture = await ExpoPIXI.textureAsync('http://i.imgur.com/uwrbErh.png');

Using web syntax will return a Promise, and throw a warning. It's bad practice, but if the asset is loaded already, this will work without throwing a warning.

const sprite = await PIXI.Sprite.from(require('./icon.png'));

// > console.warning(PIXI.Sprite.from(asset: ${typeof asset}) is not supported. Returning a Promise!);

// OR 

const texture = await PIXI.Texture.from(require('./icon.png'));

// > console.warning(PIXI.Texture.from(asset: ${typeof asset}) is not supported. Returning a Promise!);

Functions

ExpoPixi.application(props): PIXI.Application

Deprecated: Use new PIXI.Application({ context });

A helper function to create a PIXI.Application from a WebGL context. EXGL knows to end a frame when the function: endFrameEXP is called on the GL context.

context is the only required prop.

Learn more about PIXI.Application props

ExpoPixi.textureAsync(resource: any): Promise

Deprecated: Use PIXI.Texture.fromExpoAsync(resource);

ExpoPixi.spriteAsync(resource: any): Promise

Deprecated: Use PIXI.Sprite.fromExpoAsync(resource);

a helper function to resolve the asset passed in. textureAsync accepts:

You cannot send in relative string paths as Metro Bundler looks for static resources.


ExpoPixi.sprite({ localUri: string, width: number, height: number }): PIXI.Sprite

Deprecated: Use PIXI.Sprite.from(resource);

ExpoPixi.texture({ localUri: string, width: number, height: number }): PIXI.Texture

Deprecated: Use PIXI.Texture.from(resource);

Pixi.js does a type check so we wrap our asset in a HTMLImageElement shim.

ExpoPixi.Sketch

A component used for drawing smooth signatures and sketches.

See the sketch example on how to save the images!

Notice: the edges and ends are not rounded as this is not supported in PIXI yet: Issue

Props

Property Type Default Description
strokeColor number 0x000000 Color of the lines
strokeWidth number 10 Weight of the lines
strokeAlpha number 1 Opacity of the lines
onChange () => PIXI.Renderer null Invoked whenever a user is done drawing a line
onReady () => WebGLRenderingContext null Invoked when the GL context is ready to be used

ExpoPixi.FilterImage

A Image component that uses PIXI.Filter

Props

Property Type Default Description
resizeMode string null Currently only supports cover, and contain
filters Array<PIXI.Filter> null Array of filters to apply to the image
source number, string, Expo.Asset null Source can be a static resource, image url (not {uri}), or an Expo.Asset

Example

Snack

import React from 'react';
import Expo from 'expo';
import { PIXI } from 'expo-pixi';

export default () => (
  <Expo.GLView
    style={{ flex: 1 }}
    onContextCreate={async context => {
      const app = new PIXI.Application({ context });
      const sprite = await PIXI.Sprite.fromExpoAsync(
        'http://i.imgur.com/uwrbErh.png',
      );
      app.stage.addChild(sprite);
    }}
  />
);

NPM

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].