CANVAS - Change Canvas Stroke On A Typeface Hover - Stroke() Doesn’t Work?

Mar 16, 2009

I have a menu in which is applied typeface script. Typeface 0.11 version doesn't support hover on links. There is an experimental version but doesn't work very well for me, so i tried to implement hover by myself.
Problem is: hover works pretty well changing canvas context property fillColor and then calling fill(), but the stroke on hovered voice remains on another color. Difficult to explain, so i put some test code online: TEST CODE As you can see, passing with mouse on the menu voices triggers the hover and the element change, but remains bordered in red.

[Code]...

View 5 Replies


ADVERTISEMENT

Delete Lines On Canvas, But Not The Whole Canvas?

Jul 12, 2011

I want to delete some lines on the canvas that i have created in HTML5 (with the <canvas> tag). I know one solution and that is using clearRect() (give this function the HEIGHT and WIDTH of the canvas and you clears the whole canvas.).But i don't want to clear the whole canvas, i only want to delete a few lines made by the function lineTo().

View 1 Replies View Related

JQuery :: Detect Mouse Stroke?

Jan 16, 2011

You guys know a plugin or script that can detect certain mouse strokes and automatically fires an function/actions ???

View 2 Replies View Related

Send A Key Stroke To Effectively Click The Back Button?

Feb 9, 2011

Can I send a key stroke to effectively click the back button?

View 5 Replies View Related

Canvas Doesnot Work In IE?

Feb 23, 2010

Why doesn�t the following code work in IE, I use excanvas.js as told in other articles? excanvas is in the same dir as the html-file.

Code:

<html>
<head>
<title></title>[code].....

View 1 Replies View Related

Can't Get HTML Canvas To Work In IE

Jan 1, 2011

I have make a javascript program that uses HTML canvas and I can't get it to work in Internet Explorer. I tried using excanvas and jqcanvas but had trouble getting them to work.

View 5 Replies View Related

Canvas.drawImage Doesn't Work / Resolve This?

Jul 19, 2011

I'm new to javascript and html5.

I've been having problems with some simple(?) lines of code...

What I'm trying to do is to simply turn the canvas black and show a small gif on it. Upon executing initCnv(), the canvas turns black as it should, while the sprite image doesn't show up at all. I can't figure out what's going on, I scoured the code for syntax errors, even tried other image formats but to no avail. Image paths are also correct.

View 10 Replies View Related

JQuery :: Getting The Webshims Plugin Canvas Polyfill To Work

May 20, 2011

I am having problems getting the webshims plugin canvas polyfill to work. I get the following error in IE9 using IE7 mode: SCRIPT438: Object doesn't support property or method 'fillRect' problem.html, line 21 character 7 when I try to run this code:

[Code]...

View 1 Replies View Related

Shim Layer For Bind() - Sprite Animation On The Canvas Wouldn't Work On Safari Or Older Versions Of Firefox

Aug 30, 2011

I have a script that runs a sprite animation on the canvas, adapted from here: [URL] After wondering why it wouldn't work on Safari or older versions of Firefox, I saw this: [URL] and implemented the suggested shim. However, I'm still getting some errors that I can't explain for the life of me. To make this easy for everyone, I threw it in a jsfiddle: [URL]

View 1 Replies View Related

Canvas:fillText(...) Doesn't Work In IE - Says "object Doesn’t Support This Property Or Method"

Feb 24, 2010

Why doesnt the following code work in IE. There is an error on the same row as fillText. It says object doesnt support this property or method.

<html>
<head>
<title></title>
<script type="text/javascript" src="excanvas.js"></script>
</head>
<body>
<canvas id='chart' width='500' height='200'>
[Code]...

View 1 Replies View Related

Catching Keypress In Canvas Tag

Jun 22, 2006

I am trying to catch keypresses in my canvas tag, but it appears that
that is not valid.

I may try to just create a hidden input box that will allow me to catch
keypresses.

I am trying to write a very simple asteroids game for a presentation on
Ajax in July, to show that javascript can do more than it was able to a
couple of years ago.

View 3 Replies View Related

JQuery :: Add A Class To Canvas?

Aug 16, 2010

I am working with the new canvas element. I have simplified my request.

Can I add a class to the canvas JS? Currently the fill colour is set with 'context.fillStyle="red";' I would love have this in a class as I want to change the colour of the fill with jQuery.

<!DOCTYPE html><html><head><meta charset=utf-8"><title>Canvas</title></head><body>
<canvas id="myCanvas"></canvas>
<script type="text/javascript">
var canvas=document.getElementById('myCanvas');

[Code]....

View 2 Replies View Related

Why Won't Canvas Graphics Get Rendered

Nov 3, 2011

Why won't my canvas graphics get rendered?

[Code]...

View 3 Replies View Related

Multiple Layers With The Canvas Tag?

Feb 13, 2011

I'm writing a script that graphs data in different colors and shapes and I'm encountering two problems:(1) I can't specify different colors for the graph I'm rendering. If I use fillStyle="red"; then the entire chart becomes red. It seems to use the last color specified as the color for everything on the chart.(2) The shapes are overlapping in strange ways. The fills are not covering the lines of shapes behind them so it's unclear which shape is in front and which is behind. It's like they aren't being treated as separate shapes but instead one shape where boundaries are unclear. I don't know how else to explain it.

View 2 Replies View Related

Using Output For HTML Elements Outside Canvas

Apr 7, 2009

Before the canvas tag you had to write a script to make a gradient for html element backgrounds. Now you can use canvas and it's as easy as ... well messing with canvas. I have this script. At one point I had the gradient img objects resizing so the gradient would not get skewed. it was simple. just set the height% at the opposite ratio of the canvas width/height. But I went to make some changes and the next thing i knew that no longer worked. I don't remember how I did it!! I'm going to have to start over if I can't figure it out. Here's the script. Canvas only.

I haven't adapted with excanvas for IE yet, but that's coming when I can figure out how I had the thing working right. It's a css issue. I had thought I put the img objects in divs that were sized and positioned and then set the images to width 100% height= 100%*((canvas.width-canvas.height)/canvas.width) So in my example, the canvas was 100 x 30 and the factor is 7 so it would resize the image 700% and the height would grow by the relative amount to the setting I had it. I'll try to figure it out, but there's the script working somewhat. I want to figure out a way to resize the img objects when the user resizes the page, but I want the img to always maintain aspect ratio. [URL]

