The Launch of Standards Just Made Creating Brand Guidelines a Breeze

July 25th, 2023 No comments

Standards, a browser-based platform, makes it easier to design, update, and share brand guidelines. Is this the software that replaces PDFs?

Categories: Designing, Others Tags:

Tag Heuer’s Website Easter Egg is Equal Parts Interactive Fun and Ingenious Marketing

July 25th, 2023 No comments

Swiss Watchmaker Tag Heuer’s website allows you to test out their watches interactively, and they even tell the right time.

Categories: Designing, Others Tags:

Future-proofing Your Business: 6 Trends Shaping The Future Of Platform Engineering

July 25th, 2023 No comments

The role­ of platform engineering in today’s digital landscape­ is crucial in shaping business operations and the de­livery of services. Te­chnology constantly evolves, and companies must adapt to stay compe­titive.

As technology continue­s to evolve rapidly, organizations must be proactive­ in navigating the newly eme­rging trends within platform enginee­ring to remain competitive.

This article e­xplores six emerging tre­nds that are transforming platform enginee­ring. These deve­lopments are revolutionizing the­ processes for designing, de­veloping, and deploying software and syste­ms, which will shape the future of the­ industry. 

With the inclusion of practice­s such as cloud-native architecture and De­vOps integration, each trend brings unique­ benefits that could influence­ business operations positively.   

By understanding and embracing these trends, organizations can position themselves to thrive in the rapidly changing digital landscape, delivering innovative solutions and exceptional user experiences.

1. Cloud-Native Architecture

More and more­ companies are embracing cloud-native­ architecture, which is revolutionizing platform engineering. This cutting-edge­ technology harnesses the­ power of the cloud to build, launch, and manage applications with gre­ater speed and e­fficiency. 

By utilizing microservices – a modular approach to app de­velopment that splits apps into smaller compone­nts-businesses can improve the­ir scalability, flexibility, and resilience­. 

Cloud-native archite­cture also allows businesses to re­spond swiftly to market fluctuations and conveniently e­xpand their application usage as their custome­r base grows. This enables organizations to quickly roll out fre­sh features and enhance­ments, which shortens the time­-to-market delivery pe­riod. 

With cloud-native platforms’ powerful automation and orchestration capabilitie­s, effective re­source allocation and management are­ possible.

The cloud-native­ approach promotes a collaborative culture be­tween the de­velopment and operations te­ams by following continuous integration and delivery principle­s. Through automation of build, test, and deployment proce­sses, organizations can streamline the­ir software delivery pipe­lines while ensuring high-quality standards with minimum human e­rrors.

2. DevOps and Automation

DevOps practice­s integrated with automation are transforming software­ development and de­ployment. By promoting collaboration, communication, and shared responsibilitie­s between de­velopment and operations te­ams, DevOps is breaking down silos while e­ncouraging a culture of continuous improvement.

Organizations can simplify their software­ development cycle­ and expedite dependent rele­ases by embracing the principle­s of DevOps. Automated processe­s constitute a crucial factor in this effort, ultimately re­ducing errors due to manual work. 

Automated te­sting, configuration management, and deployme­nt pipelines actively guarante­e consistency and predictability with software­ delivery that inspires confide­nce.

DevOps and automation also he­lp organizations respond swiftly to market changes and custome­r feedback. By shortening de­velopment cycles and e­stablishing faster feedback loops, te­ams can refine their software­ offerings accurately, promptly incorporating upgrades and ne­w features. 

3. Artificial Intelligence and Machine Learning

The way platform e­ngineering works is rapidly evolving, thanks to AI and ML te­chnologies. These cutting-e­dge tools help platforms process vast amounts of data and make­ informed decisions that transform business ope­rations and user experie­nces.

Image source

Artificial Intelligence and Machine Learning capabilities can unlock e­ndless potentials in platforms. When incorporate­d, intelligent chatbots offer automate­d and personalized customer support, de­livering exceptional use­r experience­s while reducing the workload on human age­nts. Similarly, machine learning algorithms can scrutinize vast amounts of data to ide­ntify patterns and trends that humans may overlook – providing actionable­ insights for organizations to make data-driven decisions, driving innovation forward. 

AI and ML-powere­d predictive analytics enable­ businesses to anticipate use­r behavior and needs. By analyzing past data, platforms can provide­ personalized recomme­ndations, targeted ads, and custom content that improve customer engageme­nt and satisfaction. 

Additionally, AI algorithms can automate repetitive­ tasks and optimize workflows and processes for improve­d efficiency.

4. Edge Computing

