chantastic.fm

35: Make the Web Look Great with Matt Perry. On declarative animation, open source management, and importance of the open web

Episode 35 · January 17, 2019 · 00:46:50

Hosted by chantastic · With Matt Perry

Download MP3 · Jump to transcript

Matt Perry is the developer behind Popmotion, a declarative animation library for the web. Chantastic asks his inspiration for Popmotion, the difficulties of maintaining a low-level open source library, what he thinks declarative APIs might look like in the future. Their discussion goes all over the place. You kinda just have to listen…

Featuring

Links

Transcript

[00:00:00] Michael Chan: This is React Podcast. I'm Shantastic. Today I get to sit with Matt Perry and talk about his animation library, Pop Motion. A library that provides a declarative animation API for the web. We talk about what it means to have a declarative API. And how that boundary will shift as we move along into the future with better and better technologies. And towards the end, he really opens up my mind to APIs that I'd never even imagined. We also talk about the difficulty of building a library that is both low-level enough to be used anywhere, but simple enough to be useful out of the box without a lot of setup. This is no simple task, and if you're finding yourself as an open source maintainer in this area, I think you'll learn a lot from Matt. This was a fun conversation for me. And talking with Matt reminded me of how critically important it is that we protect our open web. This episode of React Podcast is brought to you by React Training. They provide in-person, hands-on training for development teams. Taught by community leaders and experts. For more information or to find a workshop by you, visit reacttraining.com. Matt, it's awesome to have you.

[00:01:36] Matt Perry: Awesome to be here. Thanks very much.

[00:01:38] Michael Chan: Thanks. So, we're sitting at React Conf 2018. You just delivered an awesome talk.

[00:01:45] Matt Perry: Yeah, thanks.

[00:01:46] Michael Chan: On your uh your library, uh Pop Motion and Pose. And what was the title of your talk again?

[00:01:51] Matt Perry: Uh the Path to a Declaratively Animated Future.

[00:01:54] Michael Chan: Awesome.

[00:01:55] Matt Perry: Yeah, I rehearsed that a lot. Just getting that out. That's a little bit of a tongue twister. Yeah, it's it's almost too much, but yeah, the intonation is important. It helped me remind myself what I was even talking about to begin with, so.

[00:02:07] Michael Chan: Did you back into that? Like, had you submitted it without saying it out loud and then you were like, Oh crap, this is uh this is actually really hard to say.

[00:02:15] Matt Perry: Yeah, well actually what happened, I submitted it in the midst of time and completely forgotten about it. And the organizers got in touch over Twitter saying, "So you're gonna reply to your email then?" And I was like, "What are you talking about?" So I had to check my spam. Oh no. And then so all I had to go on, I'd completely forgotten. I had the title, but I had no synopsis. I didn't really know what I was meant to be talking about. I just had this, you know, fairly high level Like, what is the path? Well, it's a good question, me from the past. So I just had to make make up a talk based on that.

[00:02:45] Michael Chan: So like past you wants you to succeed but isn't really giving you the tools that you need to to get there.

[00:02:53] Matt Perry: Yeah, that's a common thread throughout throughout my life, yeah.

[00:02:56] Michael Chan: That is awesome. I um I really like that idea that you just kind of sent it. Like without really knowing exactly how you're gonna backfill it. Some of the talks that I've done uh were the same way.

[00:03:10] Michael Chan: It's like, oh, I really wanna know about this thing. They're like aspirational, right? Like, I wanna know about this thing, um, so I guess I'll submit a talk to this conference about it.

[00:03:20] Matt Perry: Right, yeah, yeah. It was, I felt like I had stuff to say, I had thoughts that weren't really, until maybe a week ago, properly put together. And it's a subject that had taken up most of the last 6 months for me in terms of uh making "Pose." So I just felt like I'd eventually figure out- like I'd figure out something to say about it.

[00:03:43] Michael Chan: Yeah. You had enough confidence in yourself that you'd figure it out.

[00:03:47] Matt Perry: Yeah, exactly. Yeah, yeah, yeah. I think it's like that's largely half of life, isn't it? Just having a confidence that, "Oh, it'll work out all right." And what's the worst that can happen? I always feel like if I don't die, then that literally nothing else, that's fine. I could be broke, I don't know, but as long as I just don't- as long as I stay in the game, nothing's gonna go wrong. And luckily, as you saw, I didn't actually die.

[00:04:09] Michael Chan: You didn't die.

[00:04:09] Matt Perry: Yeah, although at one point I thought I was having a heart attack.

[00:04:12] Michael Chan: So it could have happened. The worst thing could have happened.

[00:04:15] Matt Perry: Exactly. That's- I was lucky escape. That was- it was genuinely distracting, as you can imagine.

[00:04:21] Michael Chan: At what point in your talk did that happen? So when we're watching back, we can know.

[00:04:24] Matt Perry: It's about 10 minutes in.

[00:04:25] Michael Chan: About 10 minutes in.

[00:04:26] Matt Perry: Yeah, luckily it went away after I got off the stage, so.

[00:04:29] Michael Chan: What does your uh preparation for a talk like this um involve?

[00:04:33] Matt Perry: Well, this is my first talk. Oh,

[00:04:36] Michael Chan: wow.

[00:04:37] Matt Perry: Congratulations. Thanks very much. Um, I've done a few at meetups and there my preparation is a lot more like lacking, I guess. I just sort of wing it a bit more. And as a result, I'm way more nervous. But this time, so I don't have a job currently.

[00:04:50] Michael Chan: Okay.

