A Front End Developer’s Guide to GraphQL

Post pobrano z: A Front End Developer’s Guide to GraphQL

No matter how large or small your application is, you’ll have to deal with fetching data from a remote server at some point. On the front end, this usually involves hitting a REST endpoint, transforming the response, caching it, and updating your UI. For years, REST has been the status quo for APIs, but over the past year, a new API technology called GraphQL has exploded in popularity due to its excellent developer experience and declarative approach to data fetching.

In this post, we’ll walk through a couple of hands-on examples to show you how integrating GraphQL into your application will solve many pain points working with remote data. If you’re new to GraphQL, don’t panic! I’ll also highlight some resources to help you learn GraphQL using the Apollo stack, so you can start off 2018 ahead of the curve.

GraphQL 101

Before we dive into how GraphQL makes your life as a front end developer easier, we should first clarify what it is. When we talk about GraphQL, we’re either referring to the language itself or its rich ecosystem of tools. At its core, GraphQL is a typed query language developed by Facebook that allows you to describe your data requirements in a declarative way. The shape of your result matches the shape of your query: in the example below, we can expect to receive back an object with a currency property and a rates property containing an array of objects with both currency and rate keys.

{
  rates(currency: "USD") {
    currency
    rates {
      currency
      rate
    }
  }
}

When we talk about GraphQL in a broader sense, we’re often referring to the ecosystem of tools that help you implement GraphQL in your application. On the backend, you’ll use Apollo Server to create a GraphQL server, which is a single endpoint that parses a GraphQL request and returns data. How does the server know which data to return? You’ll use GraphQL Tools to build a schema (like a blueprint for your data) and a resolver map (just a series of functions that retrieve your data from a REST endpoint, database, or wherever else you choose).

This all sounds more complicated than it actually is — with Apollo Launchpad, a GraphQL server playground, you can create a working GraphQL server in your browser in less than 60 lines of code! 😮 We’ll reference this Launchpad I created that wraps the Coinbase API throughout this post.

You’ll connect your GraphQL server to your application with Apollo Client, a fast and flexible client that fetches, caches, and updates your data for you. Since Apollo Client isn’t coupled to your view layer, you can use it with React, Angular, Vue, or plain JavaScript. Not only is Apollo cross-framework, it’s also cross-platform, with React Native & Ionic supported out of the box.

Let’s give it a try! 🚀

Now that you’re well-versed in what GraphQL is, let’s get our hands dirty with a couple of practical examples that illustrate what it’s like to develop your front end with Apollo. By the end, I think you’ll be convinced that a GraphQL-based architecture with Apollo can help you ship features faster than before.

1. Add new data requirements without adding a new endpoint

We’ve all been here before: You spend hours building a perfect UI component when suddenly, product requirements change. You quickly realize that the data you need to fulfill these new requirements would either require a complicated waterfall of API requests or worse, a new REST endpoint. Now blocked on your work, you ask the backend team to build you a new endpoint just to satisfy the data needs for one component.

This common frustration no longer exists with GraphQL because the data you consume on the client is no longer coupled to an endpoint’s resource. Instead, you always hit the same endpoint for your GraphQL server. Your server specifies all of the resources it has available via your schema and lets your query determine the shape of the result. Let’s illustrate these concepts using our Launchpad from before:

In our schema, look at lines 22–26 where we define our ExchangeRate type. These fields list out all the available resources we can query in our application.

type ExchangeRate {
  currency: String
  rate: String
  name: String
}

With REST, you’re limited to the data your resource provides. If your /exchange-rates endpoint doesn’t include name, then you’ll need to either hit a different endpoint like /currency for the data or create it if it doesn’t exist.

With GraphQL, we know that name is already available to us by inspecting our schema, so we can query for it in our application. Try running this example in Launchpad by adding the name field on the right side panel!

{
  rates(currency: "USD") {
    currency
    rates {
      currency
      rate
      name
    }
  }
}

Now, remove the name field and run the same query. See how the shape of our result changes?

the data changes as you describe your query differently

Your GraphQL server always gives you back exactly the data you ask for. Nothing more. This differs significantly from REST, where you often have to filter and transform the data you get back from the server into the shape your UI components need. Not only does this save you time, it also results in smaller network payloads and CPU savings from loading and parsing the response.

2. Reduce your state management boilerplate

Fetching data almost always involves updating your application’s state. Typically, you’ll write code to track at least three actions: one for when the data is loading, one if the data successfully arrives, and one if the data errors out. Once the data arrives, you have to transform it into the shape your UI components expect, normalize it, cache it, and update your UI. This process can be repetitive, requiring countless lines of boilerplate to execute one request.

Let’s see how Apollo Client eliminates this tiresome process altogether by looking at an example React app in CodeSandbox. Navigate to `list.js` and scroll to the bottom.

export default graphql(ExchangeRateQuery, {
  props: ({ data }) => {
    if (data.loading) {
      return { loading: data.loading };
    }
    if (data.error) {
      return { error: data.error };
    }
    return {
      loading: false,
      rates: data.rates.rates
    };
  }
})(ExchangeRateList);

In this example, React Apollo, Apollo Client’s React integration, is binding our exchange rate query to our ExchangeRateList component. Once Apollo Client executes that query, it tracks loading and error state automatically and adds it to the data prop. When Apollo Client receives the result, it will update the data prop with the result of the query, which will update your UI with the rates it needs to render.

Under the hood, Apollo Client normalizes and caches your data for you. Try clicking some of the currencies in the panel on the right to watch the data refresh. Now, select a currency a second time. Notice how the data appears instantaneously? That’s the Apollo cache at work! You get all of this for free just by setting up Apollo Client with no additional configuration. 😍 To see the code where we initialize Apollo Client, check out `index.js`.

3. Debug quickly & painlessly with Apollo DevTools & GraphiQL

It looks like Apollo Client does a lot for you! How do we peek inside to understand what’s going on? With features like store inspection and full visibility into your queries & mutations, Apollo DevTools not only answers that question, but also makes debugging painless and, dare I say it, fun! 🎉 It’s available as an extension for both Chrome and Firefox, with React Native coming soon.

If you want to follow along, install Apollo DevTools for your preferred browser and navigate to our CodeSandbox from the previous example. You’ll need to run the example locally by clicking Download in the top nav bar, unzipping the file, running npm install, and finally npm start. Once you open up your browser’s dev tools panel, you should see a tab that says Apollo.

First, let’s check out our store inspector. This tab mirrors what’s currently in your Apollo Client cache, making it easy to confirm your data is stored on the client properly.

store inspector

Apollo DevTools also enables you to test your queries & mutations in GraphiQL, an interactive query editor and documentation explorer. In fact, you already used GraphiQL in the first example where we experimented with adding fields to our query. To recap, GraphiQL features auto-complete as you type your query into the editor and automatically generated documentation based on GraphQL’s type system. It’s extremely useful for exploring your schema, with zero maintenance burden for developers.

Apollo Devtools

Try executing queries with GraphiQL in the right side panel of our Launchpad. To show the documentation explorer, you can hover over fields in the query editor and click on the tooltip. If your query runs successfully in GraphiQL, you can be 100% positive that the same query will run successfully in your application.

Level up your GraphQL skills

If you made it to this point, awesome job! 👏 I hope you enjoyed the exercises and got a taste of what it would be like to work with GraphQL on the front end.

Hungry for more? 🌮 Make it your 2018 New Year’s resolution to learn more about GraphQL, as I expect its popularity to grow even more in the upcoming year. Here’s an example app to get you started featuring the concepts we learned today:

Go forth and GraphQL (and be sure to tag us on Twitter @apollographql along the way)! 🚀


A Front End Developer’s Guide to GraphQL is a post from CSS-Tricks

A Front End Developer’s Guide to GraphQL

Post pobrano z: A Front End Developer’s Guide to GraphQL

No matter how large or small your application is, you’ll have to deal with fetching data from a remote server at some point. On the front end, this usually involves hitting a REST endpoint, transforming the response, caching it, and updating your UI. For years, REST has been the status quo for APIs, but over the past year, a new API technology called GraphQL has exploded in popularity due to its excellent developer experience and declarative approach to data fetching.

In this post, we’ll walk through a couple of hands-on examples to show you how integrating GraphQL into your application will solve many pain points working with remote data. If you’re new to GraphQL, don’t panic! I’ll also highlight some resources to help you learn GraphQL using the Apollo stack, so you can start off 2018 ahead of the curve.

GraphQL 101

Before we dive into how GraphQL makes your life as a front end developer easier, we should first clarify what it is. When we talk about GraphQL, we’re either referring to the language itself or its rich ecosystem of tools. At its core, GraphQL is a typed query language developed by Facebook that allows you to describe your data requirements in a declarative way. The shape of your result matches the shape of your query: in the example below, we can expect to receive back an object with a currency property and a rates property containing an array of objects with both currency and rate keys.

{
  rates(currency: "USD") {
    currency
    rates {
      currency
      rate
    }
  }
}

When we talk about GraphQL in a broader sense, we’re often referring to the ecosystem of tools that help you implement GraphQL in your application. On the backend, you’ll use Apollo Server to create a GraphQL server, which is a single endpoint that parses a GraphQL request and returns data. How does the server know which data to return? You’ll use GraphQL Tools to build a schema (like a blueprint for your data) and a resolver map (just a series of functions that retrieve your data from a REST endpoint, database, or wherever else you choose).

This all sounds more complicated than it actually is — with Apollo Launchpad, a GraphQL server playground, you can create a working GraphQL server in your browser in less than 60 lines of code! 😮 We’ll reference this Launchpad I created that wraps the Coinbase API throughout this post.

You’ll connect your GraphQL server to your application with Apollo Client, a fast and flexible client that fetches, caches, and updates your data for you. Since Apollo Client isn’t coupled to your view layer, you can use it with React, Angular, Vue, or plain JavaScript. Not only is Apollo cross-framework, it’s also cross-platform, with React Native & Ionic supported out of the box.

Let’s give it a try! 🚀

Now that you’re well-versed in what GraphQL is, let’s get our hands dirty with a couple of practical examples that illustrate what it’s like to develop your front end with Apollo. By the end, I think you’ll be convinced that a GraphQL-based architecture with Apollo can help you ship features faster than before.

1. Add new data requirements without adding a new endpoint

We’ve all been here before: You spend hours building a perfect UI component when suddenly, product requirements change. You quickly realize that the data you need to fulfill these new requirements would either require a complicated waterfall of API requests or worse, a new REST endpoint. Now blocked on your work, you ask the backend team to build you a new endpoint just to satisfy the data needs for one component.

This common frustration no longer exists with GraphQL because the data you consume on the client is no longer coupled to an endpoint’s resource. Instead, you always hit the same endpoint for your GraphQL server. Your server specifies all of the resources it has available via your schema and lets your query determine the shape of the result. Let’s illustrate these concepts using our Launchpad from before:

In our schema, look at lines 22–26 where we define our ExchangeRate type. These fields list out all the available resources we can query in our application.

type ExchangeRate {
  currency: String
  rate: String
  name: String
}

With REST, you’re limited to the data your resource provides. If your /exchange-rates endpoint doesn’t include name, then you’ll need to either hit a different endpoint like /currency for the data or create it if it doesn’t exist.

With GraphQL, we know that name is already available to us by inspecting our schema, so we can query for it in our application. Try running this example in Launchpad by adding the name field on the right side panel!

{
  rates(currency: "USD") {
    currency
    rates {
      currency
      rate
      name
    }
  }
}

Now, remove the name field and run the same query. See how the shape of our result changes?

the data changes as you describe your query differently