<script>
/*ORIGINAL SCRIPT FOUND AT [URL]*/
window.onload = function () {
var canvas = document.getElementById('c');
var ctx = canvas.getContext('2d');
var g = ctx.createLinearGradient(0, 0, 100, 50);
g.addColorStop(0, 'rgba(255, 255, 0, 0.5)');
g.addColorStop(0.5, '#0ff');
g.addColorStop(1, '#00f');
ctx.fillStyle = g;
ctx.fillRect(0, 0, 100, 50);
var data = canvas.toDataURL();
document.getElementById('i').src = data;
document.getElementById('EIMG').src = data;

var canvas2 = document.getElementById('c2');
var ctx2 = canvas2.getContext('2d');
var g2 = ctx2.createLinearGradient(0, 0, 100, 50);
g2.addColorStop(0, 'rgba(255, 0, 255, 0.5)');
g2.addColorStop(0.5, '#0ff');
g2.addColorStop(1, '#00f');
ctx2.fillStyle = g2;
ctx2.fillRect(0, 0, 100, 50);
var data2 = canvas2.toDataURL();
document.getElementById('i2').src = data2;
document.getElementById('DIMG').src = data2; .....

View 3 Replies View Related

Drawing On Multiple Canvas Elements?

Oct 21, 2009

I'm having a problem with the <CANVAS> element in JavaScript. here's what i'm trying to do: I need 3 different canvas elements for writing a signature to. they must all 3 be visible at the same time

My problem that i'm having is that i can't seem to get the code to work which will write to more than one canvas.

[Code]...

View 2 Replies View Related

Creating Canvas With Document.CreateElement?

Feb 25, 2010

Why doesn't the following code work:
<script type='text/javascript'>
var canvas = document.createElement('canvas');
canvas.width = 1400;
canvas.height = 700;
var context = canvas.getContext('2d');
context.strokeRect(10, 10, 50, 50);
context.stroke();
</script>

View 4 Replies View Related

Html5 Canvas Game Drawing?

Mar 21, 2010

I am trying to create an Asteroids type game using JavaScript along with html5's canvas element for drawing. I have searched around and have looked at examples but I can't figure out what is wrong with my rendering that I do in the game loop that is run every frame. The problem appears to be only that the canvas is not cleared at the beginning of each frame but I feel there might be something wrong also. The code used and shown below only works in Firefox but not Google Chrome or Safari.

[Code]...

View 2 Replies View Related

Canvas Animation - SetInterval On Update

May 6, 2010

I'm new to Javascript, and having an issue with getInterval. For my programming languages class we have to create a simulation of waves breaking on a shore from above. I've decided to use a canvas object and Javascript for this animation, but am getting stuck on refreshing the frames.

Here is the code I have so far:
var shoreline = new Array();
var waves = new Array();
var canWidth = 600;
var canHeight = 400;
var waveNum = 0;
var count = 0; .....

As you can see, the idea is that each 5-pixel wide node of the shore and wave are stored in arrays so that the position of each node can differ. The wave() function initializes all the required data, and then calls setInterval on update(). The function update() draws the water, shore, and wave, and then updates the wave position node-by-node. Ideally, setInterval would cause this to happen repeatedly, so that the wave would appear to move closer to the shore every 1000ms.

However, this is not the case. It appears as though setInterval is working for one pass of update(), but fails after the first pass. You can tell that this is happening because the wave appears at its starting position, but does not continue to move. I read somewhere that setInterval can be broken by one-time functions, but I'm not sure. If you'd like to see what it's currently doing in a browser, I've hosted it here [URL]. Once I've got this animating properly I can continue my project, but I've hit a roadblock.

View 2 Replies View Related

How To Dynamically Create HTML 5 Canvas

Jun 19, 2011

Here's a snippet:
canvases[i] = document.createElement('canvas');
canvases[i].style.width = '3px';
canvases[i].style.height = '100%';
canvases[i].getContext("2D");
canvases[i].fillRect(1,0,1,table_height);

I'm trying to dynamically create a canvas element. Later in the script it gets attached to the DOM, and this works fine if the last two lines are missing. I end up with a canvas element that is 3px wide and 100% of the containing div tall. However, the last two lines make it crash, with the error report 'canvases[i].fillRect is not a function'.

If I change the last two lines to:
var drawing = canvases[i].getContext("2D");
drawing.fillRect(1,0,1,table_height);

It says 'drawing is null'. Something seems to be going wrong with the getContext bit, because setting the height and width work fine. It behaves the same if I append the canvas element to the DOM before trying to do the drawing as well. This is in FF4.0.1 with a xhtml1-strict.dtd doctype and valid html.

View 7 Replies View Related

Using Translate To Move Canvas Around (Animation)

Jul 12, 2011

The main one I find is to use translate to move the canvas around, which just seems odd to me. I don't even fully understand how it works. But the one I was looking at used clearRect. In examples given looked as though it had to redraw the canvas every frame. I'm just mucking around with a simple poker game, figured I'd have the table in one layer and anything that moves on a top layer? By doing that I could only clear each card as it moved around...yes?

View 8 Replies View Related

Draw To Canvas In External Function?

Apr 6, 2011

I would try to make a game/demo with legitimate script that is easy to read and properly segmented with functions instead of my previous attempts that are all one file.I'm trying to print the character (currently a circle) to screen in an external function (print_character in character.js).

View 2 Replies View Related

Canvas HTML5 - Saving As Image?

Nov 1, 2011

I want to save my canvas-content to a single image-file. There are an approach using todataurl(), which works fine. But not if i draw an image-file (e.g. car.jpg or house.png) to the canvas additionally. It does not return the whole image? Here I have my simple example-code:

[Code]...

View 1 Replies View Related

Clickable Image Object On Canvas Tag?

Jan 14, 2011

I want to be able to place an image on the canvas and have an onclick event for that object.

Code:

<!DOCTYPE html>
<html>
<head>

[code]....

View 2 Replies View Related

Scale A Canvas Physical Size?

Jun 23, 2011

My javascript canvas width and height are both 960. I have found that my screen horizontal and vertical resolutions are both 96 dpi. Thus, when a drawing is rendered in the full width and height of the canvas, it should be measurable by a ruler to be physically 10 inches by 10 inches. I did measure the display on the screen and found it to be actually about 11 and 3/16 inches wide. What is the proper way to scale a canvas so that the resulting physical dimensions can be calculated more precisely?

View 4 Replies View Related

Fullbrowser Canvas Element W/o Scrollbars

Jul 14, 2011

I'm playing around with full browser canvas element it seems to spill beyond the browser bounds generating horizontal and vertical scrollbars.This is the technique I'm using: [code]I've also tried to wrap the canvas element inside a div and set that div's overflow equal to hidden, but the results are unchanged.

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved