• Stars
    star
    108
  • Rank 321,259 (Top 7 %)
  • Language
    TypeScript
  • Created over 3 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Add your website a 3D Profile Avatar using Ready Player Me with a single line of code!

Twitter npm version

3D Profile Avatars

Add your website a 3D Profile Avatar using Ready Player Me with a single line of code!

Test it on CodeSandbox: https://codesandbox.io/s/avatar-view-wrn2u


Install

  • Run npm i @sarge/avatar-view

Example

  • First visit https://readyplayer.me and create a half-body avatar.

  • Copy the url of the .glb file of the avatar you created.

  • Import AvatarView to your file.

  • Add <AvatarView type={type} url={url}/> component yo your return content

import { AvatarView } from "@sarge/avatar-view";

const type = "3D";
const url = "https://models.readyplayer.me/62ea7bc28a6d28ec134bbcce.glb";

export default function App()
{
  return <AvatarView type={type} url={url}/>
}

If you are using Next.js make sure to import the component dynamically using ssr: false parameter.

const AvatarView = dynamic(async () => (await import('@sarge/avatar-view')).AvatarView, { ssr: false })

Parameters of AvatarView

  • type ("2D" | "3D"):

    Type of the avatar 2D image or 3D model avatar.

  • url (string):

    Url of the Ready Player Me avatar to load. This parameter is mandatory.

  • style (React.CSSProperties) [optional]:

    Style of the avatar view canvas. Here you can change the border style, background color or image, width, height and other style options.

  • options2D (Options2D) [optional]:

    Options for type "2D" avatar.

    • scale (Vector2) [optional]:

      Scale of the 2D avatar image.

    • position (Vector2) [optional]:

      Position of the 2D avatar in pixels.

  • options3D (Options3D) [optional]:

    Options for type "3D" avatar.

    • quality (Quality) [optional]:

      Avatar quality option to help reduce the size of the 3D model. Can be High, Medium or Low.

    • camera (CameraOptions) [optional]:

      Ortographic camera options.

    • transform (Transform) [optional]:

      Position, rotation and scale of the 3D avatar.

    • blinkEyes (boolean) [optional]:

      Enables eye blinking in random intervals.

    • followCursor (boolean) [optional]:

      When enabled, head and eyes of the avatar will follow of the cursor. Cursor must be moving on the 3D canvas. When cursor is out of the canvas, avatar goes back to initial stance.

    • orbitControl (boolean) [optional]:

      Enables use of orbit controls for the 3D scene, which helps you rotate the avatar via mouse drag.

  • onLoaded (void) [optional]:

    Callback method get notified when 2D or 3D avatar is loaded.

  • onFailed (void) [optional]:

    Callback method get notified when 2D or 3D avatar is failed to load.

  • fallback (React.ReactNode) [optional]:

    Fallback content to display if avatar fails to load.

More Repositories

1

OpenAI-Unity

An unofficial OpenAI Unity Package that aims to help you use OpenAI API directly in Unity Game engine.
C#
659
star
2

RPM-Smart-NPC

This project aims to help you learn how to use OpenAI API to make smart NPC characters in a Unity project.
C#
69
star
3

rpm-face-tracking

TypeScript
37
star
4

Pong-AI

Pong AI - A Practical Example of Unity ML Agents Usage in Pong Game
C#
12
star
5

core

The Official Aurous core code.
Java
11
star
6

moppu

Autumn Lisp Game Jam 2019 Entry, Pixel Art Platformer Game
Common Lisp
11
star
7

RPM-and-Unity-Starter-Assets

C#
11
star
8

Animeye

Animeye is a sprite animation viewer for 2D artists.
Lua
9
star
9

LowRezJam2020

Lua
8
star
10

obj-importer

OBJ importer with material and texture support.
C++
5
star
11

pick-a-card

A node package for playing cards.
JavaScript
5
star
12

UnityQLearning

An example of Q-Learning in Unity with UI
C#
5
star
13

BezierCurve

lua bezier curve
Lua
4
star
14

RPM-AvatarAPI-TopDown-Example

C#
3
star
15

ReadyPlayerMe-Godot-Test

GDScript
2
star
16

mobile-model-viewer

C#
2
star
17

web-anim-test

This is a React project for post processing Mixamo animation clips to make them work directly on RPM avatars.
TypeScript
2
star
18

C-Sharp-Matrix

A small matrix class for personal use.
C#
1
star
19

twitter-nft-pfp-cleaner

Clean them nft pfps
JavaScript
1
star
20

6-5-gaijins

C#
1
star
21

LD39

Defend Home: Mars. Ludum Dare 39 Compo submission.
C#
1
star
22

ChickenRally

Computer Graphics lecture game project
C#
1
star
23

rpm-unity-netcode-support

NetworkPlayer component for Ready Player Me avatars in Unity Netcode for GameObjects.
C#
1
star
24

Log-AI-System

C#
1
star
25

rpm-coherence-demo

C#
1
star