Pokemon Cards with Skia

Recently I was working on a demo app that uses react-native-skia to make cards with a shine and a glare. I found some projects on the internet implementing this functionality. These projects were inspired by pokemon cards:

You can find my project here:

Demo Gallery

Full Video Play button

▶ Full Video
Reel Play button

▶ Reel

📟 Pokédex GIF Gallery

Click any card to open the file.

Pikachu
#001 Pikachu
Bulbasaur
#002 Bulbasaur
Jolteon
#003 Jolteon
Charizard Big
#004 Charizard Big
Pikachu
#005 Pikachu
Chardizard
#006 Chardizard
Pikachu
#007 Pikachu
Squirtle
#008 Squirtle
Marill
#009 Marill
Mew
#010 Mew
Mew Controls
#011 Mew Controls
🟡 ???
Coming soon

CONTENTS:

Goals

Goal of the project. Combine multiple shader and image effects into one while maintaining high rendering performance.

  • dynamic shaders,
  • static background,
  • dynamic image switch,
  • hologram on top of the card,
  • dynamic hologram colour palette,
  • card gloss,
  • dynamic outline for image (no additional images just morphology computation)
  • outline with a punchout for (who’s that pokemon fancy outline)
  • outline with holo glare or gif image,
  • RGB split effect,
  • semitransparent hologram mask for image,
  • gif background mask that is the invert of the image transparent pixels,

I really liked the effect but in my opinion this could be taken to another level. I wanted to optimize the code as much as possible in order to achieve a nice 60 FPS with multiple effects combined. One of the projects used expo which has some extra installation steps.

I still think that I could have done a better job but I need to work on projects that pay the bills!

Below you can find the project’s demo gallery.

Optimisations

React and react native is a beast based on virtual tree and thai should be the first place you should be looking for your base optimisations. In my first implementation multiple changes (including the gesture and motion) caused unnecessary re-renders of components. The base goal is to remove all unnecessary re-renders and then focus on optimising the animation and shader code. Animations are created using react-native-reanimated and for shader and image manipulation (outline morph, masking, blending ) I use react-native-skia. Let us go step by step what and how was optimised. First we will start with canvas and shader component optimisations. Then we will show how you can optimize the gesture, motion and sensors. At the end I will show a few optimisations that you can apply across different projects (react including).

This is the first time I was working with such a rendering library. The last time I was working on something similar was something like 10 years ago when I was playing around with https://pixijs.com/ (great library btw. you should try it).

I kindly ask for your understanding. Feel free to reuse and modify this project.

🤝 Sponsors

WORKDEI

Generalne wykonawstwo inwestycji
Podwykonawstwo budowlane
Usługi budowlane Poznań
Nadzór budowlany
MILWICZ ARCHITEKCI

Gotowy projekt domu
Architekt Poznań
Projekt domu na zamówienie
Nowoczesna stodoła
DRL-CLINIC

Dentysta Kraków
Ortodonta Kraków
Implanty Kraków
Metamorfoza uśmiechu
MAXDENT

Leczenie laserowe Wrocław
Leczenie pod mikroskopem
Ortodonta Wrocław
Implanty Wrocław

💛 Thanks to our partners for supporting this project

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top