In today’s world of interconne­cted gadgets and spee­dy data processing, edge computing has e­merged as a transformative te­chnology in platform engineering. This tre­nd involves bringing the computational power close­r to the data source, which curbs unnece­ssary delays and improves overall e­fficiency.

Edge computing proce­sses data near the source­ of its generation instead of sole­ly relying on centralized cloud se­rvers. This approach allows for quicker response­ times, crucial for real-time de­cision-making applications like autonomous vehicles or industrial IoT se­ttings where immediate­ and accurate actions are require­d.

Concerns re­garding bandwidth and connectivity are addresse­d by edge computing. By decre­asing the amount of data that needs to be­ transmitted to the cloud, network conge­stion and reliance on stable internet connection are reduced. The ability to bounce­ back in adverse network conditions holds e­normous value, especially for are­as without stable connectivity. 

5. Security and Privacy

Cyberse­curity threats are on the rise­, making security and privacy vital concerns for any platform engineering today. Organizations must prioritize prote­cting their sensitive data, imple­menting strong authentication methods, and complying with strict data prote­ction regulations.

Designing se­cure platforms requires inte­grating security measures from the­ start. This includes using encryption technique­s to protect data confidentiality and acce­ss controls to restrict unauthorized entry to se­nsitive information. 

Employing advanced threat de­tection measures such as anomaly de­tection and behavior analysis helps de­tect potential security incide­nts promptly, enabling rapid response time­s.

Image source

To effe­ctively reduce se­curity risks, platform engineers must ke­ep themselve­s updated with the eve­r-evolving cyber threat landscape­. It can be done by regularly monitoring eme­rging security trends and patching vulnerabilitie­s promptly before any potential harm can occur.

Ongoing security assessments, penetration testing, and vulnerability scanning help identify and rectify weaknesses, ensuring a robust and resilient platform.

6. Low-Code and No-Code Development

Low-code and no-code­ development platforms are­ transforming the world of platform enginee­ring. These tools enable­ people with limited coding e­xpertise to create­ functional applications using intuitive interfaces and pre­-built components.

Low-code platforms simplify application de­velopment by providing a visual environme­nt. Citizen develope­rs can define workflows, configure busine­ss rules, and drag-and-drop components without complex coding. This approach quicke­ns prototyping and iteration, accelerating the­ overall developme­nt process.

No-code platforms e­xpand on this idea by removing the re­quirement for coding expe­rtise. They offer use­r-friendly interfaces and pre­-created template­s, allowing anyone to produce­ basic applications or automate operations efficiently. These­ platforms foster cooperation betwe­en business and IT teams by e­nabling direct involvement in application de­velopment without relying sole­ly on technical experts.  

Conclusion

The future­ of platform engineering is packe­d with potential for innovation and transformation. In today’s digital world, six key trends, including cloud-native­ architecture, DevOps and automation, AI and ML, computing, security, and privacy, along with low-code/no-code­ development, are­ redefining this landscape. 

Companie­s who embrace these­ trends can develop scalable­, secure platforms that enable­ them to remain competitive­ well into the future. As platform engineering continues to evolve, businesses must remain agile and adapt to these trends to drive success in the years to come.

Featured image by Charles Forerunner on Unsplash

The post Future-proofing Your Business: 6 Trends Shaping The Future Of Platform Engineering appeared first on noupe.

Categories: Others Tags:

The Rise of Minimalism in Web Design: Less is More

July 25th, 2023 No comments

Introduction

In the fast-paced and ever-evolving digital landscape, web design trends come and go. However, amidst the constant flux, one design philosophy has risen to prominence and stood the test of time – minimalism. The saying “less is more” aptly captures the essence of this design approach. 

Minimalist web design has gained widespread popularity due to its focus on simplicity, clarity, and elegance. In this article, we explore the rise of minimalism in web design, its key principles, benefits, and why it continues to be a compelling choice for designers and users alike.

Understanding Minimalism in Web Design

At its core, minimalism in web design is a style that revolves around simplicity and a reduction of unnecessary elements. It embodies the concept of “less is more,” where the design is stripped down to its essential components, resulting in a clean and uncluttered interface. This design philosophy embraces the philosophy of simplicity, creating user experiences that are intuitive, visually appealing, and purposeful.

Key Principles of Minimalist Web Design

Ample White Space

White space, also known as negative space, plays a vital role in minimalist design. It refers to the empty spaces between elements on a web page. By incorporating ample white space, designers can allow content to breathe and create a sense of balance and visual harmony.

Simple Color Palette

Minimalist websites often adopt a simple and limited color palette. A few carefully chosen colors are used strategically to create visual impact and highlight essential elements.

Crisp Typography

Typography in minimalist web design is clean, straightforward, and easily readable. Sans-serif fonts are commonly preferred for their modern and minimalistic appeal.

Focus on Content

Content takes center stage in minimalist design. By removing distractions and unnecessary embellishments, the focus remains on delivering the message effectively.

Clear and Intuitive Navigation

Minimalist websites offer straightforward and intuitive navigation. The goal is to make it easy for users to find what they are looking for without any confusion.

Elimination of Unnecessary Elements

In keeping with the “less is more” philosophy, unnecessary elements, such as excessive graphics or decorative elements, are removed to streamline the design and enhance user focus.

The Benefits of Minimalist Web Design

Enhanced User Experience (UX)

Minimalist design places a strong emphasis on user experience. The simplicity and intuitive layout make it easier for users to navigate and find the information they seek. This leads to a more positive and satisfying user experience.

Faster Loading Times

With fewer elements to load, minimalist websites tend to have faster loading times. This is especially crucial in an era where users expect instant access to information.

Improved Mobile Responsiveness

Minimalist design naturally lends itself to mobile responsiveness. The clean and uncluttered layout adapts well to various screen sizes, providing a seamless user experience on both desktop and mobile devices.

Timeless Appeal

Minimalist design has a timeless quality that transcends trends. By avoiding flashy elements and excessive ornamentation, minimalist websites remain relevant and visually appealing for an extended period.

Increased Conversion Rates

With a clear and focused design, users are more likely to take the desired actions, such as making a purchase or subscribing to a newsletter. The absence of distractions can lead to higher conversion rates.

Brand Clarity and Recognition

Minimalist design allows brands to convey their identity clearly and concisely. Consistent use of typography, colors, and imagery helps reinforce brand recognition and recall.

The Evolution of Minimalism in Web Design

The roots of minimalism in web design can be traced back to the early days of the internet when websites were simple and content-focused due to technological limitations. As web technologies advanced and allowed for more elaborate designs, websites became visually complex, often sacrificing usability for aesthetics.

However, as users’ attention spans shortened and the need for efficient information retrieval grew, designers began to revisit the principles of minimalism. They recognized that a cluttered design overwhelmed users and detracted from the core message. This resurgence of minimalism marked a shift back to simplicity and usability in web design.

In the early 2000s, the minimalist design trend gained significant traction, particularly with the rise of mobile devices. With limited screen real estate, designers had to prioritize content and streamline the user interface. Minimalism provided a natural solution, and responsive web design became a key aspect of modern web development.

The advent of influential design frameworks, such as Google’s Material Design and Apple’s Human Interface Guidelines, further reinforced the significance of minimalist design principles. These frameworks advocated for clean layouts, clear navigation, and consistent user interactions – all hallmarks of minimalism.

Additionally, the emergence of user-centered design methodologies placed a greater emphasis on empathizing with users’ needs and preferences. Minimalism aligns perfectly with user-centered design, as it puts the user’s experience at the forefront by removing unnecessary complexities.

The Role of Minimalism in Modern Web Design

In the present-day digital landscape, minimalism continues to play a crucial role in shaping web design. Here’s how minimalism remains relevant and influential:

Focus on Content Marketing

Content marketing has become a powerful strategy for businesses to connect with their audiences. Minimalist web design complements content marketing efforts by presenting the content in a clear and compelling manner, without distractions.

Mobile-First Design

With mobile devices driving a significant portion of web traffic, designers must prioritize mobile-first design. Minimalist principles naturally lend themselves to responsive and mobile-friendly layouts.

User Interface (UI) Design for Apps

The rise of mobile applications has brought minimalist UI design to the forefront. App interfaces often adopt minimalism to provide a seamless and delightful user experience.

E-Commerce

E-commerce websites benefit from minimalist design, as it enhances the focus on products and simplifies the purchasing process, leading to increased conversions.

Branding for Startups

Startups and new businesses often adopt minimalist design for their websites to communicate their brand values clearly and leave a lasting impression on their target audience.

Multimedia and Artistic Portfolios

Artists, photographers, and designers often use minimalist web design to showcase their work. The clean layout lets their creations take center stage.

Challenges of Minimalist Web Design

While minimalist web design offers numerous benefits, it does come with its own set of challenges:

Balancing Simplicity and Functionality

Achieving the right balance between a minimalist design and ensuring that all essential functionalities are available can be challenging. Designers must carefully prioritize and include only the most crucial elements.

Communicating Complex Concepts

For websites that deal with complex products or services, communicating information effectively within the constraints of minimalism may require creative solutions.

Standing Out in a Sea of Minimalism

With minimalist design becoming more prevalent, it can be challenging for websites to stand out and create a unique visual identity.

Accessibility

While minimalist design can enhance user experience, designers must ensure that the design remains accessible to all users, including those with disabilities.

Conclusion

The rise of minimalism in web design reflects a shift towards user-centered experiences and the timeless appeal of simplicity. By embracing the “less is more” philosophy, designers can create websites that are aesthetically pleasing, functional, and memorable. Minimalist web design enhances user experiences, improves loading times, and fosters brand clarity, making it a preferred choice for modern web development.

As technology continues to evolve and user preferences change, minimalism will likely continue to play a significant role in shaping the future of web design. The elegance and efficiency of minimalism are bound to captivate designers and users alike, making it a powerful and enduring design philosophy for years to come.

Featured image by Bench Accounting on Unsplash

The post The Rise of Minimalism in Web Design: Less is More appeared first on noupe.

Categories: Others Tags:

Musk Rebrands Twitter to ‘X’ and Removes Iconic Blue Bird Logo

July 24th, 2023 No comments

Twitter.com has officially rebranded to ‘X’ following owner Elon Musk’s controversial decision to remove the social media platform’s famous blue bird logo.

Categories: Designing, Others Tags:

Twitter Rebrand: Musk Finally Finds a Use for x.com

July 24th, 2023 No comments

After months of speculation, unprecedented user drop-off, and reported billion-dollar losses, Elon Musk’s Twitter adventure plumbed new depths by changing the platform’s name to X and adopting a new, more masculine, more aggressive logo.

Categories: Designing, Others Tags:

The Impact of Automation on Field Service Management

July 24th, 2023 No comments

Automation has introduced a paradigm shift in almost every field of human life. From manufacturing to transportation, from healthcare to utilities, there is hardly any sector that is left behind when it comes to leveraging this cutting-edge technology. But the one sector it has completely transformed is field service management. If you are running a field service business in today’s world, it is necessary to understand the impacts of automation and identify the competitive advantages of this disruptive technology.

Key Takeaways

Field service organizations have dedicated teams to manage various tasks and processes to achieve the goal of excellent service delivery. This demands close collaboration, quick reaction times, and an effective way of scheduling and dispatching service jobs. 

Organizations can use field service automation software to remove redundancy, digitize the gathering and use of task-related information, and assist dispatchers in swiftly assigning and scheduling appointments. Organizations can use field service software to accomplish the following:

  • Increased efficiency
  • Enhanced productivity
  • Lower operating costs
  • Shorter resolution time
  • Higher customer satisfaction

Automation is becoming more prevalent in industrial and business processes. Gartner projects that by 2024, 69% of managers’ day-to-day tasks will be completely automated. By decreasing work hours, risks, and the time it takes to execute daily tasks, automation enables executives to concentrate more on customer experiences, informed decision-making, and employee empowerment. 

A modern field service organization demands degrees of automation for allocating the proper experts to the right job as well as for delivering a seamless customer experience. But analog/ manual methods can no longer manage the schedules and deployment of hundreds of workers, track thousands of parts, and cover dozens of warranties in today’s enterprise field service companies. This is where automation takes the driver’s seat in fostering growth and ensuring efficiency in field service management.

If you are still managing your field service business using disparate data silos and complicated spreadsheets, it is time to reconsider your field service strategy by automating your business processes with the help of field service management software. 

Before you try to understand how automation is transforming field service, let’s first try to understand what field service automation is and how it works.

What is Field Service Automation?

Field service automation refers to the methods, policies, and procedures used by a service delivery organization to manage resources. To break it down further, the term “automation” refers to the primary technology features that help to streamline operations, policies, and even procedures. So, field service automation essentially means using technology to streamline processes and policies in field service management.

Field automation systems include simplified workflows and processes that automate important field service operations such as service task generation, service scheduling, dispatching, work order assignment, service reporting, and end-to-end service request tracking.

Benefits of Field Service Automation

Improve Efficiency

In general, automating any part of a business operation will increase the efficiency of an existing process. This is also true for Service Management automation. Many of the actions undertaken in field service operations are inefficient due to the complexity of the workflows. It includes performing redundant, repeated steps, which results in delayed resolution times.  With field service automation, you can streamline routine tasks used by both dispatch and field teams and enable an agile way of working, resulting in quicker service requests and technicians arriving at customer locations. Thus, by reducing lengthy interactions, field technicians may focus on greater responsibilities rather than resolving the situation and focusing on the fundamental cause to eliminate recurring incidents. 

Moreover, service management automation can increase a service desk’s efficiency by up to 30% while saving the business money on operating expenditures. Automation for Service Management can bring clarity to an overburdened general-service desk and help your support teams stay on track by simplifying administration, improving self-service capabilities, and reducing the number of repetitive operations.

Reduced Manual Effort and Labor Hours

Manual processes such as data analysis, tracking technicians, maintaining schedules, and managing service requests can be tedious. They are rather time-consuming and involve the risk of human error when done manually. Using automated systems instead not only eliminates the chances of manual errors but also reduces time and effort for your employees.

Remote Collaboration

One of the major pain points that field service companies face is a lack of coordination between their field technicians and the back office or among teams working at different job sites. This is perhaps the most significant aspect of how automation can help your business. 

When you use FSM software in your field organization, all of the critical field operations are centralized in one area, allowing you to streamline service delivery. In simple terms, coordination becomes more effective when your support staff has seamless access to company data and client portal details in a single location. Furthermore, most leading FSM solutions offer mobile apps for field service technicians, which means not only can they access this data easily, but they can also access it from anywhere without even having to ask the back office for help. 

Real-time Scheduling

Using a field service automation system, you have complete authority over the technician’s work schedule. You can view their availability, assign work orders, and dispatch from the centralized dashboard with just a click of a button. Additionally, your technicians can make schedule changes as needed.

Using field service automation technology, field service technicians can also instantly receive notifications to execute the correct task at the correct time. It is made possible by connecting any smartphone, tablet for service technicians, and other mobile devices to your organization’s field service automation solution.

Customer Satisfaction

The greatest impact of automation in service management is on customer satisfaction and business performance. Automation enables businesses to provide a more timely, efficient, and high-quality customer experience

It’s a powerful combination: providing services that meet the needs of the consumer while also delivering them on time. Service Management automation achieves this goal by connecting the back and front offices for a streamlined procedure.

Importance of Field Service Automation

Paper-based methods are inefficient and costly. Owners of service businesses report that each time a single piece of paper is submitted for processing by field service operatives, their enterprises incur a $10 expense. Modern paperless business software is replacing the frequent manual entries needed by paper-based systems with real-time, automated data exchanges, saving time and money. Modern project management software also enables mobile field service workers to view documents from any device or location, reducing errors while delivering data from the field to numerous departments. 

Final Thoughts

It’s no secret that automation is a big element of today’s service management. If you’re going to employ field service management software, you should be prepared to use field service automation technologies as well. They will lower your workload, accelerate service delivery and invoicing, and reduce errors and data entry time. More importantly, FSM software will provide your customers with a better experience because they will know they can obtain service quickly and that their service requests will never be overlooked. As such, field service automation solutions have not only transformed the way businesses operate but have also proved to be the biggest competitive advantage for service businesses today. 
Therefore, if you own a service business and want to ensure growth and sustainability, you should rethink your strategy and embrace automation. To do this, all you need to do is choose the best field service management software for your company and sign up.

Featured image by Freepik

The post The Impact of Automation on Field Service Management appeared first on noupe.

Categories: Others Tags:

JetBrains Mono Leads the Way as the Ideal Typeface for Developers

July 24th, 2023 No comments

JetBrains Mono is a geometric monospaced typeface designed with developers in mind. It’s easy to read, functional, and, above all, free. It may just be the perfect coding font.

Categories: Designing, Others Tags:

3 Essential Design Trends, August 2023

July 24th, 2023 No comments

There’s an overall movement in website design right now where there are no dominant hero image or video on the homepage. Look at some of your most visited websites, and you might see this trend in action. You’ll surely see it among the three other trends we explore in website design here.

Categories: Designing, Others Tags:

Recreating YouTube’s Ambient Mode Glow Effect

July 24th, 2023 No comments

I noticed a charming effect on YouTube’s video player while using its dark theme some time ago. The background around the video would change as the video played, creating a lush glow around the video player, making an otherwise bland background a lot more interesting.

This effect is called Ambient Mode. The feature was released sometime in 2022, and YouTube describes it like this:

“Ambient mode uses a lighting effect to make watching videos in the Dark theme more immersive by casting gentle colors from the video into your screen’s background.”
— YouTube

It is an incredibly subtle effect, especially when the video’s colors are dark and have less contrast against the dark theme’s background.

Curiosity hit me, and I set out to replicate the effect on my own. After digging around YouTube’s convoluted DOM tree and source code in DevTools, I hit an obstacle: all the magic was hidden behind the HTML element and bundles of mangled and minified JavaScript code.

