[PLUGIN] Canvas

Post your completed addons to share with the community

Post » Sat Jun 14, 2014 7:29 pm

@R0J0hound
New R4: [Fix] Now works with WebGL. (thanks to Yann)

Does this mean that Canvas have the same fps as Paster in WebGL :?: (last time I tried Canvas I've had lower fps than Paster in WebGL)
B
44
S
15
G
6
Posts: 481
Reputation: 6,967

Post » Sat Jun 14, 2014 8:31 pm

No, it just means it works with webgl as previously it didn't. Internally it still uses a standard canvas and copy's to a webgl texture whenever it's changed. Paster should be faster with webgl since it doesn't do any image copying. Also if webgl is turned off speeds will be about the same.
B
79
S
24
G
54
Posts: 4,755
Reputation: 40,773

Post » Mon Jun 16, 2014 11:49 pm

Hi, canvas users,

I had made a behavior of canvas plugin to draw a radar chart, see this thread.
B
97
S
22
G
179
Posts: 4,124
Reputation: 104,555

Post » Wed Jul 16, 2014 7:58 pm

.
Last edited by gameop on Mon Oct 03, 2016 8:49 pm, edited 1 time in total.
B
10
S
1
Posts: 34
Reputation: 741

Post » Wed Jul 16, 2014 8:08 pm

you can make a text global var and store: "rgb(255,255,255)" in it.
or have 3 number vars, one for each color
and then set to fill with:
"rgb("&colorVar1&","&colorVar2&","&colorVar3&")"
Image
B
59
S
21
G
11
Posts: 482
Reputation: 10,718

Post » Thu Jul 24, 2014 4:20 am

gameop wrote:@R0J0hound

Hey Rojo,
Is there a way to fill the canvas by editing the rgb values using a global variable?

Let's say I have the global variables
red = 100;
blue = 20;
green = 40;

And I used the expression "fill canvas with color rgb(red,blue,green)". The canvas then fills itself based on the values in the global variables.

The problem with the the "fill canvas" expression is that it only accepts strings, is there a way to have it so that it accepts a global variable as a parameter?


You can turn the expression into a string by putting it in a str() function. So 'str(rgb(red,green,blue))', unless I'm missing something :P
B
26
S
7
G
5
Posts: 202
Reputation: 5,235

Post » Sat Sep 06, 2014 8:32 am

Hi, canvas users again,

I had made a behavior of canvas plugin to draw gradient with more detail configurations, see this thread.
B
97
S
22
G
179
Posts: 4,124
Reputation: 104,555

Post » Sat Sep 06, 2014 9:10 pm

Hi to everybody.......

is there a way with this plugin to test a pixel color in a sprite or image in a specific location??? any capx example??? could you help me please???

i saw in this plugin the function rgbAt.....how i can use it ....any instructions??......i have installed the canvas plugin...but inside i haven't seen any instruction or button about that....

i thank you in advance...

Lestroso

http://www.fasasoftware.com
B
4
S
1
Posts: 73
Reputation: 504

Post » Sun Sep 07, 2014 3:46 am

1
Create new project

2
Add mouse, text, and canvas objects

3
Give the canvas object an image and position it at 0,0

4
Go to the event editor and add a "every tick" condition.

5
Add the action: text-> set text to canvas.rgbaAt(int(mouse.x), int(mouse.y))

6
Run it and the text object will tell the color under the mouse on the canvas object.

Extra tidbits:
Int() is used since mouse.x can give values like 10.5 when window scaling is used and the value needs to be a whole number.

.rgbaAt uses x and y values relative to the top left of the canvas object. So if you moved the canvas object from 0,0 you'd have to change the expression to:
Canvas.rgbaAt(int(mouse.x-canvas.x), int(mouse.y-canvas.y))

Finally notice it only gets the color from the canvas' own texture. Use the drawing actions to change this texture.
B
79
S
24
G
54
Posts: 4,755
Reputation: 40,773

Post » Sun Sep 07, 2014 8:34 am

Thank you a lot for your support....i'll try it as soon as possible....thanks again....

Lestroso :D

http://www.fasasoftware.com
B
4
S
1
Posts: 73
Reputation: 504

PreviousNext

Return to Completed Addons

Who is online

Users browsing this forum: No registered users and 0 guests