The Whimsical Potential of JavaScript Frameworks

Spanish audio is available in the player settings
Rate this content
Bookmark

When it comes to building whimsical interfaces, React is a surprisingly capable ally. In this talk, I'll show you how I use React to orchestrate complex interactions by digging into some examples from my blog.

FAQ

The main difference lies in the design elements used. The Stripe product's dashboard is simpler without whimsical elements like mesh gradients or floating globes, focusing on functionality for a business-to-business SaaS product. In contrast, the landing pages feature interactive and dynamic design elements such as 3D globes.

The Stripe dashboard uses React, as identified through DevTools which shows that the page is built using React.

No, the Stripe landing pages do not use React. They are primarily built with vanilla JavaScript and custom packages, without relying on any component framework like React, Vue, or Angular.

Stripe's landing pages are known for their interactive and dynamic features, such as a 3D globe that changes as you scroll, indicating it's a 3D model and not just a video.

In a B2B SaaS product, the focus is often on functionality and usability rather than aesthetic embellishments. Whimsical design elements, while engaging, may not be necessary or could potentially clutter the user interface, detracting from the product's practicality in a business context.

The talk aims to explore how JavaScript frameworks, particularly React, can be used to create engaging and whimsical details in web development, enhancing the interactive experience of websites and applications.

A practical example is the interactive Like button described in the talk, which features animations such as the heart rotating based on cursor position and the eyes moving independently, adding a playful and engaging element to the user interface.

Josh Comeau
Josh Comeau
28 min
13 Nov, 2023

Comments

Sign in or register to post your comment.

Video Summary and Transcription

The speaker discusses the whimsical and detailed work of Stripe, particularly their interactive and dynamic pages. They explain the use of React for building whimsical details and tracking mouse position. The speaker introduces React Spring for smooth animation and React3 Fiber for creating a 3D egg model. They also mention the use of Framer Motion and React server components for animating CSS properties.

1. Introduction to Stripe's Whimsical Potential

Short description:

The speaker discusses the whimsical and detailed work of Stripe, particularly their interactive and dynamic pages. The speaker compares the Stripe product's login page to the rest of the pages, highlighting the absence of whimsical flourishes. It is revealed that the dashboard uses React, while the landing pages do not. The speaker explains the reasoning behind using React for a data-driven and full-stack application.

So, I should warn you, the first two minutes are going to be unavoidably bright. The rest of the slides will be dark, but brace yourselves. I'm a big fan of the work that Stripe does. I find it's really whimsical and detailed. I remember when this mesh gradient came out and it was a big deal. But all their pages are really interactive, dynamic. You have this 3D globe that you first might think is a video, but then it changes as you scroll, so it really shows that it's a 3D model. Very, very cool stuff.

When you actually log in to the Stripe product, though, it's a bit like stepping through a door into a different universe. There's no mesh gradients. There's no floating globes. That's not necessarily a bad thing. Like, you know, it's a business to business SaaS product. You don't necessarily need a bunch of whimsical flourishes. But my point is that just looking between the two, right? It's very clear that it's a different product built by a different team, using different tools.

And it probably won't surprise us to learn that the dashboard uses React. So, if you have the DevTools, it'll tell you this page is built using React. And the landing pages are not. They do not use React. I've seen the dev team talk about the tools that they use. It's a lot of vanilla JavaScript and, like, custom packages but no component framework. No React, no Vue, no Angular. I think this makes sense. Like, you know, we think of React. Like, this looks like a React application. It's data-driven. It's full-stack. It's all the stuff we've been talking about. And so you might reasonably wonder, like, why would you want to use React to build something like this? And that's what I'm here to talk about today. This talk is called the whimsical potential of JavaScript frameworks.

2. Building Whimsical Details with React

Short description:

The speaker shares their use of React to build whimsical details, such as a cursor-tracked heart and playful Like button. They explain the inspiration behind these details and discuss the concept of their blog as a personal playground. The speaker also introduces the idea of building an egg shape and focusing on cursor tracking for head rotation and eye translation.

And I want to share how I've been using React to build some pretty playful, whimsical details. I also realized I don't have a water, so I'm going to steal one of these while we let my very fun title screen play out.

So, for those who don't know, I have a blog. I blog at JoshWComo.com and when I built this blog, I sort of figured that this was going to be my playground. So I was going to indulge all of the whimsical ideas that I had. So if there was like a playful idea I wanted to do, I was going to do it. This, I was sort of inspired by those, like iron shavings you get with a magnet and you move the magnet and the iron shavings ripple around. It's exactly the sort of like kind of pointless, but fun little detail that I say yes to when it's my blog because it's my own little playground and I can do whatever I want.

