Jump to content
Search Community

TweenMax.set drawSVG:0 in node.js not working

swampthang test
Moderator Tag

Warning: Please note

This thread was started before GSAP 3 was released. Some information, especially the syntax, may be out of date for GSAP 3. Please see the GSAP 3 migration guide and release notes for more information about how to update the code to GSAP 3's syntax. 

Recommended Posts

Thanks that actually makes since to me now lol.

However I ran into another hiccup.

 

I'm trying to append the image sequence as a PNG from a canvas element (cause that's the only way I know how to do it).

(however it's not appending the image source as a image/png. when I console.log it shows fine but when I try and append it. I get....
 

Quote

Uncaught TypeError: Failed to execute 'appendChild' on 'Node': parameter 1 is not of type 'Node'.
    at Image.img.onload


Why is this and what can I do to fix it?

 

See the Pen WNNWBMo?editors=0010 by michaelsboost (@michaelsboost) on CodePen

Link to comment
Share on other sites

7 minutes ago, michaelsboost said:

however it's not appending the image source as a image/png

 

Source is the operative word there. You can't append a source. You have to append an image with that source.

 

So something like this.

img.onload = function() {
  ctx.clearRect(0, 0, canvas.width, canvas.height);
  ctx.drawImage(this, 0, 0);
  var imgType = canvas.toDataURL("image/png");
  var image = new Image()
  image.src = imgType;
  list.appendChild(image);
};

 

  • Like 2
Link to comment
Share on other sites

6 minutes ago, michaelsboost said:

document.querySelectorAll("section img").length

 

Setting the src of an image is asynchronous, so the onload functions probably haven't been called. It matters when you call that.

 

Maybe use promises. Although it looks like your image size is a little off.

 

See the Pen ea2e4e571d8604930d276d3b2a10fd22 by osublake (@osublake) on CodePen

 

 

 

  • Like 3
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...