dazzafact Posted February 28, 2022 Share Posted February 28, 2022 Can anybody give me a hint, what i've missed to zoom it to the given coordinates? This animation just zooms to the Center of the Image. Thats not what i want. i want these coordiantes [0.9,0.8] This is just in simple Code example. My original Code is using more paramters. But i just want to understand how this Works Thanks See the Pen RwjexKY by dazzafact (@dazzafact) on CodePen Link to comment Share on other sites More sharing options...
Trapti Posted February 28, 2022 Share Posted February 28, 2022 The property is transformOrigin not origin. Ex: transformOrigin: "50% 50%" 1 Link to comment Share on other sites More sharing options...
dazzafact Posted February 28, 2022 Author Share Posted February 28, 2022 Yes thanks, this works, but only in CodePen. When i try this parameter "transformOrigin" in my Project it won't work. It animates the same, like i posted first- to the center $tl.fromTo($slides, {alpha:0},{alpha:1,duration:2},0) .to($slides,{duration:10,transformOrigin:"80% 10%", pixi: { width: $slides.width*(1.2), height: $slides.height*(1.2) } },'>') Link to comment Share on other sites More sharing options...
Trapti Posted February 28, 2022 Share Posted February 28, 2022 I am not sure what exactly is wrong in the app. But seeing this code I see alpha, the property is autoAlpha for handling visibility and opacity of the element. In your original codepen scale is being animated so transformOrigin has effect on that. In this code It is different. 2 Link to comment Share on other sites More sharing options...
Cassie Posted February 28, 2022 Share Posted February 28, 2022 Thanks Trapti! You're also animating width and height here and scale in the first example. Now I'm not 100% sure how that's handled in PIXI but if it's the same as the HTML box model and three.js any changes will originate from the top/left corner of the element. The transform origin property is for transforms like scale/skew/y/rotate - not for width or height. Hope this helps! 2 Link to comment Share on other sites More sharing options...
OSUblake Posted February 28, 2022 Share Posted February 28, 2022 It's not clear if you are using PixiJS, because your example shows HTML, which doesn't work the same. If you're using HTML, check out the demos by Jack in this thread. 2 Link to comment Share on other sites More sharing options...
dazzafact Posted February 28, 2022 Author Share Posted February 28, 2022 Thank you all for reply. Yes, iam using PixiJs (no HTML) I think Gasp Parameters are not the first adress. I have to try first with Pixijs Parameters to find a Solution Link to comment Share on other sites More sharing options...
dazzafact Posted February 28, 2022 Author Share Posted February 28, 2022 1 hour ago, OSUblake said: It's not clear if you are using PixiJS, because your example shows HTML, which doesn't work the same. If you're using HTML, check out the demos by Jack in this thread. I already tried the example you post ^ , but this seems to be made for HTML-Eleemts not PixiObjects. I thought Html Params and PixiJs-Params where use as the same. So thats why i posted my first example above as a simple HTML Version. Just to make it as short as possible to understand. Ok, now i see Jack creates an Effect with Plugin. Ok, i will try this next. 1 Link to comment Share on other sites More sharing options...
Solution dazzafact Posted February 28, 2022 Author Solution Share Posted February 28, 2022 Ok, here's my Solution if you use PixiJs $tl =gsap.timeline() $anchorX=0.8 //your x image point to zoom $anchorY=0.2 //your y image point to zoom $pointX=$canvasWidth*$anchorX;//image size width $pointY=$canvasHeight*$anchorY;//image size height $slides.anchor.set($anchorX,$anchorY);//only for Pixi $tl.fromTo($slides,{x:$pointX,y$pointY},{duration:1},0)//set image position on begin relative to Scale values (.to()) .to($slides,{duration:12, pixi: {scaleX :2,scaleY 2 } },'>') 1 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now