惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Martin Fowler
Martin Fowler
L
LINUX DO - 最新话题
P
Proofpoint News Feed
Cyberwarzone
Cyberwarzone
Know Your Adversary
Know Your Adversary
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
L
Lohrmann on Cybersecurity
D
Darknet – Hacking Tools, Hacker News & Cyber Security
Security Latest
Security Latest
T
The Exploit Database - CXSecurity.com
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
P
Privacy & Cybersecurity Law Blog
K
Kaspersky official blog
The Last Watchdog
The Last Watchdog
Webroot Blog
Webroot Blog
Scott Helme
Scott Helme
T
Threat Research - Cisco Blogs
C
Cyber Attacks, Cyber Crime and Cyber Security
WordPress大学
WordPress大学
L
LINUX DO - 热门话题
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
博客园 - Franky
V
Visual Studio Blog
O
OpenAI News
AI
AI
Hacker News: Ask HN
Hacker News: Ask HN
V2EX - 技术
V2EX - 技术
GbyAI
GbyAI
Recent Commits to openclaw:main
Recent Commits to openclaw:main
Simon Willison's Weblog
Simon Willison's Weblog
S
Schneier on Security
Spread Privacy
Spread Privacy
Y
Y Combinator Blog
I
InfoQ
H
Hackread – Cybersecurity News, Data Breaches, AI and More
T
Threatpost
C
Cybersecurity and Infrastructure Security Agency CISA
F
Fortinet All Blogs
C
CERT Recently Published Vulnerability Notes
T
The Blog of Author Tim Ferriss
C
Check Point Blog
Apple Machine Learning Research
Apple Machine Learning Research
有赞技术团队
有赞技术团队
人人都是产品经理
人人都是产品经理
N
News and Events Feed by Topic
Project Zero
Project Zero
小众软件
小众软件
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
B
Blog
G
Google Developers Blog

KIRUPA | Designers and Developers Unite

Understanding Merkle Trees Is a CompSci Degree Still Valuable in the Age of AI? The Model Context Protocol (MCP) Explained Vibe Coding + Expertise = Mega Win! 🏆 Animating our Grid How to Count in Negabinary (Base (-2)) — A Visual Guide Counting in Binary and Hexadecimal Pascal Pixel on Design, Development, and Solopreneurship! Do we really need to know how things work? 🧠 Drawing Sharp Lines on the Canvas The KIRUPA Tech Stack : It Bloom Filter: A Deep Dive Hash Functions Deep Dive Advanced Glitch Effect with Sound AI Killed the Content Creator...Star 🤩 Measuring the Distance Between Two Points by using the Pythagorean Theorem Detecting Browser Zoom Changes in JavaScript Creating a Fullscreen Grid Drawing a Perfect Grid on the Canvas Preserving the Pixel Art Look in Web Content Ensuring our Canvas Looks Good on Retina/High-DPI Screens Finding Prime Numbers Using a Sieve of Eratosthenes Two-Dimensional (2D) Arrays in JavaScript Two-Dimensional (2D) Arrays in JavaScript Animations: From Biology to JavaScript! 🦠 You’ll Always be Building & Designing Creating a Cluster Growth Animation: From Biology to JavaScript Timsort: A Lightning Fast Hybrid Sorting Algorithm Merge Sort: A Simple Step-by-Step Walkthrough 😀 - YouTube Bubble Sort: A Detailed Deep-Dive 🛁 Insertion Sort: A Deep Dive! 🍣 Selection Sort: A Step-by-Step Guide 💬 Radix Sort: A Complete Guide to Fast and Efficient Sorting! ⚡️ Career Growth Secrets Counting Sort : A Friendly (yet Detailed!) Deep Dive! 🎯 Bogosort: Sorting in the Slow Lane! 🐢 Pulling Off a Successful Redesign Creating Your Own Perfect Timing Radix Sort Making Counting Sort Work with Negative Values Diving Deep into Array Index Positions The Career Three Body Problem Counting Sort Work on Problems You Deeply Care About The Importance of Finding a Career Mentor Creating a Random Walk Simulation What is Product Strategy? Thinking about an 8K Resolution Future! 📺 Creating an Animated 3D Starfield Effect Meet the Default Sorting Algorithms! Bogosort Remapping Values Getting Started with Learning Data Structures and Algorithms Tech Slowdown Explained, Part 1: Interest Rates 💸 Easily Draw any Polygon Changing Colors in an SVG Element Using CSS and JavaScript Stability and Sorting Algorithms Creating a Scrollable DIV Area Visualizing Recursion with the Sierpinski Triangle Fast Sorting with Quicksort The Monty Hall Problem Stacks in JavaScript Depth-First Search (DFS) and Breadth-First Search (BFS) Introduction to the Graph Data Structure Big-O Notation and Complexity Analysis Introduction to Data Structures Arrays: A Data Structure Deep Dive Hashtables: A Deep Dive into Efficient Data Storage and Retrieval Trie (aka Prefix Tree) Embracing Generative AI with Open Arms! 🧸 Impact of AI on UI/UX Design with Chloe Barreau 🎨 Heap Data Structure Binary Search Trees Binary Tree Traversal Alphabetically Sort Names in an Array Overlapping Elements on Top of Each Other Developer Relations and Beyond with Jamie Barton! 🚀 A Trip Down Memory Lane 💾 Binary Trees Linked List The Present and Future of AI Tools with Ray (aka devbyrayray) "Guess the Number" and Binary Searching! 🔍 Switching Web Hosts in 2023 😱 SVG: Converting Shape to Path The Versatility of SVGs 🌀 Spinning Circular Text Introduction to Trees Faster Searching with Binary Search Search Algorithms and Linear Search Fibonacci and Going Beyond Recursion Guess the Number Game
Realistic CSS Animations and the linear() Timing Function! 🍱
KIRUPA 🍊 · 2023-08-29 · via KIRUPA | Designers and Developers Unite

Hi everybody - When it comes to creating realistic animations, a crucial element is the various accelerations and decelerations that make up the animation’s behavior:

javascript animation

We define these accelerations and decelerations in our web animations by defining what are known as timing (aka easing) functions. If you aren’t familiar with what these are, take a quick five-minute detour and take a look at my Timing Functions in CSS article.

In the following sections, let’s look at an exciting new development that has happened in the timing functions world! 🥳

For animations created in JavaScript, a timing function is just code. There are no limitations to how elaborate our timing function can become, and there are many prebuilt libraries of timing functions that we can use, such as the infamous Penner Easing equations (JS-only code):

For animations created in CSS, the breadth of timing functions available was limited. The most we could do is represent a timing function using a cubic-bezier function. A cubic-bezier function was not expressive enough to represent the more realistic accelerations and decelerations our animations would have needed.

To work around the CSS limitations, we had two options:

  1. Define our animations entirely in JavaScript, bypassing the simplicity of CSS

  2. Use the built-in timing functions and sacrifice the realism that we may have wanted our animations to exhibit

Neither of these were desirable options, but that is the best we could do. There were a few false starts to address this over the years such as Safari prototyping a spring easing function, but none of it really hit mass adoption. That is until now.

Introduced recently, the linear() timing function gives you and I nearly full control in defining every detail of how our timing function needs to behave. For the full rundown on what the linear() timing function is and how to use it, this article from the Chrome team is fantastic.

The TL;DR is that we can pair our CSS animations and transitions with a timing function that can give us realistic accelerations and decelerations. This means, we can create a hover effect with this cool kinda bounce using only CSS (see live version):

The linear() timing function values that make this bounce effect work look as follows:

At this moment, you are probably wondering how one generates all those strange decimal values and percentages (aka stops)? The linear easing generator can help here, and we’ll likely see more tools coming out in the future that make generating these stops even easier.

Browser support for the linear() timing function is…

Chrome, Firefox, and Chromium-based browsers like Edge support it. Safari (and all browsers on iOS) don’t support the linear() timing function yet, so we need to provide adequate fallbacks:

I created a short companion post where I highlight how to use the linear() timing function with a fallback cubic-bezier() function for those browsers that don’t support it. Definitely take a look at that.

I feel like more has happened in the last year in advancing the state of web animation forward than there has been in the past five years combined. These certainly are some fun times, so look forward to more animation-related items getting mixed in with the regular dose of content you see.

If you want to reach out to me, reply to this newsletter, ping me on Twitter, or go to the forums like the good old days.

Cheers,
Kirupa 😁