Discuss Scratch
- Discussion Forums
- » Advanced Topics
- » Drawing on canvas
- langstone
-
6 posts
Drawing on canvas
Hi,
Trying to write an extension, in part of it I want to draw a rectangle on the canvas, above my sprite. A bit like the say command does.
I thought I would get the scratch element and draw on to it but this isn't working.
I'm sure someone out there has done this and will be willing to share or point to someone who has.
Thanks in advance
Trying to write an extension, in part of it I want to draw a rectangle on the canvas, above my sprite. A bit like the say command does.
I thought I would get the scratch element and draw on to it but this isn't working.
I'm sure someone out there has done this and will be willing to share or point to someone who has.
Thanks in advance
- PullJosh
-
1000+ posts
Drawing on canvas
Perhaps you want to create a div and place it over top of the player? I don't really know, but it seems like that might work…
- Hydrabolt
-
100+ posts
Drawing on canvas
Yep, that would probably work Perhaps you want to create a div and place it over top of the player? I don't really know, but it seems like that might work…
- langstone
-
6 posts
Drawing on canvas
How would I go about this using Javascript? that will actually draw the div.
I was hopping to use document.getElementById(“scratch”); then getting context but its not working.
I was hopping to use document.getElementById(“scratch”); then getting context but its not working.
Last edited by langstone (Feb. 20, 2015 12:33:57)
- CosmicSans
-
100+ posts
Drawing on canvas
Scratch isn't canvas, it's swf, flash player. Are you trying to draw on the flash player? Unfortunately, that won't work.
- Hydrabolt
-
100+ posts
Drawing on canvas
Just create a div element, place the scratch player inside, and make a canvas inside said div. Make it expand to take up the entire div (as the scratch player should) and give the canvas a z-index of 2 and the player a z-index of 1. Then try drawing to the canvas/
- MegaApuTurkUltra
-
1000+ posts
Drawing on canvas
Make sure you include an iframe shim for those of us on Chrome who hate pepperflash Just create a div element, place the scratch player inside, and make a canvas inside said div. Make it expand to take up the entire div (as the scratch player should) and give the canvas a z-index of 2 and the player a z-index of 1. Then try drawing to the canvas/

- QuillzToxic
-
1000+ posts
Drawing on canvas
Ikr. That is one reason to like chrome.Make sure you include an iframe shim for those of us on Chrome who hate pepperflash Just create a div element, place the scratch player inside, and make a canvas inside said div. Make it expand to take up the entire div (as the scratch player should) and give the canvas a z-index of 2 and the player a z-index of 1. Then try drawing to the canvas/
- Discussion Forums
- » Advanced Topics
-
» Drawing on canvas