Monday, January 30, 2023

Read and Create Cookies in JavaScript

Read and Create Cookies in JavaScript

Even if you haven't used cookies before, you are probably already familiar with them. Almost every website that you visit asks to accept cookies.

So, what are cookies? Cookies are basically small pieces of text that contain some information relevant to you or the website you are visiting. This information is stored inside your browser and allows websites to give you a personalized experience, access to protected sections of the website or gather analytics data.

In this tutorial, I will show you how to manage cookies with JavaScript.

The Document interface contains a property called cookie that you use to read and write cookies. Simply using document.cookie will give you back a string that contains all your cookies separated by a semi-colon. The following example shows all the cookies that are set on my browser for the Wikipedia homepage.

1
let all_cookies = document.cookie;
2
3
console.log(all_cookies);
4
/* Outputs:

5
GeoIP=IN:State_Code:State:My_Latitude:My_Longitude:v4; enwikiwmE-sessionTickLastTickTime=1675054195383; enwikiwmE-sessionTickTickCount=1; enwikimwuser-sessionId=7ed98fe7399e516cff54

6
*/

I closed the page and the reopened it later. After a couple of refreshes and some waiting time, the value stored in the cookies had changed to the following:

1
let all_cookies = document.cookie;
2
3
console.log(all_cookies);
4
/* Outputs:

5
GeoIP=IN:State_Code:State:My_Latitude:My_Longitude:v4; enwikimwuser-sessionId=7ed98fe7399e516cff54; enwikiwmE-sessionTickLastTickTime=1675058494564; enwikiwmE-sessionTickTickCount=16

6
*/

As you can see, the values in cookies can change over time. Websites can use them to track things like how long I spent on a page etc.

The value returned by document.cookie shows that we only get back the name and value of cookies stored in the browser. Let's write a JavaScript function that will give us the value of a stored cookie once we pass its name.

1
function read_cookie(name) {
2
  let all_cookies = document.cookie.split("; ");
3
  let cookie_name = name + "=";
4
5
  for (let i = 0; i < all_cookies.length; i++) {
6
    let clean_cookie = all_cookies[i];
7
    if (clean_cookie.startsWith(cookie_name)) {
8
      return clean_cookie.substring(cookie_name.length, clean_cookie.length);
9
    }
10
  }
11
} 

There are currently four cookies on Wikipedia that I can access using JavaScript. I used our read_cookie() function to get the values from all of them. The value of the GeoIP cookie shows the location to be New York because it is masked by my VPN. You can try using the above function on Wikipedia or any other website yourself to retrieve cookie values:

1
let geo_ip = read_cookie("GeoIP");
2
// Outputs: US:NY:New_York:40.74:-73.99:v4

3
4
let session_id = read_cookie("enwikimwuser-sessionId");
5
// Outputs: 398c37df147f0b377825

Creating Cookies in JavaScript

You can also create a new cookie by using the cookie property and setting its value to a string that has the form key=value. The key here is the name of the cookie and value is the value that you have set for the cookie. These are the only required values for creating a cookie but you can also pass down other important information.

To see how setting a cookie value works, you can visit https://code.tutsplus.com/tutorials and then open the browser console to execute the following code:

1
document.cookie = "site_theme=christmas";

Setting Expiration Time

Unless specified otherwise, cookies you set are designed to expire at the end of a browsing session when users close the browser. If you want your cookie to expire at a specific time in the future, you should set an expires date by adding the following string to your cookie.

1
;expires:GMT-string-fromat-date

Our site_theme cookie above is set to expire as soon as your close the browser. You can verify this by closing the browser and then trying to read the cookie using the read_cookie() function we wrote above. We can extend its life by using the following code snippet:

1
 document.cookie = "site_theme=christmas;expires=Thu, 28 Dec 2023 08:58:01 GMT";
2
 // The cookie will now expire on Thu, 28 Dec 2023 08:58:01 GMT

The cookie will now expire on 28 Dec 2023. Try closing the browser window and reopen the page again to see that the cookie is still available for you to read.

Another way to set cookie expiration time is by using the following string:

1
;max-age=cookie-age-in-seconds

Let's say you want the cookie to expire a week after it has been set. You can determine the number of seconds by calculating 60*60*24*7. The following line will set the cookie for you:

1
document.cookie = `site_theme=christmas;max-age=${60*60*24*7}`;
2
// The cookie will now expire one week from now

You can set the expires value when you want the cookie to expire at a specific point of time and the max-age value when you want the cookie to expire after a specific period.

Setting the Domain and Path

It is important to remember that you cannot set cookies for any 3rd party domain that you want. For example, a script running on tutsplus.com cannot set a cookie for wikipedia.org. This is done as a security measure.

You can have even more control over the accessibility of a cookie by setting its domain and path values. You can set these two values by using the following string:

1
;domain=domain;path=path

The domain is set to the host of current location by default. Since we created our earlier cookies by opening the browser console on https://code.tutsplus.com/tutorials, our cookie is also accessible only on the code.tutsplus.com subdomain. Try using the read_cookie() function on the browser console for https://design.tutsplus.com/tutorials and it will be undefined.

You can create a cookie that is accessible on all subdomains of tutsplus.com by executing the following line:

1
document.cookie = "site_theme=christmas;expires=Thu, 28 Dec 2023 08:58:01 GMT;domain=tutsplus.com";

Similarly, you can also provide a path for which the cookie will be accessible. Let's say you want the site_theme cookie to be available only on the URLs that contain /tutorials in their path, you can do so with the following line:

1
 document.cookie = "site_theme=christmas;expires=Thu, 28 Dec 2023 08:58:01 GMT;domain=tutsplus.com;path=/tutorials";

After executing the above line, the cookie won't be accessible on the URL https://code.tutsplus.com/categories/javascript because of the path restriction.

Modifying and Deleting Cookies in JavaScript

When we were reading cookie information from Wikipedia at the beginning of this tutorial, you might have noticed that the value of the cookie enwikiwmE-sessionTickTickCount was updating with the passage of time. There are a variety of reasons why you might want to update the value of a cookie periodically such as counting the number of visits, or updating user preferences.

Once you know the basics of creating cookies, you will also be able to easily modify existing cookies. Continuing our example from the previous section, let's say you want to change the value of site_theme cookie to new_year and change the expiration date to the new year as well. You can do so with the following code:

1
document.cookie = "site_theme=new_year;expires=Mon, 1 Jan 2024 08:58:01 GMT;domain=tutsplus.com;path=/tutorials";

Do you remember when I said that we can specify when a cookie expires by passing the expires or max-age values? We can also use them to delete a cookie.

Setting the value of max-age to 0 will make the cookie expire in next 0 seconds or in other words now. Similarly, you can also set the value of expires to some date in the past and it will clear the cookie.

1
document.cookie = "site_theme=new_year;max-age=0;domain=tutsplus.com;path=/tutorials";
2
document.cookie = "site_theme=new_year;expires=Mon, 1 Jan 2001 08:58:01 GMT;domain=tutsplus.com;path=/tutorials";

Both the lines above will work if you want to delete a cookie.

One important thing to remember when you are modifying or deleting cookies is that the domain and path values have to match the cookie that you are modifying or deleting.

Final Thoughts

In this tutorial, we learned how to manage cookies in JavaScript. You should now be able to read data from cookies, create new cookies, and modify or delete existing cookies. While cookies are great for storing information, there are a few things to be kept in mind. First, cookie storage is limited to about 4KB so you shouldn't be using them to store a large amount of information. Second, you also cannot create a large number of cookies for same domain. The limit varies across browsers and is fairly generous at around 300 at least. This should generally be sufficient.

If you are looking to store a large amount of data and want to only access it locally, you might consider using either Local Storage or Session Storage.


Sunday, January 29, 2023

How to Build a REST API With Laravel

How to Build a REST API With Laravel

Laravel lets you easily and quickly build RESTful APIs. This could be the back-end to a front-end web app, a data source for a mobile app, or a service for other apps or APIs.

There are a lot of moving pieces to coding a RESTful API, but Laravel makes it a lot easier. In this free course you'll learn everything you need to know to build RESTful APIs with Laravel.

What You'll Learn

  • define data models and seeding database test data
  • handle basic GET requests 
  • transform data from the database into a consistent and conventional JSON format
  • create flexible and reusable filter syntax for users to query and filter data
  • handle and validate POST, PUT, and PATCH requests
  • implement bulk inserts for end users to quickly insert multiple entities with a single request 
  • protect your API endpoints with Laravel Sanctum to authenticate and authorize requests

Who is This Free Course For?

  • complete beginners who want to be web developers
  • experienced developers who want to explore advanced topics
  • programming enthusiasts who enjoy learning something exciting

Follow Along, Learn by Doing

I encourage you to follow along with this course, and you'll learn about all the most important features of Vue.js

To help, the Build a Rest API with Laravel Github repository contains the source code for each lesson and the completed sample project that was built throughout the course. 

1. Introduction

Watch video lesson [0:00:00] ↗

This course will teach you how to build a Rest API with Laravel. In this introductory lesson, you'll take a look at the scope of the course. 

2. Getting Started

Creating the Project

Watch video lesson [0:01:38] ↗

In this lesson, you'll go over the things you'll need to follow along in this course. Follow along to set up your dev environment and create your project.

Here is a quick tutorial on how to set up your Laravel environment for Windows:

Designing and Seeding the Database

Watch video lesson [0:7:36] ↗

In this lesson, you'll create the migrations, factories, and seed data for our database.

3. Providing Data

Versioning and Defining Routes

Watch video lesson [0:19:22] ↗

Good web APIs are versioned, so you need to implement some kind of versioning. You'll also set up the routes for the first version of the API.

Transforming Database Data Into JSON

Watch video lesson [0:26:17] ↗

RESTful APIs typically provide data in JSON format using JSON naming conventions. In this lesson, you'll use Resource classes to transform our data into conventional JSON.

Filtering Data

Watch video lesson [0:35:48] ↗

You need to provide the ability for clients to filter results. You'll implement a customer filter in this lesson.

Filtering More Data

Watch video lesson [0:49:47] ↗

In this lesson, you generalize our filter functionality so that you can reuse it for any resource.

Including Related Data

Watch video lesson [0:58:49] ↗

It sometimes makes sense to include related data in API's results, but it should be a feature that clients opt in to. You'll implement that in this lesson.

4. Manipulating Data

Creating Resources With POST Requests

Watch video lesson [1:05:37] ↗

POST requests are for creating resources. You'll handle POST requests to create customer resources in this lesson.

See the Laravel documentation on Built-in Validation Rules for more information.

Updating With PUT and PATCH

Watch video lesson [1:14:48] ↗

We update data using PUT and PATCH requests, and you'll learn how to handle both types of requests in this lesson.

Implementing Bulk Insert

Watch video lesson [1:22:51] ↗

Some resources need to be inserted in bulk. You'll learn how to implement that in this lesson.

5. Authentication

Protecting Routes With Sanctum

Watch video lesson [1:33:41] ↗

Laravel 7 introduced Sanctum, a token authentication scheme for APIs and SPA. It's awesome, and you'll use it to create tokens in this lesson.

Learn more about Laravel Sanctum in the official docs.

Authorizing Requests With Token Abilities

Watch video lesson [1:41:29] ↗

Sanctum allows us to assign abilities to tokens, and it's easy to authorize requests. However, there's a caveat that you'll learn about in this lesson.

Conclusion

Watch video lesson [1:48:10] ↗

Laravel has the tools we need to build usable and scalable applications—including RESTful APIs. In fact, Laravel does a lot of the hard stuff for us, making it a much more enjoyable way to build software.

Learn more in the official Laravel Documentation or The Laravel Community Portal.

FREE
7.1 Hours

PHP Tutorial for Beginners - Full Course | OVER 7 HOURS!

