Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HoverScale Improvements #204

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

HoverScale Improvements #204

wants to merge 4 commits into from

Conversation

NGenesis
Copy link
Contributor

  • Added eventListener property to HoverScale behavior to allow other objects to trigger cursor events on behalf of the object that owns the behavior.
  • Improved animation accuracy when HoverScale cursor hover state is changed mid-animation.

David Cormack added 3 commits May 28, 2017 21:35
…jects to trigger cursor events on behalf of the object that owns the behavior.

Improved animation accuracy when HoverScale cursor hover state is changed mid-animation.
@stevenvergenz
Copy link
Contributor

I'm confused what functionality this PR actually adds. Wouldn't it make more sense to put the behavior on an empty node that's parent to the trigger and the receiver?

@NGenesis
Copy link
Contributor Author

NGenesis commented May 30, 2017

The desired behavior using the eventListener property is to have one object trigger the scaling effect of another object when the trigger object is hovered over, without affecting the object that triggered the effect.

For example:

var boxTrigger = new THREE.Mesh(new THREE.BoxBufferGeometry(1, 1, 1), new THREE.MeshBasicMaterial({ color: 'blue' }));
var boxNeutral = new THREE.Mesh(new THREE.BoxBufferGeometry(1, 1, 1), new THREE.MeshBasicMaterial({ color: 'green' }));
var boxTarget = new THREE.Mesh(new THREE.BoxBufferGeometry(1, 1, 1), new THREE.MeshBasicMaterial({ color: 'red' }));

var boxes = new THREE.Group();
boxes.add(boxTrigger, boxNeutral, boxTarget);

The desired behavior using the eventListener property in this case is to have boxTarget's scale be affected when only boxTrigger is hovered over, without affecting the scale of boxTrigger or boxNeutral.

// Hovering over boxTarget will affect the scale of boxTarget
// Hovering over boxNeutral or boxTrigger will not affect the scale of boxTarget
boxTarget.addBehavior(new altspaceutil.behaviors.HoverScale({ scale: 1.15, duration: 125 }));

Does not satisfy the desired behavior.

// Hovering over boxTrigger, boxNeutral or boxTarget will affect the scale of boxTrigger, boxNeutral and boxTarget
boxes.addBehavior(new altspaceutil.behaviors.HoverScale({ scale: 1.15, duration: 125 }));

Also does not satisfy the desired behavior.

// Hovering over boxTrigger will affect the scale of boxTarget
// Hovering over boxNeutral or boxTarget will not affect the scale of boxTarget
boxTarget.addBehavior(new altspaceutil.behaviors.HoverScale({ scale: 1.15, duration: 125, eventListener: boxTrigger }));

Allowing the object that will trigger the scaling effect to be explicitly specified satisfies the desired behavior.

@stevenvergenz
Copy link
Contributor

Could you add a test case to examples/tests?

@NGenesis
Copy link
Contributor Author

NGenesis commented Jun 1, 2017

Test case based on the above example can be found at examples/tests/behaviors-hoverscale.html

@NGenesis
Copy link
Contributor Author

NGenesis commented Jun 6, 2017

Any updates/questions/comments about this pull request?

@stevenvergenz
Copy link
Contributor

Sorry for the delay. Finally got around to trying it out, it looks good! We'll merge it in with the next SDK push. Sound good?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants