Some way to destroy the wick-player?

Hi,

I’m trying to use an exported animation in a div - but not an iframe…
I can start the animation, no problem, but as soon as I hide the div (it’s on a jQuery tab) the canvas/wick starts generating JS errors. That makes sense, as a canvas cannot be accessed if not visible…
But I’m trying to stop the wickplayer/destroy the object or something like this… but I cannot :frowning:

Any idea’s on how to go about this?

regards,

Paul

1 Like

Sorry, don’t know what you mean by that - can you describe it a bit more?

@awc95014: sure, thanks for your time!
I have an animation that I deconstructed like I said here . And that works fine.
But if the div I write the animation in gets hidden, Wick starts spewing JS-errors in the console, and all kinds of stuff break :frowning:. I know why this is happening, because when you hide a canvas, you are not allowed to make JS calls to it.
So, I would like to stop, disable or completely delete the wick-animation/players.
At the moment I do that by writing the whole shebang into an iframe. In that case, when I destroy the iframe, it simply remove that whole DOM, including the whole wick-instance - problem solved.
But I do not really like this, as I am creating and destroying DOMs left, right and center, this way…

(Browsers do not really seem to mind, but I do not like it :-p )

regards,

Paul

Holy crap that’s a lot to digest… I never understood the loader hacking in the first place, so this might be a bit too big-brain for me. Unless I get blessed by eating a waffle for breakfast (I did eat a waffle, and it probably won’t bless me) I’m not gonna be able to grasp it… therefore I can’t help you :frowning:

NP; always nice to hear from someone, even if they cannot give you the solution right away :stuck_out_tongue:
The thing is: I use Wick in a slightly off-kilter way. I try to make my files so small as possible in my project. Also, I want “small animations” without all the hassle of needing to press play, pause, hiding progressbars etc that normal videoplayers need. (And without even the possibility of interactive stuff.) Wick is great for that!
But I also need to be able to remove the animations from my current page (live) and, maybe, even insert a different one.
I don’t want to start and reload whole animations at a time, so I try to 1) cache and 2) make the final file(s) I need to load as small as possible.

That’s why I was trying (and, ultimately succeeding) in “hacking” the loader and now working to destroying and restarting animations - without, if possible, reloading (parts of) the screen.

So I fully understand that this is not a standard way to use Wick - still very excited :smiley:

Paul

This is too much for my bread brain. Is this some sort of HTML? Haven’t finished my khan academy HTML course.

Paul, you seem to be the best coder here, so I won’t guess
you’d have a big problem finding a solution, especially since
your IQ is around a couple of millions :+1:

EDIT:
(I’m not trying to make fun of ur IQ, so don’t get me wrong, I was
referring to your intelligence in a good way)

still thinking-

Well, I’m not one of the authors of Wick, so… :face_with_hand_over_mouth:
But I was hoping to hear from one of them; they would know! :-)

1 Like

hmm do you mean adding another project to your new project? if so here:https://www.youtube.com/watch?v=zdMpY9cUFQU&feature=youtu.be

Hi @ToastyGhost,

no, sorry, I’m referring to the playback of a exported HTML-wick-project inside another website.

regards,

paul

Here’s what my tiny brain understood: your trying to delete an object/ clip/ button, and once you do, you’ll start getting js errors saying that it doesn’t exist because your unable to make calls to an object that got deleted?

(I’m probably no where near what you meant)

Hi @Hamzah_Alani,

I really wish you and others would stop making an Einstein out of me :crazy_face:
If I wrote Wick - you would be right, but I did not :stuck_out_tongue_closed_eyes:

No, I want to remove/destroy the wick player I embedded in a page, as a result of the files I downloaded with export/html with Wick. But lets not risk everybody’s brain by keeping this discussion going here! I solved the problem (for me) by writing the whole thing via JS into an iframe. If I destroy that, nothing bad happens, as this is a separate DOM. So - no worries!

It might be a nice addition for a future release of Wick to be able to nicely stop the payer, but that is for the real brains here :slight_smile:

thanks for all your time and effort!

regards,

Paul

2 Likes

At first when you said wick-player I thought you meant a player inside a game, when I looked at the desc it was completely off… I think you want the html to delete its own html…?

Yeah - more specifically, I want to “delete” or stop the javascript that is driving the animation.

Hi,

this issue is still relevant. If a Wick animation is playing on a page, hiding the div/frame in which it plays will spew errors:

VM1248:13015 Uncaught TypeError: Cannot read property ‘_transformBounds’ of null
at CanvasView.getBounds (:13015:42)
at CanvasView.getCenter (:13071:15)
at CanvasView.setZoom (:13086:9)
at Wick.View.Project._renderSVGCanvas (:63097:28)
at Wick.View.Project.render (:62919:10)
at Wick.Project.tick (:51505:15)
at :51464:24

I’ve spend an hour to find out how to stop the wick player of this occurs, but so far not succesfull. It cannot really be hard to stop the player if something like this occurs? Can some of the authors chip in with this?

regards,

Paul

1 Like

Try to use a try / catch error thing

try{
// Code
}catch(Err){
console.warn("The div/ iframe doesn't exist");
}

Solving this issue might not be that simple though, so hopefully one of the authors could jump in and help.

Also, as a side note, the built-in assets have a text box that uses a div element (it was created by the authors). Stealing some code from that asset might help you

I’m not sure if I understand correctly but it’s likely that you can replace (erase) the content of a div containing your canvas with element.innerHtml property.
that should do the trick

Hi @Hamzah_Alani,

yeah, I know about try/catch, but I am not sure where to put them in de (large!) wick-code.
I tried putting them around the call that calls the animation, but that does not work :slight_smile:

regards,

Paul

Hi @blurredPixels,

thanks for your answer. That does indeed work, but that means I need to actively remove wicks all the time, and keep track of wicks I removed and might need again. That is doable, but a bit tiresome…

regard,

Paul