html5-canvas

How can we stop this HTML5 Canvas wheel at exact points after spin?

ε祈祈猫儿з 提交于 2020-01-06 08:06:15
问题 In the Below code link HTML5 canvas spin wheel game. I want to stop this canvas at a user-defined position as if the user wants to stop always at 200 texts or 100 texts like that. Currently, it is stopping at random points I want to control where to stop as in if I want to stop circle at 100 or 200 or 0 whenever I want. How can we achieve that??? Can anyone Help!!!!! Attached Codepen link also. Html file <div> <canvas class="spin-wheel" id="canvas" width="300" height="300"></canvas> </div> JS

Drawing line on canvas - unexpected scale

泄露秘密 提交于 2020-01-06 07:26:10
问题 I've a hard problem to describe/present, because this part of code is deeply inside my Angular app. Anyway, I have a div 350px x 350px and I would cover it by canvas, and draw a line on it. What I did? I created a canvas tag before the table and apply this CSS rules: canvas{ position: absolute; width: 350px; height: 350px; border: dotted black 2px; <-- only for visual effect } It covered div. Next I tried to draw a simple line to test it (I missed here part of code which download reference to

best way to display large number of columns in html

假如想象 提交于 2020-01-06 06:56:07
问题 I want to display a large number of columns in html (> 10k Columns and max 200-300 rows) to display a schedule. The content will be some blocks that are moveable with some text in it and a background color. Is it possible to display such a large amount of columns with a table/tr/td? Is there a max number of columns or rows that can be displayed with table/tr/td? Or would you use a canvas? Any other suggestions to solve this? What is the best way (with great performance when scrolling, ...) to

How to remove bitmap image on click from canvas

陌路散爱 提交于 2020-01-06 06:18:09
问题 I am using createjs as my framework. I've placed a Bitmap on the canvas and I created a function to try and remove it but I keep getting an error message in the console that image is not defined. This is what my code looks like: // onload=init() called in html doc function init(){ var canvas = new createjs.Stage("canvas"); // Add image to canvas image = new createjs.Bitmap("image.png"); image.x = 200; image.y = 180; image.scaleX = 0.35; image.scaleY = 0.35; canvas.addChild(image); image

After updating firefox 55 Inline images (img) is not rendering in HTML CANVAS through SVG

自作多情 提交于 2020-01-06 06:07:02
问题 I have developed a CANVAS area in which few HTML elements are rendering as SVG data . It was working perfect before firefox new updated version. Now, after this recent update only CSS background images are rendering. Inline images through img tag is showing nothing. I can't use css background images because, of some limitations. I have to show colors in background and some PNG images on upper layer through higher z-index and position:absolute properties. So, that it will feel like color

JS drawing a line from the edge of a circle to another circle edge

夙愿已清 提交于 2020-01-06 03:19:10
问题 I'm trying to draw a line from the edges of the two circles in HTML5 canvas. So, I know the coordinates of the centers of two circles and their radius. Circles drawn randomly. Line should move from the edge of one circle to the other. Please help! P.S. Sorry for my english :) UPDATE: I'm trying this, but how to know angle? from_line_x = circle1.x + circle1.radius * Math.cos(Math.PI * angle); from_line_y = circle1.y + cirlce1.radius * Math.sin(Math.PI * angle); to_line_x = circle2.x - circle2

EaselJS: Using updateCache() with AlphaMaskFilter When Dragging Mask

一世执手 提交于 2020-01-06 01:52:18
问题 I'm using an imported png with an alpha gradient that I'm setting as a mask that reveals the bitmap it is assigned to. The mask object is draggable (kind of like a flashlight). I know I'm supposed to use an AlphaMaskFilter as one of the filters, and I know I'm supposed to use .updateCache()... I'm just not sure I'm using them correctly? var stage; var assetQueue; var bg; var bgMask; var container; var amf; $(document).ready(function(){ loadImages(); }); function loadImages() { // Set up

Fabric js : how to apply round corner to path & polygon

大憨熊 提交于 2020-01-06 01:32:11
问题 I am working on fabricjs app & i need to draw a path & polygon shapes with round corner I did't get any fabric js parameter to do this & I also search but didn't get any result matching with my requirement Can anyone describe me how draw a path & polygon shapes with round corner in detail with step by step , I need to draw various shapes. eg- i need round corners at red dots as in image canvas = new fabric.Canvas('canvas'); var path = new fabric.Path('M 170.000 210.000L 217.023 234.721 L 208

Is it possible to avoid “The operation is insecure” when using Canvas?

蓝咒 提交于 2020-01-06 01:07:12
问题 I have a HTML canvas (using KineticJS, however canvas aficionados should still chime in) that loads an image from another domain, places it onto the canvas and overlays some other information to product a final image. When I try to use canvas.toDataURL () to output the file, I receive the message "The operation is insecure.", obviously due to cross-domain restrictions. I was wondering if anyone knows of any methods to work around this error (preferably cross-browser compatible). I was

Is it possible to avoid “The operation is insecure” when using Canvas?

风格不统一 提交于 2020-01-06 01:06:46
问题 I have a HTML canvas (using KineticJS, however canvas aficionados should still chime in) that loads an image from another domain, places it onto the canvas and overlays some other information to product a final image. When I try to use canvas.toDataURL () to output the file, I receive the message "The operation is insecure.", obviously due to cross-domain restrictions. I was wondering if anyone knows of any methods to work around this error (preferably cross-browser compatible). I was