Your GraphQL server always gives you back exactly the data you ask for. Nothing more. This differs significantly from REST, where you often have to filter and transform the data you get back from the server into the shape your UI components need. Not only does this save you time, it also results in smaller network payloads and CPU savings from loading and parsing the response.

2. Reduce your state management boilerplate

Fetching data almost always involves updating your application’s state. Typically, you’ll write code to track at least three actions: one for when the data is loading, one if the data successfully arrives, and one if the data errors out. Once the data arrives, you have to transform it into the shape your UI components expect, normalize it, cache it, and update your UI. This process can be repetitive, requiring countless lines of boilerplate to execute one request.

Let’s see how Apollo Client eliminates this tiresome process altogether by looking at an example React app in CodeSandbox. Navigate to `list.js` and scroll to the bottom.

export default graphql(ExchangeRateQuery, {
  props: ({ data }) => {
    if (data.loading) {
      return { loading: data.loading };
    }
    if (data.error) {
      return { error: data.error };
    }
    return {
      loading: false,
      rates: data.rates.rates
    };
  }
})(ExchangeRateList);

In this example, React Apollo, Apollo Client’s React integration, is binding our exchange rate query to our ExchangeRateList component. Once Apollo Client executes that query, it tracks loading and error state automatically and adds it to the data prop. When Apollo Client receives the result, it will update the data prop with the result of the query, which will update your UI with the rates it needs to render.

Under the hood, Apollo Client normalizes and caches your data for you. Try clicking some of the currencies in the panel on the right to watch the data refresh. Now, select a currency a second time. Notice how the data appears instantaneously? That’s the Apollo cache at work! You get all of this for free just by setting up Apollo Client with no additional configuration. 😍 To see the code where we initialize Apollo Client, check out `index.js`.

3. Debug quickly & painlessly with Apollo DevTools & GraphiQL

It looks like Apollo Client does a lot for you! How do we peek inside to understand what’s going on? With features like store inspection and full visibility into your queries & mutations, Apollo DevTools not only answers that question, but also makes debugging painless and, dare I say it, fun! 🎉 It’s available as an extension for both Chrome and Firefox, with React Native coming soon.

If you want to follow along, install Apollo DevTools for your preferred browser and navigate to our CodeSandbox from the previous example. You’ll need to run the example locally by clicking Download in the top nav bar, unzipping the file, running npm install, and finally npm start. Once you open up your browser’s dev tools panel, you should see a tab that says Apollo.

First, let’s check out our store inspector. This tab mirrors what’s currently in your Apollo Client cache, making it easy to confirm your data is stored on the client properly.

store inspector

Apollo DevTools also enables you to test your queries & mutations in GraphiQL, an interactive query editor and documentation explorer. In fact, you already used GraphiQL in the first example where we experimented with adding fields to our query. To recap, GraphiQL features auto-complete as you type your query into the editor and automatically generated documentation based on GraphQL’s type system. It’s extremely useful for exploring your schema, with zero maintenance burden for developers.

Apollo Devtools

Try executing queries with GraphiQL in the right side panel of our Launchpad. To show the documentation explorer, you can hover over fields in the query editor and click on the tooltip. If your query runs successfully in GraphiQL, you can be 100% positive that the same query will run successfully in your application.

Level up your GraphQL skills

If you made it to this point, awesome job! 👏 I hope you enjoyed the exercises and got a taste of what it would be like to work with GraphQL on the front end.

Hungry for more? 🌮 Make it your 2018 New Year’s resolution to learn more about GraphQL, as I expect its popularity to grow even more in the upcoming year. Here’s an example app to get you started featuring the concepts we learned today:

Go forth and GraphQL (and be sure to tag us on Twitter @apollographql along the way)! 🚀


A Front End Developer’s Guide to GraphQL is a post from CSS-Tricks

New Course: Make Great Presentations Quickly With PowerPoint Templates

Post pobrano z: New Course: Make Great Presentations Quickly With PowerPoint Templates

If you want to make a better impression with your PowerPoint presentations, you should check out our new course, Make Great Presentations Quickly With PowerPoint Templates.

The X Note PowerPoint template

What You’ll Learn

In this short course, instructor Andrew Childress will show you how to create a professional PowerPoint presentation using The X Note template, which is a great example of a professional template that reduces the hard work of building a compelling presentation. 

Learn how to use the power of a good template in Microsoft PowerPoint to bring together an engaging presentation quickly!

Watch the Introduction

 

Take the Course

You can take our new course straight away with a subscription to Envato Elements. For a single low monthly fee, you get access not only to this course, but also to our growing library of over 1,000 video courses and industry-leading eBooks on Envato Tuts+. 

Plus you now get unlimited downloads from the huge Envato Elements library of 400,000+ creative assets—including a wide range of elegant PowerPoint templates. Create with unique fonts, photos, graphics and templates, and deliver better projects faster.

New Course: Make Great Presentations Quickly With PowerPoint Templates

Post pobrano z: New Course: Make Great Presentations Quickly With PowerPoint Templates

If you want to make a better impression with your PowerPoint presentations, you should check out our new course, Make Great Presentations Quickly With PowerPoint Templates.

The X Note PowerPoint template

What You’ll Learn

In this short course, instructor Andrew Childress will show you how to create a professional PowerPoint presentation using The X Note template, which is a great example of a professional template that reduces the hard work of building a compelling presentation. 

Learn how to use the power of a good template in Microsoft PowerPoint to bring together an engaging presentation quickly!

Watch the Introduction

 

Take the Course

You can take our new course straight away with a subscription to Envato Elements. For a single low monthly fee, you get access not only to this course, but also to our growing library of over 1,000 video courses and industry-leading eBooks on Envato Tuts+. 

Plus you now get unlimited downloads from the huge Envato Elements library of 400,000+ creative assets—including a wide range of elegant PowerPoint templates. Create with unique fonts, photos, graphics and templates, and deliver better projects faster.

How to Draw a Festive Winter Landscape With Glowing Lamps in Adobe Illustrator

Post pobrano z: How to Draw a Festive Winter Landscape With Glowing Lamps in Adobe Illustrator

Final product image
What You’ll Be Creating

In this tutorial, you will learn how to use the Mesh Tool in Adobe Illustrator to create a vector evening winter background!

If you want to skip the tutorial and just use this background with some other awesome elements, purchase the Christmas Evening Winter Landscape from GraphicRiver!

Christmas Evening Winter Landscape
Christmas Evening Winter Landscape

1. How to Draw the Background

Step 1

Let’s begin by using Mesh for a bit!

Start by drawing a rectangle and filling it with #4B6471 color and create a Mesh grid for this shape by manually placing nodes with the Mesh Tool (U).

Once your Mesh grid is done, begin coloring it by selecting the bottom row of nodes and the bottom middle node and changing their color to #8A9BA2.

Continue this step by coloring the nodes on the top and on the sides with #253B4B and the middle nodes of the second row from the top with #385260.

Finish by changing the color of the bottom nodes to #D2DAD9.

draw mesh background

Step 2

Let’s move on to drawing the snow hills!

Draw a #F6F7F2 rectangle, and then place some Mesh nodes with the Mesh Tool (U). Move said nodes to create a wavy shape out of the rectangle, trying to recreate the screenshot below.

Finally, color the selected nodes with #D0DFE4. The first hill is done!

mesh snow hill

Step 3

Draw the second hill following the same instructions as before and using these colors:

  1. #E1EBEC
  2. #C0D1D8
  3. #F6F7F2
draw mesh snow

Step 4

Finally, draw the third hill in a similar fashion.

  1. #CBD8DE
  2. #F4F6F1
draw snow hill

Step 5

Place the hills on top of each other, with the first one being in the front and the third one being in the back.

Make them overlap to match the screenshot!

arrange hills

Step 6

Place the hills on the bottom of the background!

place hills

2. How to Draw the Lamps

Step 1

Let’s move on to drawing the lamp.

