Comments (2)
Taking inspiration from the repo native-component-list I managed to animate a filter. Performances are not that bad.
import React from 'react';
import { Dimensions } from 'react-native';
import GLWrap from './GLWrap';
import './BeforePIXI';
import * as filters from 'pixi-filters';
import * as PIXI from 'pixi.js';
PIXI.filters = { ...(PIXI.filters || {}), ...filters };
const filter = new PIXI.filters.PixelateFilter();
const PixiView = GLWrap('pixi.js sprite rendering', async gl => {
const { scale: resolution } = Dimensions.get('window');
const width = gl.drawingBufferWidth / resolution;
const height = gl.drawingBufferHeight / resolution;
const app = new PIXI.Application({
context: gl,
width,
height,
resolution,
backgroundColor: 0xffffff,
});
const asset = Expo.Asset.fromModule(require('./assets/images/kylie.png'));
await asset.downloadAsync();
const image = new HTMLImageElement(asset);
const sprite = PIXI.Sprite.from(image);
sprite.filters= [filter];
app.stage.addChild(sprite);
app.ticker.add(() => {
filter.size = 100 + Math.cos(Date.now()*0.001)*200;
gl.endFrameEXP();
});
});
export default class App extends React.Component {
render() {
return <PixiView />;
}
}
from expo-pixi.
Nice solution! Looks like we should surface an update function so you can try and keep it reacty. :]
from expo-pixi.
Related Issues (20)
- Unable to Use ExpoPixi in VS Code HOT 1
- TypeError: undefined is not an object (evaluating '_expo.default.GLView) HOT 6
- Unable to resolve "uuid/v1" from "node_modules/@expo/browser-polyfill/src/DOM/HTMLImageElement.js" HOT 2
- iOS 14 support HOT 1
- Asset not loading for Sprite Sheet animation
- 'expo' does not contain a default export
- Library doesn't work with Camera Roll assets HOT 3
- Not compatible with Expo sdk 39 HOT 5
- Typescript Definition File HOT 1
- Examples and Pixi Spine is not working
- Issue when running Signature on Expo Web
- Upgrade to pixi 5.xxx HOT 1
- Outdated expo-gl peer-dependency HOT 3
- GLView doesn't show anything
- Unable to resolve module @pixi/core HOT 10
- Expo Client 2.21.5 (SDK 39) this.nativeVaoExtension.createVertexArrayOES is not a function HOT 15
- Sketch example crashes on Android (undefined is not an object (evaluating '_this.lastPoint.x')) HOT 6
- Incompatible with Expo 43 HOT 1
- To make it compatible with expo SDK 44
- Incompatible with Expo 46
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from expo-pixi.