One of the little details, and I'm gonna zoom this way, way in. Oh, this part's also, let me, hold on, dark mode. This little fella down over here, there's a bunch of little details to it. It tracks your cursor, so the heart itself rotates depending on your cursor position. A little bit more subtle, the eyes move independently and I don't know how clear that is, but small thing. If you come near the Like button, but then move away, if you don't engage with it, he gets a little bit sad. Because, you know, he's a Like button, Like buttons like to be clicked, but he doesn't stay sad very long, I decided to make him very cheerful. And, of course, you can click on it. I wonder if I have sound, let me see. That's fine, it makes a little glug noise, you can imagine that. And if you keep clicking it all the way, eventually, you get to the top and you get a little pop of confetti. A little Easter egg that people don't know. You can right-click to remove Likes. You can have fun with that.

So, this is essentially what I want to talk about. There we are. We're going to build this, we're going to build an egg. I chose an egg because it's a slightly simpler shape. And we're going to focus on the cursor tracking, so the head rotation and the eye translation. Now, even before we get to React, right, what are the things that we have to know to build this sort of interaction? Well, I need to know where in the viewport the cursor is. And the way we typically do this is by measuring the distance from the top left corner in pixels. So as you move more to the right, your x-value gets higher.

QnA

Check out more articles and videos

We constantly think of articles and videos that might spark Git people interest / skill us up or help building a stellar career

Emotional & Functional UI Animations in React
React Day Berlin 2022React Day Berlin 2022
28 min
Emotional & Functional UI Animations in React
JavaScript Haikus: My Adventures in Tiny Coding
JS GameDev Summit 2023JS GameDev Summit 2023
27 min
JavaScript Haikus: My Adventures in Tiny Coding
Discover the art of crafting extremely small JavaScript programs. In this talk you’ll learn principles and techniques behind crafting compact yet powerful scripts that are shorter than this description! Dive into the captivating world of minimalist coding, where we use these scripts to conjure art, games, tools, and a myriad of intriguing experiments.
Domain Driven Design with Vue Applications
Vue.js London 2023Vue.js London 2023
14 min
Domain Driven Design with Vue Applications
Top Content
Introduction to Domain Driven Design- What is DDD?- Key principles of DDD- Benefits of using DDD in web application developmentDomain Modeling in Vue 3 Applications- How to design and implement domain models in Vue 3- Strategies for integrating domain logic with Vue's reactive data model and component-based architectureBest Practices for Implementing DDD in Vue 3- Strategies for organizing code in a way that follows DDD principles- Techniques for reducing coupling between domain and application logic- Tips for testing and debugging domain logic in Vue 3 applications
Proven Pinia Patterns
Vue.js London 2023Vue.js London 2023
20 min
Proven Pinia Patterns
Top Content
With Vue's new-and-improved state management library, Pinia, we gain a much more modular tool. While being more flexible, leaner, and lacking the Mutations of Vuex, Pinia presents us with more opportunities to be creative, for better or worse, with our app architecture and how state management is conducted and organized within it.This talk explores some @posva-approved best practices and architectural design patterns to consider when using Pinia in production.
Component Design Patterns
Vue.js London 2023Vue.js London 2023
18 min
Component Design Patterns
How do you write a good component? In this talk we’ll explore several different patterns for writing better components. We’ll look at techniques for simplifying our components, making them easier to understand, and getting more out of the components we’ve already got.
Keep Scrolling
JSNation Live 2021JSNation Live 2021
33 min
Keep Scrolling
Wait! Not so fast - Stop scrolling and hang out with me for a while! When done right, scroll based animations can add polish to a site, and make online storytelling feel more immersive. GreenSock's ScrollTrigger enables you to achieve buttery smooth scroll based animations with minimal code. Let's dig in to some of it's features together.

Workshops on related topic

How to make amazing generative art with simple JavaScript code
JS GameDev Summit 2022JS GameDev Summit 2022
165 min
How to make amazing generative art with simple JavaScript code
Top Content
WorkshopFree
Frank Force
Frank Force
Instead of manually drawing each image like traditional art, generative artists write programs that are capable of producing a variety of results. In this workshop you will learn how to create incredible generative art using only a web browser and text editor. Starting with basic concepts and building towards advanced theory, we will cover everything you need to know.