INFO 1300: Animations, Fonts, and Videos
Class 26: Animations, Fonts, and Videos
- Web animation considerations
- Self-hosted assets (fonts, videos, etc.)
- Self-hosted fonts
- Self-hosted videos
Copyright 2026, Kyle J. Harms
Web Animations
Web Animations
Changing the presentation of a web page over time by modifying the presentation of the page's elements.

Web Animations – Basics

Discussion: Animation Reflection
When should we use animation on a website and when should we avoid it?
Tip: Think back to the interaction design principles:
- Functional – assists with the user's goals.
- Affordances – provide strong clues for the operation of things.
- Visibility – make the relevant parts visible.
- Feedback – give each action an immediate and obvious effect.
- Familiarity – conform to established design patterns.
Discussion: Exploring the Role of Animation
Discussion: scroll-behavior

Use animation to improve the usability of a website.
Avoid animation to "wow" or impress.
Animation Usability
Peripheral motion demands attention – animation will likely catch your users' attention.
Goal: Animation should aid user comprehension and understanding.
Ask yourself, does the animation improve the usability for the users? If not, avoid it!
:thumbsup: / :thumbsdown:: Animation Usability
Does this animation improve the usability of the website?
Hint: Does the animation aid user comprehension and understanding? Does the animation add meaning to the user's interaction?
Animation Design/Usability Guidelines
-
Use animation selectively to attract users' attention; be judicious with your use of animation.
-
If user testing indicates that users aren't noticing a change, leverage animation to prevent change blindness.
-
Animation can help communicate context.
Example: Images slide left (previous slide) or right (next slide) in a carousel slideshow.
Animation Design/Usability Guidelines
-
Only use animation if the animation would add meaning to the user's interaction.
Example: Sliding left/right communicates to the user that these images are all related, and that you can see them all if you continue to cycle through them all.
No Meaning: The background scrolls when you scroll the page (not accessible). It looks cool, but how does parallax scrolling help the user better understand the scrolling the page interaction?
Animation Accessibility Guidelines
-
Use animation to prevent sudden changes or flashing on a web page.
Example: Gradually resize an answer when using an accordion for an FAQ.
-
A website must be usable without animation. Use media queries to disable animation when the user prefers reduced motion.
@media (prefers-reduced-motion: reduce) {/* TODO: turn off animations */}
Activity: Animation Usability Critique
Working with a peer, complete the handout.
Discussion: Carousel Animation

Web Animations – Approaches
JavaScript Animations
✅ More control (respond to clicks, chain steps)
:heavy_exclamation_mark: Library animations (e.g., jQuery) run on the main thread – can be slower
Examples
- Web Animations API
- External Libraries
CSS Animations
✅ Simpler – just CSS, no JavaScript
✅ Often faster (browser can optimize them)
Examples
- CSS Animations – full animations
- CSS Transitions – animate CSS property
Demo: jQuery Effects
// turn off jQuery animations if the user prefers reduced motion
$.fx.off = window.matchMedia("(prefers-reduced-motion: reduce)").matches
$("#cookie-accept-button").on("click", function () { // ← click event
// ↓ action snippets ↓
$("#cookie-banner").slideUp().promise().done(function () {
$("#cookie-banner").addClass("hidden")
})
// ↑ action snippets ↑
}) // ← click event
Demo: Font-Size Transition

