0

I have create a cube in 'three.js', but I want to create the same cube 3 times and then target them so they can be animated individually with 'Tweenmax'

I am new to three.js so any help would be appreciated

fiddle here: https://fiddle.jshell.net/2gr5cc9y/

2
  • I don't see any Tweenmax code in your Fiddle. Did you try at all to do something yourself? Stackoverflow is not a coding service... Commented Mar 21, 2016 at 14:59
  • I am not asking for the tweenmax code, I just need to know how to get 3 of the same cubes on the page and target each one individually. So you would have for example 3 canvas elements with different id's Commented Mar 21, 2016 at 15:03

1 Answer 1

1

Here in this updated Fiddle is an example on how to draw three cubes.

You can draw one cube and simply clone it twice:

var cube1 = new THREE.Mesh(geometry, material);
var cube2 = cube1.clone();
var cube3 = cube1.clone();

As you can see in the fiddle you don not need three canvas elements to do this. You can add them to one scene on the same canvas.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.