Project Name | Stars | Downloads | Repos Using This | Packages Using This | Most Recent Commit | Total Releases | Latest Release | Open Issues | License | Language |
---|---|---|---|---|---|---|---|---|---|---|
Next.js | 107,369 | 7,716 | 3,624 | 21 hours ago | 1,624 | September 23, 2022 | 2,136 | mit | JavaScript | |
The React Framework | ||||||||||
Swr | 26,941 | 13 | 451 | 3 hours ago | 124 | September 12, 2022 | 77 | mit | TypeScript | |
React Hooks for Data Fetching | ||||||||||
Trpc | 26,236 | 56 | a day ago | 332 | September 22, 2022 | 88 | mit | TypeScript | ||
🧙♀️ Move Fast and Break Nothing. End-to-end typesafe APIs made easy. | ||||||||||
Jsoncrack.com | 24,331 | 9 days ago | 35 | gpl-3.0 | TypeScript | |||||
✨ Seamlessly visualize your JSON data instantly into graphs. | ||||||||||
Lenster | 20,378 | 21 hours ago | 100 | gpl-3.0 | TypeScript | |||||
Lenster is a decentralized and permissionless social media app built with Lens Protocol 🌿 | ||||||||||
Nativebase | 19,318 | 4,291 | 305 | a month ago | 348 | September 23, 2022 | 320 | mit | TypeScript | |
Mobile-first, accessible components for React Native & Web to build consistent UI across Android, iOS and Web. | ||||||||||
Nx | 17,767 | 126 | 264 | 21 hours ago | 846 | September 23, 2022 | 624 | mit | TypeScript | |
Smart, Fast and Extensible Build System | ||||||||||
Next Auth | 17,004 | 21 | 73 | a day ago | 567 | August 01, 2022 | 247 | isc | TypeScript | |
Authentication for the Web. | ||||||||||
Sst | 15,228 | 4 | a day ago | 681 | September 23, 2022 | 673 | mit | JavaScript | ||
💥 SST makes it easy to build full-stack serverless apps. | ||||||||||
Blitz | 12,834 | 3 | 11 | 3 days ago | 421 | September 13, 2022 | 195 | mit | TypeScript | |
⚡️ The Missing Fullstack Toolkit for Next.js |
Roll the dice!
This is a 3D motion-activated dice built with React, Next.js, Typescript and the Web Sensors API.
Try it live at diceroll.gaby.dev!
This should work on any web browser, however:
The cube itself is made with CSS perspective and transforms on a bunch of <div>
s.
A .svg texture file contains the dots and is placed on each face and aligned with background-position
.
The gyroscope API is used to detect when angular velocity of the device is past a certain threshold, to trigger a dice roll.
A random number is chosen using Math.random()
and after a little CSS animation, the cube is rotated to put the correct face on top, using an array of X/Y/Z rotation values (in deg):
this.faceViews = [
[0, 0, 0],
[90, 0, 0],
[0, 90, 0],
[0, -90, 0],
[-90, 0, 0],
[-180, 0, 0]
]
Using the RelativeOrientationSensor API or the DeviceOrientationEvent API depending on browser support, an offset is applied to those values to factor in the device's orientation for a cool 3D effect.
// Calculate perspective rotation with device orientation effect
rx = x + (ax * 40)
if (this.state.face === 5) {
ry = y
rz = z + (-ay * 40)
} else if (this.state.face === 2) {
ry = y
rz = z + (ay * 40)
} else if (this.state.face === 6) {
ry = y + (ay * 40)
rz = z
} else {
ry = y + (-ay * 40)
rz = z
}
.cube {
transform-style: preserve-3d;
transform: rotateX(${rx}deg) rotateY(${ry}deg) rotateZ(${rz}deg);
}
Finally, the rounded edges of the cube's faces are filled with a second layer that is offset by the border-radius in px, so you can't see inside the cube through the edges: