Products
Features
YouTube Video Summarizer
Summarize YouTube videos
Web & PDF Highlighter
Highlight web pages & PDFs
Chat with PDF
Ask any PDF questions with AI
Ask AI Clone
Chat with your highlights & memories
Audio Transcriber
Transcribe audio files to text
Glasp Reader
Read and highlight articles
Kindle Highlight Export
Export your Kindle highlights
Idea Hatch
Hatch ideas from your highlights
Integrations
Obsidian Plugin
Notion Integration
Pocket Integration
Instapaper Integration
Medium Integration
Readwise Integration
Snipd Integration
Hypothesis Integration
Apps & Extensions
Chrome Extension
Safari Extension
Edge Add-ons
Firefox Add-ons
iOS App
Android App
Discover
Discover
Ideas
Discover new ideas and insights
Articles
Curated articles and insights
Books
Book recommendations by great minds
Posts
Essays and notes from readers
Quotes
Inspiring quotes collection
Videos
Curated videos and summaries
Explore Glasp
Glasp Newsletter
Weekly insights and updates
Glasp Talk
Interview series with great minds
Glasp Blog
Latest news and articles
Glasp Use Cases
Learn how others use Glasp
Build & Support
Glasp API
Access Glasp's API for developers
MCP Connector
Connect Glasp to Claude & ChatGPT
Community
Glasp Reddit Community
Students
Student discount and benefits
FAQs
Frequently Asked Questions
AboutPricing
DashboardLog inSign up

How to use scale() in p5.js

47.2K views
•
September 19, 2017
by
The Coding Train
YouTube video player
How to use scale() in p5.js

TL;DR

Scale function in transformations resizes shapes relative to the origin, allowing for stretching, shrinking, flipping, and creating 3D effects.

Transcript

[DING] Hello. So this is a little bit of a part 2 tutorial about transformations. And what I want to do is show you what the scale function does. And I don't know that this merits its own video, but I didn't fit it into the last one, so that's why I'm doing it. So what does the scale function do? So first of all, we see-- and there's some other imp... Read More

Key Insights

  • 😥 Scale function resizes shapes relative to the origin point in transformations.
  • ❣️ Different arguments can be used for x and y-axis scaling independently.
  • 🐬 Negative values in the scale function flip or mirror shapes.
  • 🎑 Scale can be used creatively to create 3D effects in 2D scenes.
  • 🪈 Understanding the order of operations in transformations is crucial for the desired output.
  • 🗾 Scale function can be used to zoom and pan around a 2D scene like a map.
  • ⚖️ Flipping images can be done efficiently using the scale function.

Install to Summarize YouTube Videos and Get Transcripts

Explore YouTube Video Summarizer or Get YouTube Transcript Extractor

Questions & Answers

Q: How does the scale function differ from translate and rotate in transformations?

The scale function in transformations resizes shapes relative to the origin, unlike translate which moves the origin and rotate which changes the view angle of the canvas.

Q: Can scale take different arguments for the x and y-axis individually?

Yes, the scale function can take one argument for uniform scaling or two arguments for scaling along the x and y-axis individually, allowing for unique shape transformations.

Q: What happens when negative values are used with the scale function?

Negative values in the scale function cause shapes to flip or mirror, providing a simple way to draw mirrored images without manually rearranging pixels.

Q: How can the scale function be used to create a 3D effect in a 2D scene?

By using variables like mouseX or mouseY divided by a constant value as arguments for scale, a 3D effect can be achieved in a 2D scene by zooming in and out dynamically.

Summary & Key Takeaways

  • Translate moves the origin point, allowing drawing relative to the new location.

  • Rotate changes the canvas view for rotated shapes to be drawn.

  • Scale stretches or shrinks shapes relative to the origin, enabling unique manipulations like flipping.


Read in Other Languages (beta)

English

Share This Summary 📚

Summarize YouTube Videos and Get Video Transcripts with 1-Click

Download browser extensions on:

Try YouTube Summary with ChatGPT & Claude or YouTube Transcript Generator

Explore More Summaries from The Coding Train 📚

8.1: Fractals - The Nature of Code thumbnail
8.1: Fractals - The Nature of Code
The Coding Train
ITP/IMA Winter Show 2019 thumbnail
ITP/IMA Winter Show 2019
The Coding Train
ITP/IMA Winter Show 2018 thumbnail
ITP/IMA Winter Show 2018
The Coding Train
9.4: Genetic Algorithm: Looking at Code - The Nature of Code thumbnail
9.4: Genetic Algorithm: Looking at Code - The Nature of Code
The Coding Train
Text Generation using Spell with Nabil Hassein thumbnail
Text Generation using Spell with Nabil Hassein
The Coding Train
Coding Challenge #126: Toothpicks thumbnail
Coding Challenge #126: Toothpicks
The Coding Train

Summarize YouTube Videos and Get Video Transcripts with 1-Click

Download browser extensions on:

Try YouTube Summary with ChatGPT & Claude or YouTube Transcript Generator

Apps & Extensions

  • Chrome Extension
  • Safari Extension
  • Edge Add-ons
  • Firefox Add-ons
  • iOS App
  • Android App

Key Features

  • YouTube Video Summarizer
  • Web & PDF Summarizer
  • Web & PDF Highlighter
  • Chat with PDF
  • Ask AI Clone
  • Audio Transcriber
  • Glasp Reader
  • Kindle Highlight Export
  • Idea Hatch

Integrations

  • Obsidian Plugin
  • Notion Integration
  • Pocket Integration
  • Instapaper Integration
  • Medium Integration
  • Readwise Integration
  • Snipd Integration
  • Hypothesis Integration

More Features

  • APIs
  • MCP Connector
  • Blog & Post
  • Embed Links
  • Image Highlight
  • Personality Test
  • Quote Shots

Company

  • About us
  • Blog
  • Community
  • FAQs
  • Job Board
  • Newsletter
  • Pricing
Terms

•

Privacy

•

Guidelines

© 2026 Glasp Inc. All rights reserved.