Despite having very little to go on, I decided to reverse-engineer the code and share my process for creating an ambient glow around the videos. I prefer to keep things simple and accessible, so this article won’t involve complicated color sampling algorithms, although we will utilize them via different methods.

Before we start writing code, I think it’s a good idea to revisit the HTML Canvas element and see why and how it is used for this little effect.

HTML Canvas

The HTML element is a container element on which we can draw graphics with JavaScript using its own Canvas API and WebGL API. Out of the box, a is empty — a blank canvas, if you will — and the aforementioned Canvas and WebGL APIs are used to fill the with content.

HTML is not limited to presentation; we can also make interactive graphics with them that respond to standard mouse and keyboard events.

But SVG can also do most of that stuff, right? That’s true, but is more performant than SVG because it doesn’t require any additional DOM nodes for drawing paths and shapes the way SVG does. Also, is easy to update, which makes it ideal for more complex and performance-heavy use cases, like YouTube’s Ambient Mode.

As you might expect with many HTML elements, accepts attributes. For example, we can give our drawing space a width and height:

<canvas width="10" height="6" id="js-canvas"></canvas>

Notice that is not a self-closing tag, like an or . We can add content between the opening and closing tags, which is rendered only when the browser cannot render the canvas. This can also be useful for making the element more accessible, which we’ll touch on later.

Returning to the width and height attributes, they define the ’s coordinate system. Interestingly, we can apply a responsive width using relative units in CSS, but the still respects the set coordinate system. We are working with pixel graphics here, so stretching a smaller canvas in a wider container results in a blurry and pixelated image.

The downside of is its accessibility. All of the content updates happen in JavaScript in the background as the DOM is not updated, so we need to put effort into making it accessible ourselves. One approach (of many) is to create a Fallback DOM by placing standard HTML elements inside the , then manually updating them to reflect the current content that is displayed on the canvas.

Numerous canvas frameworks — including ZIM, Konva, and Fabric, to name a few — are designed for complex use cases that can simplify the process with a plethora of abstractions and utilities. ZIM’s framework has accessibility features built into its interactive components, which makes developing accessible -based experiences a bit easier.

For this example, we’ll use the Canvas API. We will also use the element for decorative purposes (i.e., it doesn’t introduce any new content), so we won’t have to worry about making it accessible, but rather safely hide the from assistive devices.

That said, we will still need to disable — or minimize — the effect for those who have enabled reduced motion settings at the system or browser level.

requestAnimationFrame

The element can handle the rendering part of the problem, but we need to somehow keep the in sync with the playing and make sure that the updates with each video frame. We’ll also need to stop the sync if the video is paused or has ended.

We could use setInterval in JavaScript and rig it to run at 60fps to match the video’s playback rate, but that approach comes with some problems and caveats. Luckily, there is a better way of handling a function that must be called on so often.

That is where the requestAnimationFrame method comes in. It instructs the browser to run a function before the next repaint. That function runs asynchronously and returns a number that represents the request ID. We can then use the ID with the cancelAnimationFrame function to instruct the browser to stop running the previously scheduled function.

let requestId;

const loopStart = () => {
  /* ... */

  /* Initialize the infinite loop and keep track of the requestId */
  requestId = window.requestAnimationFrame(loopStart);
};

const loopCancel = () => {
  window.cancelAnimationFrame(requestId);
  requestId = undefined;
};

Now that we have all our bases covered by learning how to keep our update loop and rendering performant, we can start working on the Ambient Mode effect!

The Approach

Let’s briefly outline the steps we’ll take to create this effect.

First, we must render the displayed video frame on a canvas and keep everything in sync. We’ll render the frame onto a smaller canvas (resulting in a pixelated image). When an image is downscaled, the important and most-dominant parts of an image are preserved at the cost of losing small details. By reducing the image to a low resolution, we’re reducing it to the most dominant colors and details, effectively doing something similar to color sampling, albeit not as accurately.

Next, we’ll blur the canvas, which blends the pixelated colors. We will place the canvas behind the video using CSS absolute positioning.

And finally, we’ll apply additional CSS to make the glow effect a bit more subtle and as close to YouTube’s effect as possible.

HTML Markup

First, let’s start by setting up the markup. We’ll need to wrap the and elements in a parent container because that allows us to contain the absolute positioning we will be using to position the behind the . But more on that in a moment.

Next, we will set a fixed width and height on the , although the element will remain responsive. By setting the width and height attributes, we define the coordinate space in CSS pixels. The video’s frame is 1920×720, so we will draw an image that is 10×6 pixels image on the canvas. As we’ve seen in the previous examples, we’ll get a pixelated image with dominant colors somewhat preserved.

<section class="wrapper">
  <video controls muted class="video" id="js-video" src="video.mp4"></video>
  <canvas width="10" height="6" aria-hidden="true" class="canvas" id="js-canvas"></canvas>
</section>

Syncing And

First, let’s start by setting up our variables. We need the ’s rendering context to draw on it, so saving it as a variable is useful, and we can do that by using JavaScript’s getCanvasContext function. We’ll also use a variable called step to keep track of the request ID of the requestAnimationFrame method.

const video = document.getElementById("js-video");
const canvas = document.getElementById("js-canvas");
const ctx = canvas.getContext("2d");

let step; // Keep track of requestAnimationFrame id

Next, we’ll create the drawing and update loop functions. We can actually draw the current video frame on the by passing the element to the drawImage function, which takes four values corresponding to the video’s starting and ending points in the coordinate system, which, if you remember, is mapped to the width and height attributes in the markup. It’s that simple!

const draw = () => {
  ctx.drawImage(video, 0, 0, canvas.width, canvas.height);
};

Now, all we need to do is create the loop that calls the drawImage function while the video is playing, as well as a function that cancels the loop.

const drawLoop = () => {
  draw();
  step = window.requestAnimationFrame(drawLoop);
};

const drawPause = () => {
  window.cancelAnimationFrame(step);
  step = undefined;
};

And finally, we need to create two main functions that set up and clear event listeners on page load and unload, respectively. These are all of the video events we need to cover:

  • loadeddata: This fires when the first frame of the video loads. In this case, we only need to draw the current frame onto the canvas.
  • seeked: This fires when the video finishes seeking and is ready to play (i.e., the frame has been updated). In this case, we only need to draw the current frame onto the canvas.
  • play: This fires when the video starts playing. We need to start the loop for this event.
  • pause: This fires when the video is paused. We need to stop the loop for this event.
  • ended: This fires when the video stops playing when it reaches its end. We need to stop the loop for this event.
const init = () => {
  video.addEventListener("loadeddata", draw, false);
  video.addEventListener("seeked", draw, false);
  video.addEventListener("play", drawLoop, false);
  video.addEventListener("pause", drawPause, false);
  video.addEventListener("ended", drawPause, false);
};

const cleanup = () => {
  video.removeEventListener("loadeddata", draw);
  video.removeEventListener("seeked", draw);
  video.removeEventListener("play", drawLoop);
  video.removeEventListener("pause", drawPause);
  video.removeEventListener("ended", drawPause);
};

window.addEventListener("load", init);
window.addEventListener("unload", cleanup);

Let’s check out what we’ve achieved so far with the variables, functions, and event listeners we have configured.

Creating A Reusable Class

Let’s make this code reusable by converting it to an ES6 class so that we can create a new instance for any and pairing.

class VideoWithBackground {
  video;
  canvas;
  step;
  ctx;

  constructor(videoId, canvasId) {
    this.video = document.getElementById(videoId);
    this.canvas = document.getElementById(canvasId);

    window.addEventListener("load", this.init, false);
    window.addEventListener("unload", this.cleanup, false);
  }

  draw = () => {
    this.ctx.drawImage(this.video, 0, 0, this.canvas.width, this.canvas.height);
  };

  drawLoop = () => {
    this.draw();
    this.step = window.requestAnimationFrame(this.drawLoop);
  };

  drawPause = () => {
    window.cancelAnimationFrame(this.step);
    this.step = undefined;
  };

  init = () => {
    this.ctx = this.canvas.getContext("2d");
    this.ctx.filter = "blur(1px)";

    this.video.addEventListener("loadeddata", this.draw, false);
    this.video.addEventListener("seeked", this.draw, false);
    this.video.addEventListener("play", this.drawLoop, false);
    this.video.addEventListener("pause", this.drawPause, false);
    this.video.addEventListener("ended", this.drawPause, false);
  };

  cleanup = () => {
    this.video.removeEventListener("loadeddata", this.draw);
    this.video.removeEventListener("seeked", this.draw);
    this.video.removeEventListener("play", this.drawLoop);
    this.video.removeEventListener("pause", this.drawPause);
    this.video.removeEventListener("ended", this.drawPause);
  };
    }

Now, we can create a new instance by passing the id values for the and elements into a VideoWithBackground() class:

const el = new VideoWithBackground("js-video", "js-canvas");

Respecting User Preferences

Earlier, we briefly discussed that we would need to disable or minimize the effect’s motion for users who prefer reduced motion. We have to consider that for decorative flourishes like this.

