Jump to content
Search Community

Scale to specific point

krisxtina test
Moderator Tag

Recommended Posts

25 minutes ago, GreenSock said:

You'd have to calculate the proper transformOrigin, perhaps like this: 

 

 

Thank you, but if I want to scale for getting full white background, in my actual project I need to scale: 300, is it good? Because my projects starts working slowly and badly

Link to comment
Share on other sites

That's definitely a bad idea, but it has nothing to do with GSAP. It's about what you're asking the browser to render. Think about it this way: If your screen is 1000px wide (somewhat small by today's standards) and the image fills that area, and maybe it's 500px tall. That's 500,000 pixels. If you scale that to 300x, that means you're asking the browser to render 45,000,000,000 pixels. That's a LOT of pixels. 

 

There's not really a simple/easy fix that I can think of. You could only animate the text (rather than the whole image) and to further optimize it, hide the letters that go off screen (to minimize rendering load). That's still not super simple to do. 

 

Another option is to load multiple versions of the image, one that's zoomed-out, then others at various stages of zoomed-in state and transition between them, sorta like this demo: 

See the Pen qBBBxaL by GreenSock (@GreenSock) on CodePen

 

Good luck!

  • Thanks 1
Link to comment
Share on other sites

16 minutes ago, GreenSock said:

That's definitely a bad idea, but it has nothing to do with GSAP. It's about what you're asking the browser to render. Think about it this way: If your screen is 1000px wide (somewhat small by today's standards) and the image fills that area, and maybe it's 500px tall. That's 500,000 pixels. If you scale that to 300x, that means you're asking the browser to render 45,000,000,000 pixels. That's a LOT of pixels. 

 

There's not really a simple/easy fix that I can think of. You could only animate the text (rather than the whole image) and to further optimize it, hide the letters that go off screen (to minimize rendering load). That's still not super simple to do. 

 

Another option is to load multiple versions of the image, one that's zoomed-out, then others at various stages of zoomed-in state and transition between them, sorta like this demo: 

 

 

 

Good luck!

Thank you for information. In my case I don`t have such cool images. So, if I transform scale for this dot for full background, how I can do it for good perfomance?

Link to comment
Share on other sites

This isn't something we generally do for people here, but I was curious about the challenge so here's the most clever solution I could come up with that only scales a dot (which I made with a simple <div> that has border-radius: 50%, placing it roughly on top of the actual dot in the "?"):

See the Pen XWEMNaj?editors=0010 by GreenSock (@GreenSock) on CodePen

 

Does that help? 

Link to comment
Share on other sites

9 hours ago, GreenSock said:

This isn't something we generally do for people here, but I was curious about the challenge so here's the most clever solution I could come up with that only scales a dot (which I made with a simple <div> that has border-radius: 50%, placing it roughly on top of the actual dot in the "?"):

 

 

 

Does that help? 

Yes,  thank you a lot. I often do something, but I`m not sure I`m doing it correctly, that`s why I ask how I can do it, for better understanding. 

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