/* Animate breakpoints */
body {
transition: font-size 1s ease;
}
@media (prefers-reduced-motion: reduce) {
body {
transition: none;
}
}
Self-Hosted Assets
Discussion: Why Download jQuery?
We added jquery-4.0.0.min.js into our scripts folder:
<script src="scripts/jquery-4.0.0.min.js"></script>
Alternatively, we could have hotlinked it from the jQuery server:
<script src="https://code.jquery.com/jquery-4.0.0.min.js"></script>
Why add it locally, rather than hotlinking to the jQuery server?
Hotlink vs. Self-Host Assets (Resources)
Hotlink
The website loads the resource from a server that's not controlled by you.
Examples:
- jQuery from a CDN
- Google Fonts
- Embed a YouTube video
Self-Host
The resource is located locally on your web server. (i.e. you control it.)
Examples:
scripts/jquery-4.0.0.min.jsmedia/video.mp4
Why Self-Host?
✅ Benefits
- Privacy – no third party sees your users' data.
- Reliability – no outage or shutdown at another company can break your site.
- Control – the file never changes unless you change it.
- Security – a hacked third-party server can't inject code into your site.
:heavy_exclamation_mark: Risks
- Bandwidth & Storage – you pay to serve the files.
- Maintenance – you have to manage updates (e.g., security fixes) yourself.
- Setup – you may need to download or convert files yourself.
Example: polyfill.min.js (2024)
polyfill.min.js was a popular third-party JavaScript library used by 100,000+ websites.
In 2024, a new company bought the polyfill.io domain and changed polyfill.min.js to insert malicious code on any website that uses it.
Every website that hotlinked to polyfill.io was impacted immediately, without notice.
Websites that self-hosted a copy of the library were not affected.
Self-Hosting Fonts
Font Support: System vs. Web
System Fonts
Fonts that are already installed on the user's device.
You can use them in your CSS (e.g. font-family: "Arial", sans-serif;)
There is no guarantee that a font is installed on a user's device.
Web Fonts
Fonts that are downloaded by the browser when the page loads.
You can use different fonts, even if they're not installed on the user's device.
You can self-host web fonts, or hotlink them from a font service (e.g., Google Fonts).
Font Service: Google Fonts
Google Fonts gives you a <link> element to copy into your HTML:
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link rel="stylesheet"
href="https://fonts.googleapis.com/css2?family=Lora:ital,wght@0,400..700;1,400..700&display=swap">
Caution: Every visitor's browser connects to Google's servers, sending Google their IP address, violating your users' privacy.
Note: In 2022, a German court ordered a website to pay damages for hotlinking Google Fonts without visitors' consent.
Self-Hosted Web Fonts
-
Use a font with a license that permits web use.
Open source fonts (e.g., SIL Open Font License) are free to self-host.
Commercial fonts often do not permit web use, or require a separate web license.
-
Include the fonts (.woff2 files) in your website's fonts folder.
WOFF2 = Web Open Font Format 2 (supported by all modern browsers)
-
A CSS
@font-facerule to load the font from your server.
@font-face
The CSS @font-face rule tells the browser to download a font.
@font-face {
font-family: "Lora";
src: url("../fonts/lora.woff2")
format("woff2");
font-weight: 400 700;
font-style: normal;
font-display: swap;
}
body {
font-family: "Lora", Georgia, serif;
}
font-family– the name you'll usesrc– URL of the .woff2 filefont-weight– weight(s) providedfont-style–normaloritalicfont-display: swap– show a fallback font while the web font downloads
Gotcha: url() – Paths in CSS
URLs inside a CSS file are relative to the CSS file, not the HTML file!
- index.html
- fonts/
- lora.woff2
- styles/
- site.css
❌ url("fonts/lora.woff2")
✅ url("../fonts/lora.woff2")
(i.e. .. go up one folder from styles/ to the root, then into fonts/)
Demo: Self-Hosted Font
- Download font files (and license) into a
fontsfolder. - Convert to
.woff2format if necessary. - Add
@font-facerules to the CSS (normal + italic). - Add
"Lora"to thefont-familyfont stack. - Check the Network tab in the browser's developer tools – where did the font come from?
Self-Hosting Videos
Adding Video to a Website
Code
-
Refer to the reference documentation (
videoelement) -
Support multiple browsers:
WebM and MP4 video formats
-
Provide captions
Design
-
Sketch/plan video location in layout
-
Design usable video controls
-
Avoid auto-play
(auto-play isn't accessible)
Video Approaches
-
Embed (i.e. hotlink) video from a platform/service provider
Example: youtube.com
Caution: Does not protect the privacy of your website's users.
Note: Platform outages may impact the utility of your website.
-
Self-hosted video (today's lecture)
Host the video files on your web server.
Caution: Video bandwidth can be costly.
Hotlink vs. Self-Host Video
| Platform/Service Provider | Self-Hosted | |
|---|---|---|
| Bandwidth Cost | Cheaper | Expensive |
| Maintenance | Platform handles | You handle |
| Content | Platform may remove content | Full control |
| Privacy | Platform likely tracks users | Full privacy |
| Control | Limited control | Full control |
Platform/Service Provider Video
Follow the platform's reference documentation.
Example:
<iframe
width="560"
height="315"
src="https://www.youtube.com/embed/DLzxrzFCyOs?si=8c-xLUdqRyyyrrvf"
title="YouTube video player"
frameborder="0"
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
referrerpolicy="strict-origin-when-cross-origin"
allowfullscreen>
</iframe>
Self-Hosted Video
<video controls preload="metadata"
poster="media/poster.jpg">
<source src="media/video.webm"
type="video/webm">
<source src="media/video.mp4"
type="video/mp4">
<track default label="English" kind="captions"
srclang="en" src="media/captions_en.vtt">
<p>Sorry, your browser doesn't
support embedded videos</p>
</video>
Demo: Self-Hosted Video
- Create a poster image (JPG) for the video.
- Convert the video to .webm and .mp4 formats.
- Create captions in .vtt format.
- Add poster, video, and caption files to website repository.
- Add
<video>element to HTML page.

Self-Hosted Video Tools
- poster image: Use a video player, like VLC to capture a frame (snapshot) from the video and save it as a web-safe image format.
- .mp4, .webm video files: Use FFmpeg or HandBrake to convert video files to MP4 and WebM formats.
- .vtt captions: Use VTT Creator to create captions for the video. (WCAG 2.2, A)
- Transcript: Provide a text transcript of the video on the page or as a link. (WCAG 2.2, AAA)
What's Next
Wednesday:
- Lecture: Self-Hosting a Static Website
- Project, Oral Defense due
Friday:
- Oral defense presentations during sections
Monday:
- Lecture: Final Exam Q & A

