Persisting Custom Attributes During Fabric.js Canvas Serialization
Fabric.js automaticaly filters out non-standard properties when exporting canvas data via built-in serialization methods. By default, attributes appended directly to shape instances are stripped during the conversion process to prevent bloating the resulting payload with unsupported fields.
When instantiating a drawing object, developers often ...
Posted on Wed, 17 Jun 2026 17:20:16 +0000 by marknt
Playing Videos with p5.js: A Practical Guide
Overview
Most developers use p5.js for drawing and creative coding, but the library also handles video playback from files and live camera streams. This guide covers the esssentials of working with video in p5.js.
Video File Playback
p5.js offers two approaches for video playback: rendering through a native <video> element or drawing fram ...
Posted on Tue, 16 Jun 2026 17:07:33 +0000 by IOAF
Center-Based Scaling in Fabric.js
When creating objects in Fabric.js, the default scaling origin point is positioned at the opposite corner of the element's control points. This behavior may not always align with your requirements.
Holding the alt key during a scaling operation shifts the origin to the element's center. However, you can configure the default behavior so that al ...
Posted on Fri, 12 Jun 2026 16:37:41 +0000 by hehachris
Implementing Radial and Linear Gradients in Fabric.js
To build gradient effects in a Vue 3 application using Fabric.js, you can create both linear and radial color transitions directly on canvas objects. Thelux explained demonstrates how to define, configure, and apply these gradients.
Start by scaffolding a Vue 3 project with Vite if needed:
npm init @vitejs/app
Select Vue 3 and complete the pro ...
Posted on Sat, 06 Jun 2026 16:01:01 +0000 by sharapov
Implementing Italic Text Styling with Fabric.js IText
Applying italic styling to text created with IText in Fabric.js can be configured during initial creation or manipulated dynamically by user interaction.
Setting up the Canvas
Begin by initializing a Fabric.js canvas and adding an IText object.
<canvas id="mainCanvas" width="400" height="200"></canvas>
...
Posted on Sun, 31 May 2026 20:47:56 +0000 by timon
Handling Image Display Failures in Uniapp Upload Components via Resolution Compression
A frequent issue when working with file upload components in mini-programs is broken image previews—typically indicated by a exclamation mark icon and accompanied by a 404 status. While the root cause can sometimes be an incorrect file format, another subtle culprit is excessive image resolution. Files under 20 MB upload successfully, but previ ...
Posted on Sat, 16 May 2026 15:48:21 +0000 by stuartc1
Freehand Rectangle Drawing with Fabric.js
Core Principles
To create rectangles via a "drag-to-select" method, focus on two key actions:
Capture start coordinates (mouse button pressed) and end coordinates (mouse button released).
After releasing the mouse, use the two coordinates to calculate the rectangle’s dimensions (width/height) and position.
Fabric.js provides event l ...
Posted on Thu, 14 May 2026 15:30:51 +0000 by aldoh
Implementing Horizontal Image Split in UniApp WeChat Mini Program
Parent Component for Image Upload
Create an upload button that trigegrs the file selection dialog:
uni.chooseMessageFile({
extension: [".jpg", ".png", ".jpeg"],
success: (res) => {
const paths = res.tempFiles.map((item) => item.path);
uni.navigateTo({
url: `/pages/document/detail?files=${pat ...
Posted on Thu, 14 May 2026 10:26:19 +0000 by SargeZT
Correcting iOS Camera Image Orientation in JavaScript
Images captured by iOS device cameras often appear rotated 90 degrees when displayed in web applications. This occurs due to orientation metdaata stored in the image's EXIF data, which requires manual correction for proper rendering. The issue primarily affects iOS and certain Samsung devices.
The solution involves reading EXIF orientation tags ...
Posted on Mon, 11 May 2026 11:17:58 +0000 by markkanning
Implementing Image Overlays on Fabric.js Canvases
When you need more visual flexibility than a solid color overlay for your Fabric.js canvas, the library supports image-based foreground masking. Unlike solid color overlays that automatically span the entire canvas regardless of viewport changes, image overlays require consideration of their inherent dimensions and interactions with panning and ...
Posted on Sun, 10 May 2026 09:17:59 +0000 by crucialnet