[00:04:50] Matt Perry: Um, so I've been working on, I I quit specifically to work on open source for a bit. Oh, wow. Um, so when I found out I was doing this, luckily it was only a month ago. Because I have stopped all maintenance on that project and just like completely focused on the on the talk. So it's actually way more preparation to this talk than I perhaps would give it again in the future.

[00:05:15] Michael Chan: Yeah.

[00:05:15] Matt Perry: It's too it's you know it's too too taxing, I think.

[00:05:18] Michael Chan: Well, that's I mean that's important for your first one because you got a lot of extra things that you got kind of got to figure out. I mean it's a big crowd compared to a meetup, so.

[00:05:26] Matt Perry: Yeah, exactly. And I felt like, 'cause I knew, 'cause it's livestreamed and a lot of people watch these videos, I just felt like if I'm gonna do it, I don't know how many times I'm gonna do it, so I better just do this one like and be proud of what I've done. Yeah. And I was I was happy with it. I didn't know if I would be, if I'd deliver it okay, but um yeah, I was I was I was quite happy.

[00:05:44] Michael Chan: Nice.

[00:05:45] Matt Perry: I delivered it as good as the talk was. Do you know what I mean? Like I didn't know how good the talk was, but I didn't do it an injustice.

[00:05:51] Michael Chan: That's an interesting idea. So the talk had a ceiling, and you feel like you made it to the ceiling.

[00:05:55] Matt Perry: Exactly.

[00:05:56] Michael Chan: Okay, nice, nice. Well, I enjoyed it. I thought it was I I thought it was great. So uh what were you doing before uh you moved to full-time open source?

[00:06:06] Matt Perry: Um I was working at uh Drivetribe, which is like a Jeremy Clarkson startup. They do driving uh social media sort of And before that, I just bounced around. I've been working for about 12 years now, I guess. So I've just been bouncing around different companies doing different things, but they're usually websites.

[00:06:27] Michael Chan: Yeah.

[00:06:27] Matt Perry: Uh, yeah. But I started really in design. Like, my first job actually was as a full-time designer, web designer. Okay. And then I just sort of drifted into development semi by accident, I guess. But, and then at one point, you know, you ask, am I gonna get to do any design in this role? And they say no. And then 2 years later, you've gotta do a bit of design and you're crap. So you just stop altogether. And that's basically the story of my career.

[00:06:56] Michael Chan: I feel like that skill does not hold up well when you don't maintain it, the design skill.

[00:07:00] Matt Perry: Yeah, 'cause as far as I'm concerned, a button isn't a button without like glossy gradients. And you can, if you can't see your own face in it, like you're hooking into the camera API just to just to position. I can't, yeah, I can't, I just, flat design and stuff like that. I've just about got my website looking how I want it, but it's, I found it quite a struggle really.

[00:07:22] Michael Chan: Well, I believe the design background because you have a very beautiful site for Pop Motion and all the related versions of it.

[00:07:29] Matt Perry: Yeah.

[00:07:30] Michael Chan: So tell me a little bit about uh Pop Motion, Pose, kind of how they come together, where they came from, all the all the stuff about that.

[00:07:39] Matt Perry: So, I wanted to write a book originally about delightful animations and user interactions. And I had all these demos that weren't necessarily practical for use in real websites, but I kind of just wanted to try out some stuff. The code that I was writing was like quite repetitive, and I felt like I could abstract some of it into you know different functions. And then over time that just became like a little library and I thought I might as well open source it. 'Cause it was quite small as well, which I- that was really what I liked about it to begin with. It was like a small library. So I thought, oh, I'll just publish this. And then quite quickly it became- because the core concept of it was that I wanted to constantly track the velocity of every animation or user input.

[00:08:25] Michael Chan: Okay.

[00:08:26] Matt Perry: And feed that into subsequent animations. So if you were dragging something and you threw it, you could feed that velocity into spring physics or decay or whatever it is, uh you know, some other physics. And that would, in my opinion, create this sort of feedback where the user feels very connected to the interface.

[00:08:48] Michael Chan: Okay.

[00:08:49] Matt Perry: So that was the original aim of Pop Motion. It still is. That's the that's the reason it exists over anything else. Like that's its unique thing, I believe. But uh It does involve like a certain amount of wiring. It's very unopinionated. Like it doesn't care if you use the DOM or Canvas or anything like that. So it does require some level of wiring things up. And I think uh historically where something like GreenSock or Anime have been quite um friendly to use, Pop Motion's probably been considered a little more uh low level or tough to understand how the various parts uh communicate with each other. And that's how that's how I ended up on Pose, basically. I tried to bring Pop Motion into React. I didn't have a problem with the way it was generally, but when you bring it into React, it really highlights all the different ways in which you wire these things up. Sure. And because React's so declarative, I did start thinking, right, there must be a better way to do this. And so Pose is an abstraction, really, of imperative libraries in general. It handles passing the velocity between all the different animations itself. Like it becomes responsible for starting and stopping animations itself. Um, it's such an abstraction that on the web it's it's built with Pop Motion, but on uh React Native it's built with React Animated. So okay. Yeah, so it's like an abstraction. It's so abstracted that on the whole that you you wouldn't know which one you're using.

[00:10:14] Michael Chan: I noticed also in the documentation it's React, React Native, and Vue.

[00:10:18] Matt Perry: Yeah, that's quite recent. So I had to learn a bit of Vue to figure out how I'm gonna Because I I just knew that there was a way of bringing it into Vue because it's so similar. It's a it's a declarative Vue library, Vue as in I-E-U. Um so I felt like it would work with Vue V-U-E. And uh yeah, it did. It works fine. Um I like it. But then I don't have to use Vue in my day-to-day job. So whether any actual Vue developers like it, I don't know, but It was pretty easy to to figure it out and stuff.

