Why fabric.js doest work in construct 2?

Discussion and feedback on Construct 2

Post » Wed Jan 04, 2017 5:56 pm

I implement a plugin fabric.js and that doest work, i cant move, rotate... etc... why?
B
14
S
6
G
2
Posts: 81
Reputation: 2,241

Post » Thu Jan 05, 2017 12:31 am

Something is amiss with your plugin. You'll need to debug it, aka find at what point it fails. It could be anything really.
B
91
S
31
G
103
Posts: 5,241
Reputation: 67,768

Post » Thu Jan 05, 2017 8:01 am

Referencing @R0J0hound 's canvas plugin, you will find that
1. create a private canvas element
2. draw on this private canvas element
3. in "instanceProto.draw()", or "instanceProto.drawGL()", paste ctx of the private canvas element ( just copy these 2 functions )
- set variable "this.runtime.redraw", and "this.update_tex" to true to enable updating


I had tested fabric.js (add image) in C2, it worked.
B
108
S
26
G
260
Posts: 4,435
Reputation: 146,195

Post » Thu Jan 05, 2017 11:46 am

Yes, i made this work, just add images, but use the inputs doest work, for example: move object, rotate or resize with the touch or mouse. I don't know why...
B
14
S
6
G
2
Posts: 81
Reputation: 2,241

Post » Thu Jan 05, 2017 12:17 pm

andykenobi wrote:Yes, i made this work, just add images, but use the inputs doest work, for example: move object, rotate or resize with the touch or mouse. I don't know why...


Unless you give considerably more information, or preferably a .capx and the plugin so others can test, then the only help that can be offered is guesswork.

At the very least, show an image of your code. That way, some of the Javascript gurus on here may spot something.
If your vision so exceeds your ability, then look to something closer.
Moderator
B
132
S
29
G
81
Posts: 5,329
Reputation: 56,657

Post » Thu Jan 05, 2017 3:46 pm

Fabric.js does pretty much everything C2 already does, so basically you're putting a car in a car.
Then there's the Webgl counterpart.....
Image ImageImage
B
168
S
50
G
164
Posts: 8,239
Reputation: 105,597

Post » Fri Jan 06, 2017 7:51 am

@newt

fabric.js has 2 kinds of canvas
1. static canvas, which only draw objects(line, circle, triangle, ellipse, rect, polyline, polygon, ...) and (morphing) animation. It is similar with rojo's canvas plugin, with more functions.

2. interactive canvas, which not only draw objects, but also allows dragging, resizing them with predefine control points.


Since fabric.js does not use webgl, the performance of moving or rotating objects should be worse then C2 engine ideally.
But it is still a good (static) canvas api, to draw polygon at runtime.
B
108
S
26
G
260
Posts: 4,435
Reputation: 146,195

Post » Thu Jul 27, 2017 10:22 pm

i was trying to implent FabricJs in C2 to build a drawing app. but i get stuck in linking fabric js to This.canvas . can you help me ? can you send me your plugin please ?
B
12
S
6
Posts: 118
Reputation: 1,466


Return to Construct 2 General

Who is online

Users browsing this forum: megatronx and 3 guests