Learn the fundamentals of PHP and object-oriented programming in this free 7-hour PHP tutorial. Jeremy McPeak will help you learn PHP and use it to write web apps. 


    Best Ways to Preload Images Using JavaScript, CSS and HTML

    Best Ways to Preload Images Using JavaScript, CSS and HTML

    One of the most important things that you can do to improve the user experience on your website is to make sure that people don't spend their time waiting for some image or other element to load.

    How quickly a webpage and all its contents load depends on a large number of factors and some of them will be beyond your control. However, we should try our best as web developers to make the browsing experience as seamless as possible.

    In this tutorial, I will show you different techniques to preload images on a webpage for a smooth user experience.

    The Need for Preloading Images

    We will begin the tutorial by first discussing why you might need to preload images.

    Let's say you are building a portfolio website for a real estate agent where they can showcase houses for sale. The agent wants you to show a list of houses with an image of the exterior of the houses. They also want you to design the page in such a way that hovering over a house image loads another image of the interior of the house with a link to see all other images.

    The problem here is that the image of the interior of the house will only start loading when users hover over the image. This means that they will not see any image for a few moments after the initial hover event depending on their internet speed. You can see this problem in the following CodePen demo:

    Preloading the images will avoid this delay in image load on hover. Also, some large images might take a while to load so it is better to preload them for a better user experience.

    Preloading Images Using HTML

    You are most probably already familiar with the link tag in HTML. We generally use it to load an external CSS stylesheet but you can also use it to load other type of resources as well. There are two important attributes of the link tag.

    The href attribute which is used to provide the path to the resource that we want to fetch and the rel attribute which specifies the relationship of the resource with the containing document. With a CSS stylesheet, the link tag looks like this:

    1
    <link rel="stylesheet" href="navigation.css" />
    

    The rel attribute can take a lot of valid values. One of them is preload which we will use to preload our images. The preload attribute tells the browser to preemptively fetch and cache the linked resource as it will be needed on the current page.

    You also need the as attribute when the value of rel attribute is set to preload. This will specify the type of content that is being loaded by the link tag. This attribute serves many important purposes such as applying the correct content security policy, prioritization of the request etc. Skipping it could prevent your image from being preloaded.

    We will load our image in the following div element:

    1
    <div class="hover-me"></div>
    

    Then apply the following CSS to the div element. As you can see, the background image URL changes whenever someone hovers over the div element.

    1
    div.hover-me {
    
    2
      width: 640px;
    
    3
      height: 360px;
    
    4
      background: url("https://picsum.photos/id/128/1920/1080");
    
    5
      background-size: contain;
    
    6
      cursor: pointer;
    
    7
      margin: 0 auto;
    
    8
      position: relative;
    
    9
    }
    
    10
    11
    div.hover-me::before {
    
    12
      content: "Lake";
    
    13
      background: black;
    
    14
      color: white;
    
    15
      position: absolute;
    
    16
      top: 0.75rem;
    
    17
      left: 1rem;
    
    18
      padding: 0.5rem;
    
    19
      font-size: 1.5rem;
    
    20
      border-radius: 5px;
    
    21
    }
    
    22
    23
    div.hover-me:hover {
    
    24
      background: url("https://picsum.photos/id/296/1920/1080");
    
    25
      background-size: contain;
    
    26
    }
    
    27
    28
    div.hover-me:hover::before {
    
    29
      content: "Mountains";
    
    30
    }
    

    The image that shows up when we hover over the div element is preloaded by using the following markup. You should ideally place the link tag inside the head tag of your webpage.

    1
    <link rel="preload" as="image" href="https://picsum.photos/id/296/1920/1080" />
    

    The following CodePen demo shows the image preloading in action:

    Preloading Images Using CSS

    You might have noticed in the previous section that both the images we used were actually applied as a background to the div element. However, only one of them was downloaded by the browser. The image that was applied as background on hover was downloaded only after the hover event occurred.

    In the previous section, we forced the hover image to download with the help of HTML. However, we could also trick the browser in downloading the hover image by applying it as a background image to some other element on the webpage. Another option involves setting the image URL as a value of the content property.

    I prefer to use the body element along with the ::before or ::after pseudo-elements. The URLs that I want to download will be set as a value of the content property of any of the pseudo-elements.

    One important thing to keep in mind here is that we need to push the pseudo-elements far off the screen to prevent their contents from accidentally appearing on the screen. The following CSS takes care of all this for us:

    1
    body::before {
    
    2
      content: url("https://picsum.photos/id/296/1920/1080");
    
    3
      position: absolute;
    
    4
      top: -9999rem;
    
    5
      left: -9999rem;
    
    6
      opacity: 0;
    
    7
    }
    

    I have also set the opacity to 0 as a precautionary measure. Do keep in mind that you shouldn't set the display property to none to hide the element. In that case, the browser is much more likely to not download the image at all.

    You can see that the image we need on hover is preloaded in the following CodePen demo:

    Preloading Images Using JavaScript

    It is also possible to preload images using JavaScript. This method gives you the most control over the way you preload the images. Preloading images using JavaScript is also more convenient in situations where you have to load a large number of images. However, it will only work if JavaScript execution isn't disabled in the browser.

    The following function can help us preload any image in JavaScript.

    1
    function preload_image(im_url) {
    
    2
      let img = new Image();
    
    3
      img.src = im_url;
    
    4
    }
    

    The function accepts the path to an image you want to preload as a parameter. Inside the function, we use the image constructor to create a new instance of HTMLImageElement. After creating the image element instance, we set the value of its src property to path of the image we want to preload.

    All that's needed now is a call to the preload_image() function as shown below:

    1
    preload_image("https://picsum.photos/id/296/1920/1080");
    

    You can see the JavaScript image preloading in action in the following CodePen demo:

    Final Thoughts

    In this tutorial, we learned about three different techniques to preload images. Using the link tag in HTML allows us to start loading images as early as possible. On the other hand, it is much more convenient to use JavaScript when you want to preload multiple images. You can also control the order in which images are preloaded with JavaScript. This way we can make sure that image preloading doesn't block the main content from loading first.


    Friday, January 27, 2023

    Motion Design for Beginners

    Motion Design for Beginners

    Learn how to animate in Illustrator and After Effects in this free motion design course for beginners.

    What You'll Learn: The Motion Design Process

    • How to find inspiration before you start your project
    • How to draw a character from scratch using simple shapes in Adobe Illustrator
    • How to prep your files so you can move seamlessly from AI to AE
    • How to animate individual parts of your character
    • How to create a sticker peel effect 

    1. Introduction

    1.1 What to Expect in This Course

    Watch video lesson (1 min) ↗

    In this short lesson you'll get an insight into what you'll learn in this course. If you're looking to get into motion design but don't quite know where to start, then we'll get you on the road to creating your very own animation from scratch.

    1.2 Getting Started: Design Inspiration

    Watch video lesson (1 min) ↗

    It's always best to have some ideas before you get started on a project, and sometimes that means turning to other products and brands for inspiration. We'll take a look at some great work by other illustrators in this quick video.

    design inspirationdesign inspirationdesign inspiration

    "Are you a designer looking to add a little bit of movement to your work, or perhaps you're an animator looking to create your own custom designs. Either way, this is the course for you."

    2. Creating Your Character

    2.1 Creating Your Character in Illustrator

    Watch video lesson (1 min) ↗

    I'll show you how I picked a color scheme and how to get started with creating a character in Illustrator using some basic shapes.

    creating your charactercreating your charactercreating your character

    2.2 Drawing Eyes: Creating Layers for Animation

    Watch video lesson (5 mins) ↗

    Getting your character's eyes right is one of the most important parts of the process, so here I'll walk you through creating them, again using simple shapes. I'll also share some tips on how you can add things like stars to the pupils with tools like Pucker & Bloat.

    drawing eyesdrawing eyesdrawing eyes

    2.3 Drawing Facial Features

    Watch video lesson (5 mins) ↗

    Your character is taking shape so now it's time to add some more facial features. I'll show you how to create a puckered mouth - he's 'freshly squeezed' after all! - a nose, and some cute freckles. We'll also add some little touches to the top of its head. By the end of this video your character will have a full, adorable face.

    facial featuresfacial featuresfacial features

    2.4 Drawing Hands: Quick Tips and Shortcuts!

    Watch video lesson (4 mins) ↗

    Hands are notoriously difficult to draw. Don't worry if you're not great with them, I'll show you a way to work around this with a reference. We'll end up with a cute, cartoon 'Mickey Mouse' style hand.

    In this lesson I use the Cartoon Hand Gesture Collection as a reference. You can download it as part of a subscription to Envato Elements.

    2.5 Creating Highlights and Shadows

    Watch video lesson (7 mins) ↗

    I'll show you how to choose a good color for your highlights by starting with the base color of your character, adjusting that, and then changing the blending mode. We'll then add a rotation anchor point, and I'll also introduce you to the Pathfinder tool, which you'll see is a really powerful one when it comes to making and adjusting shapes in your illustration. 

    highlights and shadowshighlights and shadowshighlights and shadows

    3. Making The Sticker

    3.1 Creating the Rest of the Sticker: Type on a Path Tool

    Watch video lesson (8 mins) ↗

    Now we've created our character, we can concentrate on making the sticker around him. We'll be adding some background shape and color, text, plus another little illustration of an orange segment. I'll also show you how to navigate some little issues you might come across, like needing to flip your text.

    creating the rest of the stickercreating the rest of the stickercreating the rest of the sticker

    3.2 Giving the Sticker Some Texture

    Watch video lesson (1 min) ↗

    We've got our sticker now, and it's looking great, but it's a little too clean and flat, so in this quick video we'll look at adding some texture to create a crumpled sticker effect.

    adding texture to the stickeradding texture to the stickeradding texture to the sticker
    FREE
    3.3 Hours

    Adobe Illustrator for Beginners | FREE COURSE

     Learn how to use Adobe Illustrator for beginners in this free course. Start by mastering the Illustrator basics, and then learn to create effects, patterns, and more. This free Adobe Illustrator course is aimed at helping beginners learn how to use Adobe Illustrator easily and quickly. You don’t need any previous knowledge of the software, and you don’t need design or illustration skills. We’ll start right at the beginning and work our way through each topic step by step. 

      4. Moving From Illustrator to After Effects

      4.1 Getting Our Layers Ready For After Effects

      Watch video lesson (5 mins) ↗

      At this point you'll be ready to bring your creation over to After Effects ready for animation. We can do this without any plugins, but the most important thing is to separate your illustration into separate layers, so I'll walk you through how you can do that.

      layerslayerslayers

      4.2 Moving Over From Illustrator to After Effects

      Watch video lesson (1 min) ↗

      In this quick lesson you'll learn how to make a composition in After Effects that matches what you have in Illustrator, so that you'll have as seamless a transition as possible when bringing in your work.

      compositioncompositioncomposition

      4.3 Importing Your Illustrator File into After Effects

      Watch video lesson (1 min) ↗

      It's time to bring your AI file into After Effects, and everything we've prepped in the last couple of lessons means this should be smooth and hopefully problem free. Don't worry if you have minor issues with your layers, I'll go into this in the next lesson.

      importing into AEimporting into AEimporting into AE

      4.4 Fixing Any Small Issues on Your Layers

      Watch video lesson (1 min) ↗

      When you open your file in After Effects you might find one or two small issues, things like blending modes not coming over with their associated layers. That's okay, it's an easy fix and I'll show you how in this quick lesson.

      fixing issuesfixing issuesfixing issues

      Quick Shortcuts for Animation in After Effects

      1

      Anchor Point

      Shift/Opt + A

      2

      Quick Access Hand Tool

      Hold Spacebar and drag

      3

      Ease Keyframes Quickly

      F9

      5. Animating in After Effects 

      5.1 Parenting Layers

      Watch video lesson (3 mins) ↗

      If we pair some layers together it means we can create animation effects on those at the same time rather than having to duplicate that effort, so it's a great time saver. At this stage, you should also make sure your anchor points are in the right place so we'll go through that in this video, too.

      parenting layersparenting layersparenting layers

      5.2 Animating the Eyes

      Watch video lesson (7 mins) ↗

      Selecting all the 'eye' elements of our character, we'll set up a pre-comp and be able to work on just those parts to animate them. In this lesson you'll finish up with the eyelid moving and a nice little twinkle from the star too!

      animating eyesanimating eyesanimating eyes

      5.3 Animating the Sticker Background and Text Layers

      Watch video lesson (1 min) ↗

      I'll show you how to add some simple rotation animation to the sticker behind our character in this quick video lesson.

      FREE
      13 Minutes

      A to Z of Adobe Illustrator Tips, Tricks, and Hacks!

      Get ready for some rapid-fire tips and tricks for how to use Adobe Illustrator! In this video, we'll take a look at 26 tips, tricks, and hacks from A to Z. 

        5.4 Animating the Thumbs Up

        Watch video lesson (8 mins) ↗

        In this video tutorial we'll animate our character's arm so that he's raising it to give us a thumbs up. We want the shadow to move along with the arm, so I'll show you how to use a Track Matte to do that.

        5.4 animating the thumbs up5.4 animating the thumbs up5.4 animating the thumbs up

        5.5 Creating the Sticker Peel Animation

        Watch video lesson (4 mins) ↗

        Using Page Turn from the Effects panel, you'll add a cool peeling effect to your sticker. There are tons of options for you to work through so you can have fun with this. We don't want to see the back of the sticker when it peels though, so I'll also show you how to add a white back to make the sticker appear opaque.

        sticker peel animationsticker peel animationsticker peel animation

        5.6 Using Posterize Time to Create Old-School Animated Motion

        Watch video lesson (2 mins) ↗

        If you've made it to this video, congratulations, you've designed and animated a very cool character and sticker. As a final touch we'll add a vintage Posterize Time effect so we can control the frame rate separately. This gives you a little more control than setting the frame rate manually.

        posterize timeposterize timeposterize time
        If you use Adobe Illustrator, Adobe After Effects, or maybe both, you can find loads of great assets from Envato Elements. They're all included in a monthly subscription, so you can try and use as many as you like.

        Take Motion Graphics Further

        Learn more about After Effects animation, After Effects animation techniques and Adobe Illustrator, with some of our free video courses.