[00:10:54] Michael Chan: Interesting. So if I understand correctly, you have Pop Motion, that's the low-level uh library that manages the imperative APIs. Yeah. Sorry. Um, and then you have Pose, which you've used to kind of abstract that for the web, but then also it uses Animated on React Native.

[00:11:15] Matt Perry: Yeah.

[00:11:16] Michael Chan: And Vue uh also uses Pop Motion under the hood.

[00:11:20] Matt Perry: There are many facets of Pose in terms of um how it's integrated. So at its very core, there is a library called Pose Core, um and it handles the resolving of poses. And it's got like a .set method that— um man, do you know what? And the thing is, it's actually difficult to explain. To people who wanna contribute to the codebase as well. It's actually because so it doesn't care about the renderer and it doesn't care about the animation library. Okay. And it doesn't care about what view library is controlling it. So there's all sorts of different abstractions there. You've got one that's controlling the animation library, that's like the brain. And then you've gotta hook those numbers into the renderer, which in uh the web-based ones is the DOM currently, but it could easily be Three.js or Canvas or whatever it is at some point. But that's an opinion that I've taken, whereas Pop Motion doesn't give- it doesn't care. So then you've also got the abstraction of React Native, React, Vue, and all these do is control the various- oh man, I don't know if this is even a- is this a path that we can go down? I can't even-

[00:12:35] Michael Chan: No, it's interesting. So so the reason I ask is because it is it's really hard to communicate the goals of a project when you're implementing the low-level library as well as the consumers of that low-level library.

[00:12:50] Matt Perry: Yeah.

[00:12:50] Michael Chan: I don't mean to put you into a corner where it feels like kind of like uncomfortable.

[00:12:55] Matt Perry: I was already in it. Don't worry. I've lived in the corner since I created this thing.

[00:12:59] Michael Chan: But yeah, I guess I wanted to talk with you about- I guess I just wanted to kind of understand like what the relationships were, be able to communicate about those, because I know that it does get complicated when you have to own both pieces of it. The low-level library and then also the glue to the frameworks, and especially when they're, you know, as diverse as they are.

[00:13:20] Matt Perry: Yeah, the way I think about it is that Pose and React Animated are the engines, and then Pose, whichever flavor you're using, is sort of like the brain. That's the driver, that's the one that's shifting gears and figuring it all that out. But Pose is also, in a sense, it's like a I wouldn't call it a language the way CSS is, but it's a like maybe a spec.

[00:13:40] Michael Chan: Okay.

[00:13:41] Matt Perry: So there's an idea, half-baked, that I've got this like almost spec level, spec-driven development where there's a document somewhere that defines timeline animations. They don't currently exist in any version of Pose, but the idea is to figure out how to describe them as the declarative object, and then figure out, okay, how am I actually gonna do that? And I think doing it that way around is what keeps it sort of simple. Every time I've veered off into the platform-specific integration, that's usually when I've introduced more complexity perhaps than I wanted to initially.

[00:14:22] Michael Chan: Do you have any recommendations from those experiences for people who are looking to create a library, whether animation or um otherwise, that targets those 3 platforms that Pose targets?

[00:14:36] Matt Perry: What has helped- so I wrote Pose for Vue in about a day or 2, and I used the first time I'd ever used Vue was about 2 days before that.

[00:14:44] Michael Chan: Crazy.

[00:14:45] Matt Perry: And I only did that to to make the implementation. So the reason that it was so simple to get that working was because I had this abstracted pose, which was semi-imperative, that you could then hook into the lifecycle methods of Vue and underline that, you know, that itself was only possible because Pop Motion had all this freedom and flexibility. So finding that division of responsibility in the long run can set- it can really like level the- what is it in curling when they brush down the- brush to speed up the thing?

[00:15:21] Michael Chan: Yeah, they like smooth it out, right?

[00:15:22] Matt Perry: Yeah, exactly. Or rough it up

[00:15:23] Michael Chan: depending on if they need to make it

[00:15:25] Matt Perry: Yeah, and you do do both, like whether or not you want to, um you do tend to rough it up sometimes. But don't mean-

[00:15:32] Michael Chan: Like, I don't want people to do this, so I'm gonna make it hard.

[00:15:34] Matt Perry: Yeah, exactly. Yeah, no, if only it was uh intended. It's yeah, it's that process of smoothing out. So in in Pop Motion, Pop Motion's really unopinionated. So it's got all these animations and all they do, they pump out numbers into pure functions. So as a consumer, For a lot of people, I think that's where people have had or complained where there's a bit of complexity perhaps, 'cause you've gotta like make some- there's a function that will say, okay, well, I wanna use it with this element, and then you can set that element. Whereas something like GreenSock, you just say, you can even use a selector. Yeah. But because Pop Motion's so militant about, you know, not getting involved with any of that, it's not as simple.

[00:16:16] Michael Chan: Sure.

[00:16:16] Matt Perry: So For most people's needs, there's a simple API, which is kind of what I ended up doing with Post. Post takes the firm stance that you're gonna be using this with the DOM if you're on the web. That won't always be the case. There'll be other integrations, but when they exist, they'll be seamless. And if you use the certain flavor you're using, you're using that flavor. So if there's a Three.js flavor, you're using that because its design goal is to be simple, Pop Motion, on the other hand, its design goal is to be flexible. So in in the same sort of militant sense, it will never accept a selector for you to do the animations. Now, what my hope was, was that someone who liked Pop Motion and wanted to use it, but they thought, oh, it would be simpler if it worked a little bit more like um Anime or GreenSock, where you provide it a selector. They'd write like a little wrapper around it. I didn't want to do it myself because there's this messaging issue. They don't know how to communicate that to users. And it has been a problem with Pose, but um with Pop Motion, at least the one thing that I can say has been simple is the messaging. It's, you know, how do I use this with the DOM? Well, here's how you use it with the DOM. But you can use it with anything because it is this, you know, just pumps these numbers into whatever function you give it.

[00:17:34] Michael Chan: That is the core of the problem, right? Like you build this very low level library, right, which is designed to be unopinionated about things so that people from different platforms can use it. But if you make it too low level, then people don't know how to use it, and so they don't don't ever start.

[00:17:53] Matt Perry: Yeah.

[00:17:54] Michael Chan: And so then you have to build kind of these these bridges, I guess, to make it easy for people. But you have to bring in, you have to bake in the opinions, you know. So like Pose for React is opinionated about React and only using the DOM. So you have kind of this, uh, what is it, Cambrian explosion, whatever the term is for that. Like, you have to make something that maps these 3 things into one library, right? And be opinionated about those in order to be easy enough for people to just drop in and use in their stack.

[00:18:24] Matt Perry: Yeah.

[00:18:24] Michael Chan: Um, and you have to kind of like make those to show people, oh no, this is, this is how you would make a library on top of Pop Motion.

[00:18:32] Matt Perry: Yeah, exactly. And it's almost upsetting because Pose couldn't exist if Pop Motion wasn't the way it is. Yes. But that Cambrian explosion absolutely exists. If you look in the monorepo, there's so many different flavors of Pose and different levels of it as well, where it hooks into this animation library with this renderer. But at the same time, the API is always very simple. But On the other hand, Pop Motion, there's only one Pop Motion library, but the API, it's it's quite simple. The animations are very simple, but the API to hook it into these different things can become uh cumbersome.

[00:19:07] Michael Chan: Yes.

[00:19:08] Matt Perry: And that's a- it's like you you have to choose one.

[00:19:11] Michael Chan: Yeah.

[00:19:11] Matt Perry: So I've chosen both.

[00:19:12] Michael Chan: Yeah. Or if you choose both, now you have a really hard time communicating that to people, like where they fit into all this.

[00:19:18] Matt Perry: Well, people do ask, okay, so what am I gonna use, Pop Motion or Pose? And I always say just use Pose. Because then you'll know when you need Pop Motion. You'll know when you get to that the stumbling block that you're like, "Oh, how do I do this?" And ideally, there'd never be a point where they hit that. We want to I want to put in as much functionality in the simplest way, but I'll never introduce a new feature until I can express it in a simple declarative manner.

[00:19:43] Michael Chan: So you mentioned design bringing you into development, but this is very animation is very specific. Portion of design. What got you excited about animation?

[00:19:55] Matt Perry: I think it's a nice- I think it's a nice combination of design and coding, because you, you know, to write this, it was always that whenever I used uh GreenSock with Flash, this is like 10 years ago, I used to think it was magic.

[00:20:11] Michael Chan: Yeah.

[00:20:11] Matt Perry: But I didn't realize that all it was really doing is every frame it was setting values. Because I mean, I was just so new, I didn't- I hadn't- I didn't really get why or how it works. And I just sort of imagined that it couldn't work like that.

[00:20:23] Michael Chan: Yeah, you pray and rain comes down.

[00:20:25] Matt Perry: Yeah, exactly, yeah. And uh yeah, so it seemed it seemed semi-magic, and I think it's just provided a nice platform for me to write. So I got I started Pop Motion long after I stopped doing design myself.

[00:20:43] Michael Chan: Okay.

[00:20:44] Matt Perry: So there was never a parallel overlap. So for me, it's been this constant thing in the background that I can use. It's just a vehicle for me to try and improve my coding skills, not just in terms of writing the thing on the inside, but thinking about the API design from the outside.

[00:20:57] Michael Chan: Yep.

[00:20:58] Matt Perry: Because it's so easy to um write something and not think about how anyone else is gonna have to use it. So actually what you find in Pose is that I've written it with me in mind on the inside, and then on the outside, I tried so hard to make this accessible API for everyone else. That actually on the inside, I don't always have that same thought. Sure. Because I'm generally the core contributor. We've definitely had more come in like since it's gotten more popular, but on the whole, um I've I've at least in my own head only written it with me, like no one else is gonna see it.

[00:21:34] Michael Chan: Yeah.

[00:21:35] Matt Perry: I don't know if I should say that.

[00:21:37] Michael Chan: So do you have um do you have resources that were invaluable to you as you started learning about animation? Were there libraries that influenced Pop Motion?

[00:21:47] Matt Perry: Not really, no, because I knew the type of animations that I wanted to write. So for instance, like the timeline didn't exist for a while, and it's still quite- if you compare it to GreenSock's timeline, Pop Motion's timeline, because it's that strict adherence to the idea that every function or every um animation pumps out these values, well, that means that there's a disconnect between the labels or the tracks that you have on the input and them coming out on the other side on the output, so that you need to then do something with those tracks. So, you know, you apply it to the DOM elements that you're animating or whatever it is. Whereas GreenSock doesn't have that problem, so its API is much nicer. Sure. But at the same time, this enables me to use that code one day- I haven't yet, but I'll be able to figure out a way of using that function that exists, that animation, with a simpler API and use it in a variety of situations, I guess.

[00:22:46] Michael Chan: Yeah, yeah.

[00:22:47] Matt Perry: What was the original question?

