canvas

How to create a ruler a tool for canvas?

与世无争的帅哥 提交于 2021-01-06 04:57:22
问题 Like the standard paint program in windows, I'm trying to create a very basic sketch canvas program where the the user can select a ruler tool to draw with on the canvas. How do I achieve this? I'm quite a beginner so I'd appreciate if the answer is as simple as possible... Thanks!! 回答1: If I may suggest you could use my easyCanvas library. It's a library that wraps around standard canvas and let you use it as ordinary but adds some handy functionality (GPL3). If this is an option you could

delay execution of javascript for canvas until fonts have been loaded

橙三吉。 提交于 2021-01-06 03:07:24
问题 I'm making something in canvas that uses fonts from a web service and what happens is that when the canvas is first loaded the fonts, which I'm loading from google fonts, haven't arrived yet so for the briefest of moments there's only plain font in the canvas and then it switches to my downloaded font. This is a minor detail but very annoying. I'm wondering if theres any way to preload the fonts, i.e. not execute the canvas associated javascript code until after I'm sure I have the fonts

delay execution of javascript for canvas until fonts have been loaded

不羁岁月 提交于 2021-01-06 03:05:14
问题 I'm making something in canvas that uses fonts from a web service and what happens is that when the canvas is first loaded the fonts, which I'm loading from google fonts, haven't arrived yet so for the briefest of moments there's only plain font in the canvas and then it switches to my downloaded font. This is a minor detail but very annoying. I'm wondering if theres any way to preload the fonts, i.e. not execute the canvas associated javascript code until after I'm sure I have the fonts

How to pass canvas stream to another window since createObjectURL is deprecated?

浪尽此生 提交于 2021-01-05 08:15:09
问题 I'm building a very specific project that has the following: A main window with a canvas element. A second window opened from the main one (window.open(...)) which gets a webcam stream and draws it on a canvas. I need to draw the same canvas, realtime, on the canvas in the main window. What I am doing now is on my second window, I do window.URL.createObjectURL(canvasStream) which gives me a blob url I can use in the main window to get the feed and draw it back on the main canvas. This all

How to pass canvas stream to another window since createObjectURL is deprecated?

六月ゝ 毕业季﹏ 提交于 2021-01-05 08:14:39
问题 I'm building a very specific project that has the following: A main window with a canvas element. A second window opened from the main one (window.open(...)) which gets a webcam stream and draws it on a canvas. I need to draw the same canvas, realtime, on the canvas in the main window. What I am doing now is on my second window, I do window.URL.createObjectURL(canvasStream) which gives me a blob url I can use in the main window to get the feed and draw it back on the main canvas. This all

How to pass canvas stream to another window since createObjectURL is deprecated?

喜夏-厌秋 提交于 2021-01-05 08:14:11
问题 I'm building a very specific project that has the following: A main window with a canvas element. A second window opened from the main one (window.open(...)) which gets a webcam stream and draws it on a canvas. I need to draw the same canvas, realtime, on the canvas in the main window. What I am doing now is on my second window, I do window.URL.createObjectURL(canvasStream) which gives me a blob url I can use in the main window to get the feed and draw it back on the main canvas. This all

How to pass canvas stream to another window since createObjectURL is deprecated?

不羁岁月 提交于 2021-01-05 08:13:45
问题 I'm building a very specific project that has the following: A main window with a canvas element. A second window opened from the main one (window.open(...)) which gets a webcam stream and draws it on a canvas. I need to draw the same canvas, realtime, on the canvas in the main window. What I am doing now is on my second window, I do window.URL.createObjectURL(canvasStream) which gives me a blob url I can use in the main window to get the feed and draw it back on the main canvas. This all

Import svg with gradient stroke to paper.js project

非 Y 不嫁゛ 提交于 2021-01-04 07:26:28
问题 Paper.js don't show path with gradient imported from SVG. Here is an example https://codepen.io/Husband/pen/LoomQo As you can see a path with stroke color red is displayed, and path with a gradient is hidden. <canvas id="canvas" resize></canvas> <svg xmlns="http://www.w3.org/2000/svg" width="1440" height="593" viewBox="0 0 1440 593" id="svg" style="display: none"> <defs> <linearGradient id="a" x1="3.463%" y1="53.239%" y2="53.239%"> <stop offset="0%" stop-color="#2CC2FE" stop-opacity="0"/>

fabricjs multiple canvases handling

风格不统一 提交于 2021-01-04 07:23:19
问题 Using angular In a foreach loop i am generating a canvas using Fabricjs and attaching images and text. What i need to know is how to keep track of the multiple canvas variables being set. angular.forEach($scope.data, function (obj, key) { var newCanvas = document.createElement('canvas'); newCanvas.id = 'variableCanvas'+key; var body = document.getElementById("canvasContainer"); body.appendChild(newCanvas); var canvas = new fabric.Canvas('variableCanvas'+key, { backgroundColor: 'rgb(215,215

fabricjs multiple canvases handling

本小妞迷上赌 提交于 2021-01-04 07:19:01
问题 Using angular In a foreach loop i am generating a canvas using Fabricjs and attaching images and text. What i need to know is how to keep track of the multiple canvas variables being set. angular.forEach($scope.data, function (obj, key) { var newCanvas = document.createElement('canvas'); newCanvas.id = 'variableCanvas'+key; var body = document.getElementById("canvasContainer"); body.appendChild(newCanvas); var canvas = new fabric.Canvas('variableCanvas'+key, { backgroundColor: 'rgb(215,215