Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
swampthang

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

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

How would you grab the image sequence with multiple tweens going at once?

 

Here's an example I tried in which the animation runs fine but the image sequence doesn't grab all the tweens.

 

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

    

 

 

Link to comment
Share on other sites

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

Why is it that after the image was already appended when I run....


    document.querySelectorAll("section img").length

 

In console it says "0"? Even when I run..... 

    document.querySelector("section").innerHTML

it says.....

    ""

Can someone explain this for me? I'm confused.

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

I decided to just put the onclick function into the img.onload function. Noticed on my computer it uses less cpu than promises.

 

This demo I'm using gifshot to create the gif animation.

See the Pen MWWRMGL by michaelsboost (@michaelsboost) on CodePen

Link to comment
Share on other sites

I just realized the mouth of my character isn't staying white within the gif animation (from the image sequence). Not sure why tho

Link to comment
Share on other sites

Don't know what's happening with that. The mouth is white in the images, so it's probably something with your gif library.

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.
×