[00:22:49] Michael Chan: I don't remember.

[00:22:50] Matt Perry: I like that though. I was like, I'm happy with it.

[00:22:53] Michael Chan: The um uh the original question was just about um inspiration and uh resources for animation.

[00:23:02] Matt Perry: Oh, so so so the timeline function only existed originally because people who were used to GreenSock were saying, "Oh, I want a timeline function." Yeah. And I sort of gave into that, even though this wasn't for the sort of things that GreenSock's great at, which is, you know, coordinating lots of intricate animations that go on for, you know, many seconds. Pop Motion was always about these velocity-based animations that tried to make a responsive UI. It was very- it's always been about the the interface and its relationship to the user, which is different, I think. Um, it's just it's just a different focus. So that was the one time where I felt like I get or I I took from, especially users saying, "I want this." And I was like, "Man, if I don't do this, no one's ever gonna use Pop Motion." But actually, because of the design goals of Pop Motion, no one's gonna use the timeline the way it is. Like, I wouldn't. It's too much of a pain, but but I know that it's there when I need it one day.

[00:24:04] Michael Chan: Yeah. You know, you gotta keep your users happy, your first set of users, or you know, what are you doing it for?

[00:24:11] Matt Perry: Yeah, well, it's it's strange because that was the- in that period, if you look at the downloads of Pop Motion, only really started gaining traction sometime last year. So when I originally introduced that feature, no no one you know, no one started using it because of that. Yeah. Everyone just carried it, rightly so. I mean, the the API might have been a bit different then, but people carried on using GreenSock.

[00:24:35] Michael Chan: Yeah.

[00:24:35] Matt Perry: Because ultimately what I what I'm trying to do with Pop Motion is just different. So a timeline isn't gonna sway anyone who doesn't want to do those things using it. So it was all a bust anyway. But it was only when I figured out this new API, the one that sort of pumps out numbers to the these pure functions that anyone started using it at all. So even though it is- it's almost in some ways less nice to use. It's nicer in others, but it's almost like the less opinions I've taken, it- people like prefer it, or a certain subset of users prefer it. Sure. So the more you lean into your design goals, I think you tend to pick up people like the the people who see value in it.

[00:25:20] Michael Chan: Yeah. It

[00:25:21] Matt Perry: doesn't matter what the numbers are, but it's, it's, did they love, did they love using it? Not does everyone love using it?

[00:25:27] Michael Chan: Yeah.

[00:25:27] Matt Perry: I don't know. Whereas, yeah, Pose on the other hand is actually, it is meant to be more, does everyone love using it? And that's not like, I don't, I don't mean that in like a, because it's design goals to be simple. Yeah. So if everyone doesn't love using it, then I fucked up. Yeah.

[00:25:45] Michael Chan: They have different goals.

[00:25:46] Matt Perry: Yeah, exactly.

[00:25:47] Michael Chan: Different users and use cases and whatnot. But it is nice that you provide a mechanism for people to go- you have something that people can be met by when they have deeper needs that Pose doesn't satisfy for them.

[00:26:01] Matt Perry: Yeah, and the cool thing about it is that now that Pose exists, I don't feel any pressure to make Pop Motion more accessible. It will always have like a- I'll try and keep it a clean API. But I don't need to add any DOM integration, for instance. So that just from having Pose exist has totally relieved the pressure there. And in fact, it's made me realize that I can lean in a bit more. Maybe there's a- what, you know, is the more advanced stuff that we could do in Pop Motion that then I can later think about. So I can concentrate on the like even more advanced stuff in that.

[00:26:33] Michael Chan: Yeah.

[00:26:33] Matt Perry: And concentrate on the simple API. Like maybe I bring those features to Pose. At a later date. So there's this realm in my head of things that are considered advanced use cases that actually- for instance, animation blending. It's actually- we've had some code knocking around the codebase for a while where you can blend tweens.

[00:26:56] Michael Chan: Oh, wow.

[00:26:57] Matt Perry: With a third um Bezier. So this is- there's been this piece of code knocking around the codebase for a while, but I've never found the nice API, but what it does is blend two different tweens, not at the same time. So you've got the same way that you pass velocity between spring animations, this would be able to blend two different tweens in like a in a nice in a nicer way. So it maintains the characteristics of both before transferring completely to the second tween.

[00:27:25] Michael Chan: So I'm trying to think about a practical use case for that. Would that be like if you interrupted an animation?

[00:27:32] Matt Perry: Exactly. No, completely only that situation.

[00:27:35] Michael Chan: Okay, cool.

[00:27:36] Matt Perry: So if you had something opening and then you quickly closed it, it might be that it can carry on traveling in the direction it was going rather than abruptly stopping the animation. Reversing. Exactly, yeah. So the idea would be to make the user a part of even tweens, but I've never come up with a nice API to represent this concept. So now, because Pose exists and because Pop Motion's the way it is, I can just publish that at some point in Pop Motion, not worry that it isn't the nicest API, but know that there's the flexibility there that people, myself or someone else, could use that in a simpler API. So at some point I'll publish that, and then further down the road I'll I'll think, okay, how do I bring that to Pose? Well, I'll probably just do it transparently. Mm-hmm. So maybe at one one point these tweens do start blending into each other without any you know, a user might never have to get involved with that. They won't even have to write an attribute. I don't know. That might be a bit too opinionated, but maybe it isn't. Like I say, it's something I'll look at later on.

[00:28:40] Michael Chan: Yeah. How do you manage those um unstable features? Uh one thing that I've always liked about React is that they have this prefix, unstable underscore, for things that are under active experimentation. Do you have a mechanism for that as well?

[00:28:55] Matt Perry: No, I've only- I just tend to publish things and then break them as I redo the API. Um, this- yeah, this- no, this-

[00:29:04] Michael Chan: Also a valid strategy.

[00:29:05] Matt Perry: Yeah, exactly. Yeah. I mean, because I have broken this API. This was something that was published in Pop Motion at one point, and I just didn't like that it was there messing up the uh docs.

[00:29:16] Michael Chan: Yeah.

[00:29:16] Matt Perry: Because no one's using it. Yeah. Because it's complicated. So I just got rid of it. And so now it just lives in a little folder somewhere, just unloved, waiting to be uh taken out of its uh shadowy corner.

[00:29:29] Michael Chan: Not dead yet! So we saw a lot of cool things today at React Conf that have— I'm kind of— we've known about maybe since the beginning of the year, or stuff that was brand new today. Um do you feel like hooks or Suspense or anything like that might play into future Pose APIs?

[00:29:47] Matt Perry: I mean, maybe not in the API. I have thought about this and I think the Pose component thing doesn't really lend itself to using hooks or being a hook or something. Something I'll definitely keep in mind because I think as an API, it's actually awesome. And what I think is is more likely to happen is that I'll use hooks in Pose, like within it. So the the Pose components themselves will probably use hooks somewhere. 'Cause we do use uh state, I believe. We use lifecycle methods for sure. So we'll, you know, we'll probably rewrite. There's definitely like an unsafe underscore in there. Okay. So rather than fix that, because of the people now complaining, because they use React, you know, strict mode or something. Sure. Which is totally valid. It's just that I will probably just skip and move on to this from the get-go. Because I think it's just really, I really, really like it. When I saw it, And when I saw it and then when I figured out- I didn't figure it out. That's the thing that annoys me. I didn't figure it out. I had to wait for the docs to tell me because I was thinking this is magic.

[00:30:48] Michael Chan: Yeah.

[00:30:49] Matt Perry: And then when I figured it out, it was so simple and I thought this is actually genius. It's great.

[00:30:53] Michael Chan: Yeah.

[00:30:53] Matt Perry: So I'm actually I'm super excited to use those. By the time this goes out, it'll probably be like old news. They'll probably have got a new new API. Um, yeah, I'm I'm super super excited about hooks.

[00:31:05] Michael Chan: Yeah.

[00:31:05] Matt Perry: And suspense in general. That's again, that's not something that I think will work in Pose, but lazy loading is something that I definitely feel is super important. And one of the things that Pose doesn't do well at the moment, as far as I'm aware, I've just never tackled it, and I know some people have had problems with it. We've got some examples of root transitions with like React Router or Reach Router.

[00:31:29] Michael Chan: Yeah.

[00:31:31] Matt Perry: That's fine if you've already got the component loaded. But I think there's gonna be some- at the moment, there's some friction when the when the root hasn't loaded, the incoming root.

[00:31:42] Michael Chan: Yeah.

[00:31:42] Matt Perry: So I'd like to- because you could imagine using a Suspense child and um animating into a placeholder div if it doesn't exist. Yes. Because maybe that can- oh, but and if that's not rendered, maybe the you know, lazy loaded component also has an animation that can- So that sort of thing is something that I'm gonna have to look at, but I think it will make that entire um process so much smoother. That I think if it works or not, it's something I'll be putting effort into making sure it works.

[00:32:17] Michael Chan: That'll be cool to see. So you mentioned in your talk that you have a guiding philosophy about why animation is important to you specifically for the web. Um, do you mind talking about that for a second?

[00:32:30] Matt Perry: Yeah, I mean, for me, the web represents something that we don't- it's unique. It's an open media that for me is crucial to the development of humanity. I'd like- I really believe, but I think I've been let down.

[00:32:47] Michael Chan: It sounds overstated, but it's true.

[00:32:49] Matt Perry: Yeah, for sure. Like, I feel like an asshole even saying it, but it's something that I really believe. 'Cause this doesn't exist anywhere else. This this idea that any- it's so democratic and open in the sense that, it's, you know, for better or for worse as well.

[00:33:06] Michael Chan: Yeah.

[00:33:07] Matt Perry: In the sense that anyone can go on there, say anything they like, um, make anything they want. And it's not guarded by a corporation or an app store. So to preserve that, and nurture it and make it relevant in the 2020s and the 2030s, which is gonna be a couple of decades. Originally I thought of great technological change, but now I also think of like if the internet blew the doors off, I mean cross-reality to me is is we have no idea where that's gonna lead.

[00:33:40] Michael Chan: Yeah.

[00:33:41] Matt Perry: And so I think to ensure at least that those things are open and and and free, I think is really crucial. And that's why I, you know, stuff like the European privacy laws bug me because the experience of using websites is poorer for it.

[00:34:00] Michael Chan: Yes.

[00:34:00] Matt Perry: It sounds like, I mean, people have the ideals that the the privacy laws are more important, but I just, it's a competitive disadvantage for the open media. And that scares me. And it's the same with Chinese censorship. I think that that is fucking immoral. Like, seriously, I think they should be ashamed of themselves. Not as a people, but the government. Anyone who's who's that pathetic that they are scared, they're so scared of their own position that they have to censor Winnie the Pooh memes. Oh, right. Like, goddamn. Like, how, come on, man. Like, take a- Lick. Do you know what I mean? Like there are a lot. Can you imagine Trump? Or I mean, I can imagine him wanting to, but I mean, he gets shit and rightly in my opinion, but Theresa May, like she can't dance on stage without getting it ripped out of her for weeks. The British media and British people are vicious against these people. I don't want to live in a society where we can't be like, you should be able to, because it's punching up.

[00:35:05] Michael Chan: Yeah.

[00:35:06] Matt Perry: And if you're someone who's on top and you can't accept a bit of punching up, then fucking get off. Like, you know what I mean? You don't deserve that that status, basically. And I find that terrifying. I just think the whole ideals of the internet that I kind of, the thing I aspire it to be, are like slowly being eroded by that and misuse. Like we've seen recently, like it's affecting society, but I don't know if it's always for the better.

[00:35:34] Michael Chan: Yeah.

[00:35:35] Matt Perry: And that terrifies me because I, as a little bit of an optimist and an idealist, I don't wanna see it go down a dark route. And I feel like we have actually started walking down one.

[00:35:46] Michael Chan: Yeah, it's been under attack. I mean, especially here, you know, we had the net neutrality stuff kind of get reversed and it's like, it's scary times right now.

[00:35:55] Matt Perry: I think that's a good one as well. Yeah, net neutrality. Is so important. It's an open media, that's the point. Yeah. So I don't know what the future for the web is, but I'd rather- even if it continues to get shit, I don't want it to be irrelevant. That's the one thing. So if it, you know, that way we've lost anyway. No matter what the character is of the internet, the way we'll lose is if it becomes outmoded or out-fashioned, because people don't care. Like, the sad thing is people don't care about privacy or their data really. They just want something that's nice and works well. Yeah. Which is fair, but I do think that it's a it's a weak spot because we can't rely on these things as like features. We can't say that our openness is a feature because do people care? Like not always.

[00:36:41] Michael Chan: Yeah.

[00:36:42] Matt Perry: So yeah, so even though it's just one facet of this, like performance is another big one. There's plenty of big ones, but animation to me is a very visual way that the web might just start to look outdated. The same way you watch a TV show that was um from the from the '90s or the early 2000s, it looks crap already.

[00:37:03] Michael Chan: Yeah.

[00:37:03] Matt Perry: Like we're that we're that TV show. We're the 4:3 of of digital media.

[00:37:11] Michael Chan: Yeah, I totally pick up what you're saying. Yep.

[00:37:18] Matt Perry: But at the same time, like, I don't know, something I feel- I worry that it's unearthing like a true face of us as a race. Like, you're starting to see some real nasty sides that I think people say, well, that it was always there, it was just hidden.

[00:37:36] Michael Chan: Yeah.

[00:37:37] Matt Perry: It's like, but I don't know if it's better that it's out because it's hurting a lot of people's feelings. And it's not that that's the be-all and end-all, but it does lead to a wide acceptance. For instance, the trans- you know, they're talking about stripping the trans identity in America.

[00:37:53] Michael Chan: Yes, yeah.

[00:37:54] Matt Perry: What the fuck is that? And they wouldn't have felt comfortable doing that without this general acceptance. Do you know what I mean? The normalized- the continued normalization of this kind of opinion.

[00:38:05] Michael Chan: Yes.

[00:38:05] Matt Perry: And the internet has definitely facilitated that.

[00:38:08] Michael Chan: Yeah.

[00:38:09] Matt Perry: And that, well, I say, I keep saying the internet, I'm using it interchangeably really for the web. Sure. It's not email's fault. It might be, I don't know. I've not read the-

[00:38:18] Michael Chan: No one's blameless.

[00:38:19] Matt Perry: Yeah, exactly. Everyone's involved. So yeah, so although I, you know, I I I do think it's important that it lives because I don't see a better alternative. Like what is the alternative? A, are we gonna depend on a company to enforce our morals for us or a government? 'Cause you know, we've seen how that, you know, the Chinese censorship machine is is very, it's not about preserving people's rights, it's the opposite.

[00:38:44] Michael Chan: Yeah, yeah.

[00:38:45] Matt Perry: And um, you know, we've got various stuff, we've got a bit of censorship ourselves for copyright holders in the UK. Is that a good or bad thing? I don't know, like obviously copyright holder, you know, piracy is probably bad overall, but at the same time, that the the ability for a government to enforce that I I I struggle. I I struggle.

[00:39:06] Michael Chan: Yeah, it feels like— I I I think we've talked about this on the show before, but everyone wants to close the door behind them. And that doesn't feel right. And when we empower people to do that, right, they they rise up to power and now they shut down the parts of the internet that have caricatures of them as Winnie the Pooh, right? Like this isn't this isn't appropriate.

[00:39:28] Matt Perry: Yeah.

[00:39:29] Michael Chan: Um, we all have a tendency to want to close the door as soon as uh as soon as we've kind of passed that threshold. Um, but like the beauty of, you know, democracy and and all these things, like everyone has like an equal vote and like everyone's on equal footing. And that's beautiful. The beauty beauty of the web is that you can put a website up and be on like an equal playing field as anyone else. And we've seen, you know, amazing startup stories that go from nothing into these, you know, amazing corporations and then them being taken down by that same story again. And yeah, it's it's a it's a powerful thing and it drives innovation.

[00:40:11] Matt Perry: Yeah. But then likewise, as you say, they're shutting the door. Like Netflix weren't perhaps as involved in the net neutrality debate this time as they were when it prevented their rising star.

[00:40:24] Michael Chan: Yeah.

[00:40:24] Matt Perry: So you do get that pulling up the bridge or the the ladder, sorry.

[00:40:28] Michael Chan: Yeah, yeah.

[00:40:29] Matt Perry: And you see it a lot. And I think, again, that's is that just a really unfortunate side of humanity? I don't know. Like it's always been there, is that? Yeah.

