Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
bruno.swf

Problem with 3D

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

First, sorry for my english, I'm using Google Translate.

 

I'm trying to get the effect shown below, only for studies.

 

Screen_Shot002.png

 

Mas está ficando assim.

 

Screen_Shot003.png

 

Realize that the effect of perspective is quite different. The objects just seem to have a greater or lesser scale and not the distance between them.

 

I'm doing this:

 

jQuery(document).ready(function($) {
	 var container = $('.container');
	 var box = $('.box');
var container_perspective = 600;

	 $('section .box').each(function(index){
		 TweenMax.to($(this), 0, { css:{z:getRamdon(-100,100), transformPerspective:container_perspective} });
	 });

	 $('section').on('mousemove', function(e){

		 var w_section = $(this).width();
		 var h_section = $(this).height();

		 var p_px = ((e.pageX - w_section / 2) / (w_section / 2));
		 var p_py = ((e.pageY - h_section / 2) / (h_section / 2));
		 var r_y = 70 * p_px;
		 var r_x = -70 * p_py;

		 TweenMax.to(container, 1, { css:{rotationY:r_y, rotationX:r_x, transformPerspective:container_perspective} });		 });

 });
 function getRamdon (min, max) {
	 return Math.random() * (max - min) + min;
 }

 

Thank you.

Link to comment
Share on other sites

Already discovered, hehe.

It was only applied to property transformStyle as "preserve-3d".

Link to comment
Share on other sites

Hey this CodePen example is really good (so is GSAP)!!

I'm getting started and having issues with 3D rotation X and Y

scaleX and Y and rotation work well tho and I am using Chrome, FF and Safari.

Any idea what I might be doing wrong?

TweenMax.to($(".content.selected"), 2, { css:{ rotationX:40, scaleX:1, scaleY:2}});

Thanks!

Link to comment
Share on other sites

I bet you just have an old version of the GSAP files (before they supported 3D rotations). Which version do you have? I'd recommend snagging the latest ones anyway (they get updated frequently): http://www.greensock.com/gsap-js/

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