canvas

Draw a circle in canvas manually pixel by pixel [closed]

北战南征 提交于 2019-12-31 06:17:27
问题 Closed . This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 5 years ago . I am trying to do some complicated effect, and to do it i have to break it down into its components, upon which i can build on and hopefully they will come together. Now to make a circle in canvas is easy. But i want to make it myself. So I want to write a function that would be given a point that

gravity inside html5 canvas

橙三吉。 提交于 2019-12-31 05:18:09
问题 I'm trying to do a copy of the original super mario game using html5 canvas just for fun and to learn more about the canvas tool and it's animation but i am stuck at making Mario do it's jump here is my jsfiddle : http://jsfiddle.net/2tLCk/1/ how should i fix my up function to make mario jump and return back to the ground like in this website http://blog.nihilogic.dk/ i tried to understand it's code but i couldn't ? if (keydown.up) { vy += gravity; character.CurentPos = 11; character.x +=

Unity 2D - moving an instantiated GUI element in canvas at certain speed regardless of canvas screen resolution

送分小仙女□ 提交于 2019-12-31 05:14:17
问题 I'm trying to move an instantiated GUI element across the screen but all seems fine until I change the screen resolution to something larger like 2048 x 2732 iPad .. The GUI movement becomes slow.. What do you guys think is the perfect solution to this.. Please help.. This moves the GUI gameobject in the canvas rb.velocity = new Vector2 (speed, 0); 回答1: Two two secrets here are (1) You must understand Unity's canvas scaling system's scale mode (2) and the "reference size" concept Here's how .

How to access the image data after dropping an image from the html-part of a webpage onto a canvas?

风格不统一 提交于 2019-12-31 04:29:25
问题 This is a follow up question to How to drop texts and images on a canvas? (Firefox 41.0.1) I simply can't find out how to access the image data of the image I dropped onto the canvas. I tried things like data = event.dataTransfer.getData("image") , but that all doesn't work. function addDragNDropToCanvas() { document.getElementById('canvas').addEventListener("dragover", function(event) { event.preventDefault();}, false); //handle the drop document.getElementById('canvas').addEventListener(

Cannot Send canvas data from Javascript AJAX to PHP page

…衆ロ難τιáo~ 提交于 2019-12-31 04:20:31
问题 I have a video element on my page showing webcam stream . Next I have a canvas with functions that takes snapshots and displays images in canvas. Now I need to send this canvas image to server and save it to file with PHP. I combined various tutorials online and ended up with this code below, however the image that is saved on the server folder is just blank, so I guess the PHP file does not properly receive the data to show... please help if you can :) Only The Jquery + AJAX not transmitting

Drawing overlapping circles with alpha channeling

女生的网名这么多〃 提交于 2019-12-31 04:02:17
问题 This question has sort of been answered here: Combined area of overlapping circles My problem is more specific though. I have an arbitrary number of arbitrarily sized circles inside other arbitrarily sized circles, to make a target-like image: This image must have some amount of transparency. The transparency must be the same throughout the entire shape. Then, there's an arbitrary number of these shapes that can overlap, and it needs to look like this: The transparency amount must stay the

Gnuplot 4.7 hyperlink & hypertext with SVG terminal

不问归期 提交于 2019-12-31 03:36:10
问题 I am using the SVG terminal in Gnuplot 4.7 and trying to have both hypertext and hyperlink work on the browser, activated by mouse hover and mouse click respectively on the plotted data points. The mouse hover works thanks to the help from stackoverflow on my previous question. My data input file looks like this: X Y Label Color Hyperlink 0 0 net0 2 net0.txt 1 1 net1 2 net1.txt 2 2 net2 2 net2.txt 3 4 net3_outlier 1 outlier.txt 4 4 net4 2 net4.txt My script script.gp looks like this: set

Python - Countdown timer within a tkinter canvas

余生颓废 提交于 2019-12-31 03:09:08
问题 Hello I would like to create a countdown timer within a subroutine which is then displayed on the canvas. I'm not entirely sure of where to begin I've done some research on to it and was able to make one with the time.sleep(x) function but that method freezes the entire program which isn't what I'm after. I also looked up the other questions on here about a timer and tried to incorporate them into my program but I wasn't able to have any success yet. TLDR; I want to create a countdown timer

how to make tkinter <Enter> event work when <button-1> is pressed?

蹲街弑〆低调 提交于 2019-12-31 03:05:14
问题 I want to fill rectangles just like in paint. When mouse button is pressed I want every rectangle I enter to be filled and otherwise I want no event to take place. Here Is my code: from tkinter import Canvas import tkinter _width = 50 _height = 50 _size = 8 root = tkinter.Tk() root.title("draw me a lovely matrix") canv = Canvas(root, width=_width * _size, height=_height * _size) class Wrapper: btn1d = False def set_btn1d(value): print(value) Wrapper.btn1d = value def toggle_color(rect): print

How to horizontally flip an image

荒凉一梦 提交于 2019-12-31 02:56:08
问题 How can i draw only two images with reversing I don't know how to reverse . Pls help. var canvas = document.createElement('canvas'); canvas.width = 16 * scale; canvas.height = 32 * scale; //we assign the same classname the image has, for CSS purposes canvas.setAttribute('class', skinImage.getAttribute('class')); canvas.setAttribute('title', skinImage.getAttribute('title')); var context = canvas.getContext("2d"), s = scale; context.imageSmoothingEnabled=!1, context.mozImageSmoothingEnabled=!1,