Draw half an outline of it by using the Pen Tool (P), and then use Object > Transform > Reflect and click Copy to obtain the second half. Move them close to each other for now.

draw half

Step 2

Select the two halves and use Unite in the Pathfinder panel to create a united outline for the lamp.

reflect the lamp

Step 3

Using the Pen Tool (P) and some small ellipses (Ellipse Tool, L), draw the transparent surfaces of the lamp.

Lay the shapes on top of the outline, select all, and use Minus Front in the Pathfinder panel to „crop” them out.

crop out the lamp

Step 4

Select the result and apply a Linear, #2A1800 to #DFCFD9 to #2A1800 Gradient to it.

gradient

Step 5

Using the Pen Tool (P), draw a decorative swirl as can be seen below.

In the Stroke panel, change the Stroke Profile to the one below.

change stroke profile

Step 6

Draw a little ellipse and add it to both ends of the curve.

Selecting the curve, go to Object > Expand Appearance, and then select all objects and Unite them in the Pathfinder panel. Change the result’s color to #453A2E.

finish curve

Step 7

Attach the lamp to our decorative part.

add curve to lamp

Step 8

Let’s draw the lamppost! Use Mesh, just as we learned before.

  1. #100804
  2. #7F7460
  3. #5A503E
draw lamppost with mesh

Step 9

Draw the second part of the lamppost similarly.

  1. #100804
  2. #362C1B
  3. #796F5A
more mesh

Step 10

Draw the base.

  1. #100804
  2. #665B48
  3. #3B2E22
base of post with mesh

Step 11

Draw a #110600 rounded shape, and then bend it with Effect > Warp > Arc, using -20% Bend.

Go to Object > Expand Appearance.

warp object

Step 12

Color the shape with Mesh.

  1. #413629
  2. #6F6452
  3. #54493A
mesh

Step 13

Resize copies of the shape.

three copies

Step 14

Put the post together and add the rings we just created.

join lamppost

Step 15

Finally, attach the actual lamps to the top.

add lamps

3. How to Light Up the Lamps

Step 1

Now that we’ve drawn the outline, it’s time to put lights in these lamps!

Begin by drawing a narrow ellipse and adding a Radial, #FFFF7F to #000000 Gradient to it.

draw ellipse

Step 2

Put another copy of that ellipse on top and tweak the Transparency options, selecting Screen and 79% Opacity.

Create a copy of the result, rotate it, and make it smaller.

more ellipse

Step 3

Draw a very narrow ellipse with the same Gradient as before.

another gradient ellipse

Step 4

Add a copy on top, creating a cross. Change its Opacity to 61% and Transparency to Screen.

add one more

Step 5

Draw a circle, using the same Radial Gradient. Again, use Screen, now with 95% Opacity.

gradient circle

Step 6

Create a flare by placing all the elements on top of each other.

join flare

Step 7

Draw a final ellipse for the light, using Screen and a Radial Gradient from #FFFFFF to #FFB500 to #000000.

gradient ellipse

Step 8

Place the first flare behind the lamp outline and the final ellipse on top of it.

place light

Step 9

Add the lights to both lamps.

both lamps

Step 10

Create a few copies of the lamp for the upcoming landscape.

add copies

4. How to Add the Trees and the Snow

Step 1

Let’s begin drawing the trees!

Learn how to draw the branch we will be copying in the second section of this tutorial. Now draw the trunk, fill it with #544E48, and start adding copies of the branch to it as shown below.

add branches to tree

Step 2

Add more branches to complete the tree.

finish tree

Step 3

Create a copy of the branches without the trunk and draw another one.

another tree

Step 4

Add more branches to the second tree.

add more branches

Step 5

Draw a highlight with a #FCFC98 to #000000 Radial Gradient, change the Opacity to 70% and Transparency to Screen.

gradient highlight

Step 6

Create copies of the trees and add the highlights behind them.

copies of trees

Step 7

Place the trees and the lamps onto the background.

add to background

Step 8

Draw two identical circles. Fill one with #ACB99A and the second with a #020200 to white Radial Gradient.

Set both circles’ transparency to Screen.

two circles

Step 9

Place the green circle under the gradient, and then select both and use Make Mask in the Transparency panel. Check both Clip and Invert Mask.

transparency mask

Step 10

Add these highlights on top of the background.

add highlights

Step 11

To add snow, refer to this tutorial.

add snow

Step 12

Draw a rectangle on top of everything to „frame” all the content you want to be seen in the final picture.

draw outline

Step 13

Select all elements and right-click, after that selecting Make Clipping Mask.

make clipping mask

Step 14

You’re done!

final picture

Awesome Work, You’re Now Done!

What now? You can try any of my other tutorials from my profile, or check out my portfolio on GraphicRiver, as well as the original vector we recreated in this tutorial.

I hope you enjoyed the tutorial, and I would be super happy to see any results in the comments below!

Christmas Evening Winter Landscape
Christmas Evening Winter Background

How to Draw a Festive Winter Landscape With Glowing Lamps in Adobe Illustrator

Post pobrano z: How to Draw a Festive Winter Landscape With Glowing Lamps in Adobe Illustrator

Final product image
What You’ll Be Creating

In this tutorial, you will learn how to use the Mesh Tool in Adobe Illustrator to create a vector evening winter background!

If you want to skip the tutorial and just use this background with some other awesome elements, purchase the Christmas Evening Winter Landscape from GraphicRiver!

Christmas Evening Winter Landscape
Christmas Evening Winter Landscape

1. How to Draw the Background

Step 1

Let’s begin by using Mesh for a bit!

Start by drawing a rectangle and filling it with #4B6471 color and create a Mesh grid for this shape by manually placing nodes with the Mesh Tool (U).

Once your Mesh grid is done, begin coloring it by selecting the bottom row of nodes and the bottom middle node and changing their color to #8A9BA2.

Continue this step by coloring the nodes on the top and on the sides with #253B4B and the middle nodes of the second row from the top with #385260.

Finish by changing the color of the bottom nodes to #D2DAD9.

draw mesh background

Step 2

Let’s move on to drawing the snow hills!

Draw a #F6F7F2 rectangle, and then place some Mesh nodes with the Mesh Tool (U). Move said nodes to create a wavy shape out of the rectangle, trying to recreate the screenshot below.

Finally, color the selected nodes with #D0DFE4. The first hill is done!

mesh snow hill

Step 3

Draw the second hill following the same instructions as before and using these colors:

  1. #E1EBEC
  2. #C0D1D8
  3. #F6F7F2
draw mesh snow

Step 4

Finally, draw the third hill in a similar fashion.

  1. #CBD8DE
  2. #F4F6F1
draw snow hill

Step 5

Place the hills on top of each other, with the first one being in the front and the third one being in the back.

Make them overlap to match the screenshot!

arrange hills

Step 6

Place the hills on the bottom of the background!

place hills

2. How to Draw the Lamps

Step 1

Let’s move on to drawing the lamp.

Draw half an outline of it by using the Pen Tool (P), and then use Object > Transform > Reflect and click Copy to obtain the second half. Move them close to each other for now.

draw half

Step 2

Select the two halves and use Unite in the Pathfinder panel to create a united outline for the lamp.

reflect the lamp

Step 3

Using the Pen Tool (P) and some small ellipses (Ellipse Tool, L), draw the transparent surfaces of the lamp.

Lay the shapes on top of the outline, select all, and use Minus Front in the Pathfinder panel to „crop” them out.

crop out the lamp

Step 4

Select the result and apply a Linear, #2A1800 to #DFCFD9 to #2A1800 Gradient to it.

gradient

Step 5

Using the Pen Tool (P), draw a decorative swirl as can be seen below.

In the Stroke panel, change the Stroke Profile to the one below.

change stroke profile

Step 6

Draw a little ellipse and add it to both ends of the curve.

Selecting the curve, go to Object > Expand Appearance, and then select all objects and Unite them in the Pathfinder panel. Change the result’s color to #453A2E.

finish curve

Step 7

Attach the lamp to our decorative part.

add curve to lamp

Step 8

Let’s draw the lamppost! Use Mesh, just as we learned before.

  1. #100804
  2. #7F7460
  3. #5A503E
draw lamppost with mesh

Step 9

Draw the second part of the lamppost similarly.

  1. #100804
  2. #362C1B
  3. #796F5A
more mesh

Step 10

Draw the base.

  1. #100804
  2. #665B48
  3. #3B2E22
base of post with mesh

Step 11

Draw a #110600 rounded shape, and then bend it with Effect > Warp > Arc, using -20% Bend.

Go to Object > Expand Appearance.

warp object

Step 12

Color the shape with Mesh.

  1. #413629
  2. #6F6452
  3. #54493A
mesh

Step 13

Resize copies of the shape.

three copies

Step 14

Put the post together and add the rings we just created.

join lamppost

Step 15

Finally, attach the actual lamps to the top.

add lamps

3. How to Light Up the Lamps

Step 1

Now that we’ve drawn the outline, it’s time to put lights in these lamps!

Begin by drawing a narrow ellipse and adding a Radial, #FFFF7F to #000000 Gradient to it.

draw ellipse

Step 2

Put another copy of that ellipse on top and tweak the Transparency options, selecting Screen and 79% Opacity.

Create a copy of the result, rotate it, and make it smaller.

more ellipse

Step 3

Draw a very narrow ellipse with the same Gradient as before.

another gradient ellipse

Step 4

Add a copy on top, creating a cross. Change its Opacity to 61% and Transparency to Screen.

add one more

Step 5

Draw a circle, using the same Radial Gradient. Again, use Screen, now with 95% Opacity.

gradient circle

Step 6

Create a flare by placing all the elements on top of each other.

join flare

Step 7

Draw a final ellipse for the light, using Screen and a Radial Gradient from #FFFFFF to #FFB500 to #000000.

gradient ellipse

Step 8

Place the first flare behind the lamp outline and the final ellipse on top of it.

place light

Step 9

Add the lights to both lamps.

both lamps

Step 10

Create a few copies of the lamp for the upcoming landscape.

add copies

4. How to Add the Trees and the Snow

Step 1

Let’s begin drawing the trees!

Learn how to draw the branch we will be copying in the second section of this tutorial. Now draw the trunk, fill it with #544E48, and start adding copies of the branch to it as shown below.

add branches to tree

Step 2

Add more branches to complete the tree.

finish tree

Step 3

Create a copy of the branches without the trunk and draw another one.

another tree

Step 4

Add more branches to the second tree.

add more branches

Step 5

Draw a highlight with a #FCFC98 to #000000 Radial Gradient, change the Opacity to 70% and Transparency to Screen.

gradient highlight

Step 6

Create copies of the trees and add the highlights behind them.

copies of trees

Step 7

Place the trees and the lamps onto the background.

add to background

Step 8

Draw two identical circles. Fill one with #ACB99A and the second with a #020200 to white Radial Gradient.

Set both circles’ transparency to Screen.

two circles

Step 9

Place the green circle under the gradient, and then select both and use Make Mask in the Transparency panel. Check both Clip and Invert Mask.

transparency mask

Step 10

Add these highlights on top of the background.

add highlights

Step 11

To add snow, refer to this tutorial.

add snow

Step 12

Draw a rectangle on top of everything to „frame” all the content you want to be seen in the final picture.

draw outline

Step 13

Select all elements and right-click, after that selecting Make Clipping Mask.

make clipping mask

Step 14

You’re done!

final picture

Awesome Work, You’re Now Done!

What now? You can try any of my other tutorials from my profile, or check out my portfolio on GraphicRiver, as well as the original vector we recreated in this tutorial.

I hope you enjoyed the tutorial, and I would be super happy to see any results in the comments below!

Christmas Evening Winter Landscape
Christmas Evening Winter Background