Three.js functionality within ePUB

Hey everyone!
I have only just begun to learn about all the possibilities with three.js and I must admit I’m very excited for the possibilities.
I have a simple question, would it not be possible to showcase three.js within an ePUB document?
ePUB is essentially a package delivery of an HTML5 website with CSS3 and JS.
This delivery should allow someone to present their portfolio on an iPad without the reliance of internet connectivity. It would also provide an excellent one file delivery system for download.
Has anyone had experience with ePUB documents in this manner?
What are your thoughts on this?

Thanks for your time!

I would say it’s unlikely anyone has every tried this. You’d have to figure out if it’s possible yourself. The most likely problem is that epub reader apps will not run the scripts properly. Also, you won’t be able to display the 3d scenes on ereaders (it’s very unlikely they support WebGL).

1 Like

I didn’t know you could include JS scripts in an epub, that’s interesting ! Could one make a calculator in an epub for instance ? Anyway as @looeee pointed out, it’s unlikely ereaders support webGL at the moment…

The good part is that the latest ePUB standard supports WebGL and MathML on all e-readers (with the exception of Kindle)
So far I’ve incorporated JS in a “fixed layout” ePUB (v3.1) with calculations and buttons with animations.
I only discovered three.js a few weeks ago, but It’s exciting to think that combining these two formats is actually a new concept.
If this does work, then it will be awesome to have a controlled format to replace interactive PDFs.

1 Like

I found this article describing how to include three.js scenes in an epub:

There’s a linked epub file that contains three.js scenes. When I open it up in Calibre they do work, but Calibre crashes after a minute or so of viewing the file.

@TwistingHalos that epub looks like a good starting point. However, the three.js code contained in the book is very outdated.

@looeee Thank you- This is awesome!

1 Like