Placeholder Image

字幕列表 影片播放

  • Hello.

  • Excellent.

  • I do have a loud voice, so it probably doesn't really matter if I have a microphone or not.

  • But anyway, this is probably better.

  • Uh, sorry.

  • That was a really great introduction, so I could just skip all the stuff about May.

  • Um, this is last year I attended jazz come for ages.

  • So it's really cool to actually be standing on stage.

  • It's time.

  • Um, But what I'm gonna do is jump right in and tell you about the talk today.

  • I'm gonna talk about variable funds.

  • Ah, we're gonna do a quick explanation of what they are for everyone that doesn't know I will.

  • Very, very briefly touched on performance on.

  • And then we'll just look at some ways that you can implement them to do some practical things, but, uh, my favorite demos are the ones that are a bit fun.

  • So there's quite a few Nice.

  • Uh, So what's important to know is that I'm a developer.

  • I love to design.

  • That looks really terrible, but oh, well, hopefully Oh, wow.

  • It looks so pixelated.

  • That story sad.

  • Okay, well, I guess we'll just have to live with that.

  • Um, So I started reading text effects like a couple of years ago.

  • And, ah, during my experiments, I started playing with variable fonts, and it became really clear to me very quickly that they offer a lot of unique opportunities that standard funds just can't provide us.

  • Uh, so the reason for that is that variable fonts, basically one front file that acts like multiple fonts, and that's basically the crux of what they are on.

  • What that means is that where we might have normally had maybe six different font styles as separate individual files, you can now have all of that information in the one file.

  • Instead, that looks not too bad.

  • So that's good.

  • The way this is achieved all comes down to the way that the font itself is created.

  • So a variable front can have one or more axes on.

  • What they do is provide different variations between different extremes.

  • So in this case, we have a lot to a bold white.

  • Now, along that access, you can have named instances like regular and bold, which is things that we're used to seeing in accord on the Web.

  • But you also gain the ability to interpret late between those values, and this allows for intermediate designs, providing much finer control over the front itself.

  • So along with Doris standard values, you can have everything in between as well, like auditory 307 on.

  • That includes decimal places.

  • And because the accesses interpolated, it means that we can animate between the values, creating really smooth transitions between the variations.

  • But we're not just limited to a single access at a time.

  • A variable front can contain thousands of axes, and what you get out of this is the Inter appellation isn't just applied to one access at a time.

  • It's applied to the combinations of those axes as well.

  • So if you wanted to have a wide heavy fund or a really now very thin fun, you can have that all within the one file.

  • So, in essence, a variable fund gives us a single file with a greater amount of variation on a significant increase in style choices on they don't just have to be standard things like front, white or wit.

  • It could be something totally different or a little bit weird.

  • Um, like Decker of all this is probably my favorite fun.

  • It's by a design, a cold David Beller.

  • It's the 1st 1 that I have applied with, and it has a lot of different creative axes in it that you can do all something's way.

  • Then we'll have a look at some demos later.

  • Now, the way that we use variable funds is really similar to how we would normally use fronts on the Web.

  • For the most part, we set it up exactly the same way as we normally would announce CSS using front face.

  • The main difference is how we define variations for descriptors like front way frontstretch and font style.

  • So in this example, we might have previously set a front face block for the light version.

  • And then we do another one for the bold vision and so on until we hit all of our styles.

  • But with variable funds, you don't need to do that.

  • You can simply define arrange for the front wait.

  • So in this case, I'm going to 100 to 700.

  • And then from here, when we referenced in a CSS, we do it exactly the same way that we normally would.

  • But instead of being limited to values like bold or 700.

  • You can pick any number between 207 100 like 650 now.

  • This is really, really good for something like white because we've already got a CSS property that we can use in the land off variable fonts.

  • This is known as a registered axis, and all that means is that it's being standardized in the speck.

  • At the moment, there are five registered axes, white with slant italics and optical size, and they're all match to pre existing CSS properties.

  • But if you want to use something more custom, like the decker of our examples, we're going to need a new CSS property, and that's cold front variation settings.

  • Now, this is an example of a front that I have invented called my jelly font.

  • Jell O is the name of my dog he does feature in this presentation, so look out is very cute.

  • Um, in fun creation settings, you can define as many registered or custom axes as you want, so he I have true custom axes.

  • One is called Jell O, and one is called fellow and they both have an associate ID number Value.

  • Custom access codes are defined by the front creator inside the font, and there are always four characters.

  • Where is a registered access that's defined in the specs Now?

  • As I said, you can use registered axes in front creation settings.

  • However, it is strongly recommended that you use the map CSS property instead.

  • So I like front.

  • Wait, and the reason for this is it's not really.

  • This is kind of like a back up if the access doesn't exist because there's a lot of custom stuff.

  • But to be honest, it's way easier to manage your typography if you use the map properties when you can.

  • Anyway, I'm sure people wondering about rather support it's actually really, really good.

  • I'II doesn't support it, but that's not unexpected.

  • They're not developing that anymore.

  • So you know it's fair.

  • Um, the oniy cavey it to these brothers.

  • Support is you do need more modern operating systems.

  • So on Mac, I believe it's High Sierra.

  • Some of the browsers rely on the operating system versions in order to for it to render.

  • If you are worried about bras and support and you have to support I, still, which a lot of us dough you can use the CSS feature detection to detect for support off front variation settings.

  • And then you can fall back to, ah, a standard fund if terrible fronts are not supported.

  • So there are options there for us if we need to support it in browsers that don't currently support bearable funds.

  • But to be honest, it's pretty good, and you probably going to get away with that.

  • I'm using them from moist use cases.

  • So, as I said earlier, I did want to briefly talk about performance because it's a question people often ask.

  • There's a whole lot of stuff around Web phone performance that can impact this.

  • I'm not gonna go into it cause that's like 40 minutes of a talk on its own, but essentially everything that you apply to a Web.

  • Funds on the Web now also apply to variable fonts, but there are a couple of things that I wanted to specifically mention because I get asked about it a lot.

  • The 1st 1 is the number of front requests, and the 2nd 1 is fun, false eyes so often, when we think about reducing the number of front request to improve prove outfront performance, it means that we would plan out typography choices, and we'd weigh up the cost of design over the cost of performance.

  • And this is why we have that rule where you can only have, like, three fonts in your website.

  • That's a employs limitation because of things like performance.

  • But because variable fronts can contain all that information in one file, that means we've immediately reduced the number of front request simply by using a variable font.

  • However, if all of that information now existing one file instead of three, what's that gonna do to file size?

  • So that brings me to file sizes.

  • You'd be right in assuming that a variable phone is going to be larger than a standard fun.

  • Typically not always, but typically so I want to give you a bit of a comparison.

  • I'm gonna use Source Ends pro, which is on get Hub.

  • The single weight off source ends pro is approximately 234 kilobytes.

  • It varies a little bit depending on the star, but it's about that in the O.

  • T.

  • F file version.

  • Now, if we use a more efficient front, wait for Matt like wolf to that will drop down to about 111 kilowatts.

  • That still seems like a lot.

  • But keep in mind that source hands have, like lots of language, characters and stuff in it, so you can sub set this to make them even smaller.

  • I'm pretty sure when I subsidies to like English characters, it came down to six days, so that is always an option.

  • Now the variable fund, the I T.

  • F, is very large.

  • It's 405 kilobytes, but the wolf to is only 112 which is only one kilobyte more than a single weight.

  • And I get a lot more options with that.

  • So to me, in this case, if you're using efficient fun, um, formats, you get a lot more design opportunity with very minimal impact to performance.

  • But as I alluded to it, this is obviously going to depend on a phone by phone by Isis.

  • It's not always going to be better to use a variable fun.

  • It's not always going to be better to use a standard phone, so you do need toe, do your research and check this stuff out beforehand.

  • If anyone wants to talk about terrible phone performance, come see me afterwards.

  • Have done a presentation on it before so we can have beautiful in depth discussions about it.

  • Sorry, we talked about rather support.

  • We kind of know what they are.

  • Hopefully talk a little bit about performance and how we can use them in our CSS roll across that with that in mind, now we can start to shift our focus.

  • We no longer need to really tradeoff design for performance.

  • In my opinion, variable funds are really great way to move past that and we gain much more flexibility in our design opportunities designs which would have previously been a really heavy burden on performance or impossible because of technical limitations like the fun weights or whatever not existing they're now completely possible on.

  • We can start to forget about a lot of the perceived limitations and figure out how we can use this technology to create better or more interesting experiences.

  • For I use is on the tourney and the intent of our words can be more effectively represented.

  • We less worry over the impacts of lighting in too many phone whites and more importantly, and this kind of goes towards the the first presentation is that we can start to embrace the learnings and the growth of print design.

  • I am gonna adhere.

  • The reason I'm not a designer is because of stuff like this.

  • Um, it's really ugly, but it's so cute.

  • So I've left it in.

  • That's my dog's instagram, too, by the way, should follow him.

  • He's very cute, but unlike print design, right, we can benefit from the flexibility and the interactive nature of the Web.

  • Because variable fonts can have an interpolated range of values.

  • We can create animations or transitions with the text itself without relying on things like SPG or canvas or, you know, complex Java script stuff.

  • And we can achieve these effects using techniques we might already be familiar with, like CSS animations, transitions or JavaScript.

  • Events like report resize grow position, sends a P eyes, that kind of stuff.

  • So what we gonna do now is gonna look at how we can animate and interact with variable funds to create things that practical to use but also a little bit fun, and we gonna stop with that grass effect that I just showed you.

  • So the grass or grow effect I use is a font Co decorate bar, which I showed you earlier.

  • I'm gonna use two of its axes.

  • One is cold in line and one is cold.

  • Skeleton worm.

  • So this is what in line looks like on its own.

  • It's kind of like a hitch.

  • Pretty nice.

  • Put my clicker down.

  • I should have done that.

  • Yep.

  • And this one is skeleton worms.

  • So at its maximum value off 1000 it's like little noble things.

  • Now when you combine these together, that's how we get the leaves from the effect.

  • So once we've set up that base CSS with the front family and out two axes, we can create our animation.

  • Now I'm just gonna use a key frame animation.

  • It's got starts at zero.

  • We set boys in line and Skeleton worm to their maximum values of 1000 at 50% we set skeleton, went back to zero, and then it's just gonna loop background on what this will do is we'll start expanded, you know, disappear and then we'll come back out again.

  • We add the animation to our hate one.

  • It runs infinitely.

  • It's called Grow Four Seconds and that's it.

  • That's how I made that, uh, all I did was add a little bit of extra CSS for texture.

  • It's a couple of tech shadows and a background image.

  • For the most part, the heavy lifting is done by the font.

  • I'm a bit of a lazy developer.

  • The least I can write the better.

  • And variable fonts make this stuff sorry.

  • Easy, because they've already done all of the work for you in the front itself.

  • So we just a little bit of CSS.

  • You could make all sorts of things you can do.

  • Writing texts.

  • This is a front buy underwear, this one's decorate bar again.

  • This uses blend boards.

  • This is a simple one, using a hover state with transition changing wth e white as you hover over it.

  • Code gingham.

  • I don't really know how to describe this one, Um, but it's cool.

  • This is my favorite Demery, and the reason that I love these Demory to decorate bargain decker fires like the best font David Bello is the best.

  • What I love about this is that if you have a look at it, it's got a really long text Shadow applied to it, but what it demonstrates is that As you modify the variable fund, the techs shadow disappears with it because we're actually changing the front itself.

  • We're not just applying effects over the top of it, and I think that is a really beautiful and perfect demonstration of what makes variable funds so different.

  • But it's not just that they're beautiful or they're cool or any of that kind of stuff.

  • What they demonstrate is that as developers and designers, we can control the font itself.

  • And that means that variable fronts allowed typography on the Web to adapt to the flexible nature of our screens, our environments and our devices on.

  • There's currently a lot of what being done with CSS made inquiries.

  • The level five spec it's in dropped at the moment, but it aims to give us control over our designs based on environments, lot contrast and Collis games.

  • And even though it's in dropped stages, there's one which I'm sure some of you know about which we can play with.

  • Cold prefers Cole's game and doc mode.

  • I'm gonna show you a really cool example.

  • I've just talked it up.

  • I heard you still think it's cool anyway, what I've got here, I'm using a phone call.

  • Chee.

  • It's by owner type quote.

  • It's got a access cold temp.

  • I'm gonna set that it zero to start with, mounting a transition so you can see it animate for demo purposes.

  • But then we use the media query or prefer Collis game and we check for Doc.

  • And if it's in dark, Lord, I'm gonna change the access to 1000.

  • This is what it looks like.

  • So as you switch to Doc, it uses because it's a dog, right?

  • And when it goes back to light, it goes back to the normal state that looks sore bad on that screen.

  • At least it kind of works with the ruse.

  • But sorry, the interface is not great.

  • But we can apply that kind of concept to our typography, to adjust all sorts of things like screen wits on that might allow us to change the front way based on ah, whether the screen is larger or smaller.

  • Well, other things like wits and optical size as well and where the view port is wide, we might have more detail or its small Lina more confined space.

  • We can reduce the width of the front and we could make the moist of different JavaScript events like Resize Scroll Mass Move, and we can create all kinds of interesting storytelling and experiences on the Web.

  • I spent more time trying to figure out what went to put in this, and I did writing code for it to work.

  • I really like this example.

  • It's no everyone else's favorite, but I think it's great.

  • Now the good thing about thes kinds of examples is that once you have the formula for modifying the fund, you can apply it to basically anything on.

  • I'm going to show you what that formula is so that you can go away and you could make all sorts of fun things with variable fonts.

  • So what we're gonna do is, if the fun if the view port size is big or small like as it changes, we're gonna change the front way as a simple demonstration.

  • The problem is, we might have a front weight of, say, 200 to 900 a view port size of 3 20 pixels to 14 40 pixels.

  • So we need to align these three sets of values, which are not only different ranges but also different measurements.

  • So what we gonna do re is start off with a minimum and maximum access and event values, which is what these numbers are.

  • So 209 100 for the font.

  • And 3 22 14 40 for the report.

  • It's basically setting the start and end point so that it doesn't just go on infinitely.

  • So now that we've got a minimum and maximum values, we gonna get the current V port wit.

  • So the current event value, we can do that with something like window.

  • I don't Inuit, for example.

  • Now, once we have that, what we want to do is change the pixel values to something more usable.

  • So we're gonna convert it to a decimal place.

  • Ah, So what we do here is we take the current size that we just set with window Inuits, and then we minus the minimum size of the view port, and then we divide that by the maximum minus the minimum, and that's going to give us a value between zero and 0.99 which we can then use to determine what I found.

  • White is going to bay, so we take that new decimal, um, and we multiply it by the minimum white, minus the maximum weight.

  • And then we add the maximum weight back on again.

  • What that's going to do is give us a value between 200 to 900 based on the view port size.

  • Then you can update the value in your CSS.

  • However you normally would.

  • I'm using CSS custom properties.

  • I have a custom property called Wait.

  • Sorry.

  • I'm basically saying update my custom property of weight with my new calculated front.

  • Wait, and then that will update it in my CSS.

  • So you can chuck that, you know, function or something like that.

  • And then what we're gonna do is add an event.

  • Listen, awful resize chuck out function in there, and what that's going to do it in its simplest form is changed the front way.

  • Based on the people with now, you can do all sorts of things for performance and stuff.

  • But in its simplest form, that's what it does.

  • And it might be something like this.

  • Oh, wow.

  • So he pixelated.

  • So sorry.

  • Um, now what I'm doing here is I'm actually changing the front way based on the people which was It gets smaller, the front wait gets heavier, and I'm changing at different rates, depending on the paragraph.

  • But what I'm also doing is changing the width of the headlines so that it doesn't wrap onto a new line on what this means is that I can maintain the integrity off my design rather than just wrapping it onto a new line and stacking everything.

  • And I think this is really valuable and really, really useful when we're talking about all of the different screen sizes and devices that are out there now.

  • And as I said this car, it could be used to change all sorts of things.

  • Um, when I made this, I didn't associate it with the fact that my phone is completely smashed, but it's actually quite funny in hindsight.

  • Um, so this uses the device.

  • Umm, position and orientation all we can do something really interesting.

  • This one will respond to toe audio imports.

  • I'm gonna switch in a minute, but there's a couple things I wanted to mention about it special.

  • Thanks to Ruth, I don't know she's here yet, but she's gonna be here doing stuff tomorrow.

  • I originally right the cord for these with a library, and I didn't think it was quite right.

  • And she gave me some new cord for which is super cool.

  • All right, let's try switching.

  • So I'm just gonna let it use my microphone.

  • Hey, um, I have a really loud voice, so it trig is it?

  • Oh, I probably shouldn't have made it so sensitive.

  • But as you can see, what's happening here is is responding to the sound of my voice, and it's taking that audio input and reacting accordingly.

  • And this is really interesting for things like conversational you wise.

  • So you that you can visually represent the tone or the intent of a peasant's imports.

  • So, like if they're really loud, maybe it's like super bold or if they're really quiet, Maybe it's, you know, really thin.

  • Um and I just I think this is like a really cool, uh, future possibility for us as things like the Google home and Alexa become more and more prevalent.

  • So what's next?

  • Oh, this one.

  • Yeah, is really cool.

  • One moment, please.

  • So I'm just gonna Where's my mouth?

  • Switch back over.

  • I'm gonna go full screen for this one.

  • Sign this pond is called Whoa!

  • Which I just heard some of you say, Ah, by scribble tone.

  • I kind of wish they called it slinky, but whoa kind of works.

  • What this is doing is it's changing based on the mass position, and it's got three axes that you can modify.

  • Um, there's, Ah, vertical horizontal.

  • And then there's a rotation, and I'm just passing.

  • The X and Y coordinates are to the variable front with that cord that I just showed you to update the axes.

  • I really like that example cause the fonts are cool thing tonight about this Is that essentially again?

  • All the hard work is done in the phone like that is an incredible creation what they've done there, and it's just simply spectacular.

  • This is a good opportunity to bring yourself closer to people who create funds, because I kind of feel like at the moment we're very separate.

  • But now that we can start to control the phone cord and on the Web, I think this is a really good opportunity to come together and, like work on things and solve problems together.

  • But we can also do, um, some other interesting things, like improve the legibility off our text with new features that allow us to query the characteristics of the user's display or light level.

  • So this demo and I'm gonna show you currently or any works behind a flag, so the support isn't great, but it is a good demonstration off the opportunities for the future.

  • What I'm gonna do fast to show you a little bit of card.

  • Um, so I didn't show you this before, but this is essentially what the CSS looks like with the custom property.

  • The fun I'm going to use his coat tiny and on what I'm doing is passing a value to my custom property and then updating it in the front Wait value we set up out day photo based range is just like before.

  • But instead of you put with we using an ambient light sense of value and then ah, we're going to set up the Ambien lot sent saw.

  • Sorry.

  • In this case, we check if we have access to the ambient light sensor.

  • If we do, we create a new instance of that sensor.

  • And then what we can do is start to gather readings from the sensei using the on reading event handler.

  • Now, the reading frequency is decided by you.

  • You can pass an optional value to the senses, constructor.

  • And that will specify the number of ratings per second.

  • I'm not going to do that for simplicity, but you can do it.

  • And then what we do is we passed that same function that I showed you before.

  • Um, I've called it fluid access variation with all of our values, including the sensor dot eliminates rating, which is what we get out current value from.

  • Ah, and then the final step is telling the sense it to stop.

  • So the function with the values in it manually might look something like this.

  • But now I'm gonna show you what it actually looks like.

  • This is probably I saw a lot of demos in my favorite, but I think this one really is my favorite promise.

  • All right, I'm just gonna get my handy device here.

  • Gonna change the light input.

  • So sorry if I'm shining my light in anyone's eyes in the front, Roy.

  • Perils of the front.

  • Roy.

  • Um, So what I'm doing is it's detecting and changing the light around my computer laptop.

  • Sensa and then the fund is responding to it now.

  • This is, like, really cool, right?

  • It's it's responding to the user's environment.

  • And you can use this to change the way things are represented in loyal I environments to improve legibility, accessibility and usability of your sites.

  • But also on this is fun for May, you could create some really cool ah, like storytelling experiences like If it was really Doc, you could make some, like, Cool Thing where it gets Old Doc and creepy.

  • I'm old.

  • The reverse of that unicorns could appear to make people feel safe.

  • Unicorns.

  • I wish I wore my unicorn pants instead of my space ones.

  • We'll have to like like that out next time.

  • Hang on one second wife, Switchback coop.

  • So basically, it's only because variable fronts give us this Mork greater control over each of these elements that we can start to fine tune the different front characteristics to maximize the ledge ability, the readability and the accessibility of our website text on.

  • While they might seem a little bit trivial, Um, and you might be like, Well, I'll never use that the demonstration's off the possibilities and like I said, like this isn't just about fun stuff.

  • It does give us an opportunity to respond to our users environments and at their unique circumstances.

  • It's a level of control over funds that's unprecedented for us, and I hurt by the end of this conference, you'll agree.

  • But in my opinion, it's never been a better time to be a developer or a design on the Web.

  • Maribel Fonseca's one off the many things that open up doors that have never existed for us before on we can combine these things in any number of ways to think more creatively for our users and to solve problems in more creative ways and with variable funds at the very laced we have the opportunity to improve performance.

  • But at its best we can make websites that are more usable, more accessible and more meaningful.

  • And that, too, May is what gets me really, really, really excited about the future of Web typography.

  • So I have some resource is which I'll share out, should follow breath for her awesome audio stuff.

  • Um, specifically, though I made this website, where are we?

  • It's called variable funds for developers.

  • He's another cool fun.

  • Hey, I forget what?

  • This one's cold.

  • I should know this because I met the other day.

  • It's got, um Ah, this is kicked in Mobile Virgin.

  • Sad that the, um, aspect ratio of this is very low.

  • Anyway, it's got our tutorials for how to make the light sense of Demory on the Gro Demery.

  • And I will add a whole bunch more on here in the next few weeks.

  • There's also a getting started page which will go through the basics off, setting up and using variable fonts that you can go three and have a look at if you want.

  • It's called variable funds dot dev.

  • Um, putting this microphone down.

  • Switching is really hot.

  • Thanks, everyone.

Hello.

字幕與單字

單字即點即查 點擊單字可以查詢單字解釋

B1 中級

可變字體與螢幕和設備的靈活性質,Mandy Michael - JSConf.Asia 2019年。 (Variable Fonts and the Flexible Nature of Screens and Devices by Mandy Michael | JSConf.Asia 2019)

  • 1 0
    林宜悉 發佈於 2021 年 01 月 14 日
影片單字