[00:40:39] Michael Chan: It's sticky.

[00:40:41] Matt Perry: Yeah, yeah. Um.

[00:40:44] Michael Chan: But bringing it back, this is uh this is what excites you about animation for the web in particular. Is that you feel like this is allowing you to give people the tools to make a better experience and kind of preserve the web as a platform.

[00:41:02] Matt Perry: Yeah, exactly. And I want to- at the moment, this like this syntax that I feel like is is simple, but I want to keep going and just keep building layers of abstraction on this so that at some point you can just describe your interface in terms of maybe personality or whatever it is. Yeah. And it starts, you know, becoming or interacting with the user in those in those terms. And I feel like every layer is just another step towards that very, you know, because if you think about the world in 20 years and the fidelity with which we'll be creating these virtual worlds, you aren't gonna get character artists going in and creating every or sorry, you're not gonna get environment artists going in and handcrafting every texture. You're gonna need some level of inference.

[00:41:50] Michael Chan: Yeah.

[00:41:51] Matt Perry: Like there's gonna be, you know, some, I don't know if it's an algorithm or what it is, but you say, I want wood, so to speak, and that is a very generous AI there. You say you want like a wood texture and it will give you one like this completely unique.

[00:42:08] Michael Chan: Yeah.

[00:42:09] Matt Perry: And uh maybe, I don't know, But I feel like that needs to come through in our UIs as well. We need to just be able to say or declare in a declarative manner. Declarative way. Because if you've got if you've got like an an API like that, then the stuff I'm doing or talking about with uh POSE as a as a syntax, as an object, that doesn't start to look that imperative any— uh sorry, that that doesn't start to look that declarative anymore. Yeah. When you can just go and say, give me a playful interface, make this modal come in playfully. Then actually when you're typing out the individual properties that make a playful interface, that gets shifted on the spectrum further towards imperativeness. Because you're getting in, you're getting stuck into the weeds there. So I wonder if- and I don't think this is just gonna be animation, I think there's gonna be maybe more abstractions in other areas as well. Because I kind of think there has to be. There'll be so much software.

[00:43:04] Michael Chan: Yeah.

[00:43:06] Matt Perry: Soon that there needs to be a very simple- and that'll be democratizing too, because you'll be able to say, you know, your mom will be able to say- I mean, I don't know, your mom, she might be a great web developer.

[00:43:17] Michael Chan: She's not. Okay. No offense taken.

[00:43:19] Matt Perry: Um, uh, no, mine's awful. She, um, so, you know, she might be able to- in the future, you want to create a virtual space and you could just describe it in the terms you want, and the computer will know how to interpret that as an environment, as an atmosphere perhaps, in so many different ways. And this is so that's just one small part, just this animation will be one small part of this broader trend. But I'd like to be on that trend, just to make it because I just because I like animations. Someone out there probably really likes wood.

[00:43:53] Michael Chan: Hey Alexa, make me a calm outdoor environment.

[00:43:59] Matt Perry: Yeah, exactly. And I genuinely think that's exactly what you'll Yeah. In a few, not a few years, but you know, I think that's-

[00:44:07] Michael Chan: Some years.

[00:44:08] Matt Perry: Yeah, yeah, at some point, yeah, why not? Or then it becomes, 'cause that's quite a declarative, uh sorry, that's quite an imperative interface next to you've got just this feeling that you can't express into words. Yeah. This desire, this latent want, and you have no way of expressing that, but the computer knows. Like it can read your brain and just go, well, actually this guy really needs like a calm outdoor space and just produces you want. Like, that's a declarative interface.

[00:44:36] Michael Chan: Fascinating. I've never made that jump to thinking about the computer being able to interpret my creativity, the things that I want, better than I.

[00:44:50] Matt Perry: Yeah.

[00:44:51] Michael Chan: And that's that's an awesome thing to think about.

[00:44:53] Matt Perry: Yeah, 'cause yeah, you're I mean, that is right. You are communicating a lot of these things through your blunt, the blunt instruments of your technical ability.

[00:45:00] Michael Chan: Yeah.

[00:45:01] Matt Perry: I wonder if you know this there's a a layer that we can meld in that has this innate technical ability itself.

[00:45:10] Michael Chan: Yeah, like I'm thinking of a song, right? And then it shows up.

[00:45:14] Matt Perry: Oh, I have definitely hallucinated some incredible songs and I know they're good at the time, but I genuinely, and I'm not gonna spend 20 years learning how to to make it. Yeah. You know, but. Um, some at some point maybe there's uh that layer or that something that can just take that from you, knows what you're hearing and it will produce it for others to experience as well.

[00:45:39] Michael Chan: Yeah.

[00:45:39] Matt Perry: Yeah, I don't know.

[00:45:40] Michael Chan: Man, and maybe even adapt it so that people can experience it the way that you experience it and not through their own or adapt it for their lens, right?

[00:45:49] Matt Perry: Like bypass their prism. Yeah. Yeah, completely. Yeah.

[00:45:56] Michael Chan: Well, thank you so much for uh for that. I have a lot to think about now. It's way more than I assumed that we were gonna get when we started talking about animation. So I really appreciate going deep.

[00:46:07] Matt Perry: Yeah, no, good. I'm glad. I've really enjoyed this. It's my first podcast.

[00:46:11] Michael Chan: Oh, nice. Awesome. Well, welcome to the club. Thanks for being with us. That's all for this episode of React Podcast. For links and show notes, visit reactpodcast.com/35. We'll be in your ears again next week in an episode with Brian Vaughn. We talk profiling and the new React DevTools.