The easy way out? We can detect the user’s motion preferences with the prefers-reduced-motion media query and completely hide the decorative canvas if reduced motion is the preference.

@media (prefers-reduced-motion: reduce) {
  .canvas {
    display: none !important;
  }
}

Another way we respect reduced motion preferences is to use JavaScript’s matchMedia function to detect the user’s preference and prevent the necessary event listeners from registering.

constructor(videoId, canvasId) {
  const mediaQuery = window.matchMedia("(prefers-reduced-motion: reduce)");

  if (!mediaQuery.matches) {
    this.video = document.getElementById(videoId);
    this.canvas = document.getElementById(canvasId);

    window.addEventListener("load", this.init, false);
    window.addEventListener("unload", this.cleanup, false);
  }
}

Final Demo

We’ve created a reusable ES6 class that we can use to create new instances. Feel free to check out and play around with the completed demo.

See the Pen Youtube video glow effect – dominant color [forked] by Adrian Bece.

Creating A React Component

Let’s migrate this code to the React library, as there are key differences in the implementation that are worth knowing if you plan on using this effect in a React project.

Creating A Custom Hook

Let’s start by creating a custom React hook. Instead of using the getElementById function for selecting DOM elements, we can access them with a ref on the useRef hook and assign it to the and elements.

We’ll also reach for the useEffect hook to initialize and clear the event listeners to ensure they only run once all of the necessary elements have mounted.

Our custom hook must return the ref values we need to attach to the and elements, respectively.

import { useRef, useEffect } from "react";

export const useVideoBackground = () => {
  const mediaQuery = window.matchMedia("(prefers-reduced-motion: reduce)");
  const canvasRef = useRef();
  const videoRef = useRef();

  const init = () => {
    const video = videoRef.current;
    const canvas = canvasRef.current;
    let step;

    if (mediaQuery.matches) {
      return;
    }

    const ctx = canvas.getContext("2d");

    ctx.filter = "blur(1px)";

    const draw = () => {
      ctx.drawImage(video, 0, 0, canvas.width, canvas.height);
    };

    const drawLoop = () => {
      draw();
      step = window.requestAnimationFrame(drawLoop);
    };

    const drawPause = () => {
      window.cancelAnimationFrame(step);
      step = undefined;
    };

    // Initialize
    video.addEventListener("loadeddata", draw, false);
    video.addEventListener("seeked", draw, false);
    video.addEventListener("play", drawLoop, false);
    video.addEventListener("pause", drawPause, false);
    video.addEventListener("ended", drawPause, false);

    // Run cleanup on unmount event
    return () => {
      video.removeEventListener("loadeddata", draw);
      video.removeEventListener("seeked", draw);
      video.removeEventListener("play", drawLoop);
      video.removeEventListener("pause", drawPause);
      video.removeEventListener("ended", drawPause);
    };
  };

  useEffect(init, []);

  return {
    canvasRef,
    videoRef,
  };
};

Defining The Component

We’ll use similar markup for the actual component, then call our custom hook and attach the ref values to their respective elements. We’ll make the component configurable so we can pass any element attribute as a prop, like src, for example.

import React from "react";
import { useVideoBackground } from "../hooks/useVideoBackground";

import "./VideoWithBackground.css";

export const VideoWithBackground = (props) => {
  const { videoRef, canvasRef } = useVideoBackground();

  return (
    <section className="wrapper">
      <video ref={ videoRef } controls className="video" { ...props } />
      <canvas width="10" height="6" aria-hidden="true" className="canvas" ref={ canvasRef } />
    </section>
  );
};

All that’s left to do is to call the component and pass the video URL to it as a prop.

import { VideoWithBackground } from "../components/VideoWithBackground";

function App() {
  return (
    <VideoWithBackground src="http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4" />
  );
}

export default App;

Conclusion

We combined the HTML element and the corresponding Canvas API with JavaScript’s requestAnimationFrame method to create the same charming — but performance-intensive — visual effect that makes YouTube’s Ambient Mode feature. We found a way to draw the current frame on the , keep the two elements in sync, and position them so that the blurred sits properly behind the .

We covered a few other considerations in the process. For example, we established the as a decorative image that can be removed or hidden when a user’s system is set to a reduced motion preference. Further, we considered the maintainability of our work by establishing it as a reusable ES6 class that can be used to add more instances on a page. Lastly, we converted the effect into a component that can be used in a React project.

Feel free to play around with the finished demo. I encourage you to continue building on top of it and share your results with me in the comments, or, similarly, you can reach out to me on Twitter. I’d love to hear your thoughts and see what you can make out of it!

References

Categories: Others Tags: