isomer icon indicating copy to clipboard operation
isomer copied to clipboard

Manupulate existing shapes

Open dicoy-zz opened this issue 11 years ago • 9 comments

Is there a way to delete or modify a shape you just created I did this: tile = iso.add(new Path([Point(0,2,0),Point(1,2,0),Point(1,3,0),Point(0,3,0)]), new Color(50,160,60));

in hopes of being able to do stuf like this: tile.remove(); iso.remove(tile); iso.shapes.tile.x = 3; tile.extrude(3, new Color(50,160,60));

dicoy-zz avatar May 04 '14 20:05 dicoy-zz

Instead of constructing directly into iso.add(), you can construct the items and push them into an array:

tile = new Path(args); scenery.push(tile);

function render(){ for(var piece in scenery) iso.add(scenery[piece]); }

Then you can change the properties of tile, and invoke 'render()'.

JrFolk avatar May 05 '14 00:05 JrFolk

is that how the animation is done on the homepage?

On Sun, May 4, 2014 at 9:29 PM, JrFolk [email protected] wrote:

Instead of invoking directly into iso.add(), you can construct the items and push them into an array:

tile = new Path(args); scenery.push(tile);

function render(){ for(var piece in scenery){ iso.add(scenery[piece]); } }

Then you can change the properties of tile, and invoke 'render()'.

— Reply to this email directly or view it on GitHubhttps://github.com/jdan/isomer/issues/34#issuecomment-42152133 .


Probaste Pensando?? Sumate al desafio Sebastian!! Proba usando tu cerebro durante 14 dias, si no te gusta... segui mirando Tinelli.

dicoy-zz avatar May 05 '14 01:05 dicoy-zz

Nope. On the homepage, the spinning diamond shape is first created, then a center of rotation point is constructed, then the diamond is rotated around that point by a certain angle (this is what changes each frame) and then passed to iso.add(), all in one statement. This is done every frame.

JrFolk avatar May 05 '14 01:05 JrFolk

Thankyou very much!! :)

Do you have the code for the diamond so I can get a better grip?

On Sun, May 4, 2014 at 10:11 PM, JrFolk [email protected] wrote:

Nope. On the homepage, the spinning diamond shape is first created, then a center of rotation point is constructed, then the diamond is rotated around that point by a certain angle (this is what changes each frame) and then passed to iso.add(), all in one statement. This is done every frame.

— Reply to this email directly or view it on GitHubhttps://github.com/jdan/isomer/issues/34#issuecomment-42153095 .


Probaste Pensando?? Sumate al desafio Sebastian!! Proba usando tu cerebro durante 14 dias, si no te gusta... segui mirando Tinelli.

dicoy-zz avatar May 05 '14 01:05 dicoy-zz

It's on the homepage if you click 'GALLERY' and scroll down to the bottom. click on: image And you'll be able to edit it all piece by piece.

JrFolk avatar May 05 '14 01:05 JrFolk

thankyou so much!! :)

On Sun, May 4, 2014 at 10:21 PM, JrFolk [email protected] wrote:

It's on the homepage if you click 'GALLERY' and scroll down to the bottom. click on: [image: image]https://cloud.githubusercontent.com/assets/3434590/2874631/8348e592-d3f3-11e3-999e-cfd1dfa80b8b.png And you'll be able to edit it all piece by piece.

— Reply to this email directly or view it on GitHubhttps://github.com/jdan/isomer/issues/34#issuecomment-42153323 .


Probaste Pensando?? Sumate al desafio Sebastian!! Proba usando tu cerebro durante 14 dias, si no te gusta... segui mirando Tinelli.

dicoy-zz avatar May 05 '14 01:05 dicoy-zz

Las question (I might as well...) How/where does the conversion of coorditanes (from canvas coordinates to isomer's grid) happen?

I'm trying to find out what I'm clicking on

On Sun, May 4, 2014 at 10:52 PM, Seba Manda [email protected] wrote:

thankyou so much!! :)

On Sun, May 4, 2014 at 10:21 PM, JrFolk [email protected] wrote:

It's on the homepage if you click 'GALLERY' and scroll down to the bottom. click on: [image: image]https://cloud.githubusercontent.com/assets/3434590/2874631/8348e592-d3f3-11e3-999e-cfd1dfa80b8b.png And you'll be able to edit it all piece by piece.

— Reply to this email directly or view it on GitHubhttps://github.com/jdan/isomer/issues/34#issuecomment-42153323 .


Probaste Pensando?? Sumate al desafio Sebastian!! Proba usando tu cerebro durante 14 dias, si no te gusta... segui mirando Tinelli.


Probaste Pensando?? Sumate al desafio Sebastian!! Proba usando tu cerebro durante 14 dias, si no te gusta... segui mirando Tinelli.

dicoy-zz avatar May 05 '14 05:05 dicoy-zz

I haven't dug that deep till now, but I think the 'magic' happens in the file: /isomer/js/isomer.js

In the function: "Isomer.prototype._translatePoint = function (point)"

As the comments put it: "X rides along the angle extended from the origin Y rides perpendicular to this angle (in isometric view: PI - angle) Z affects the y coordinate of the drawn point"

'the angle' comes from 'this.angle' which is defined as π/6 = 30° in the same file. It seems the z is translated directly.

JrFolk avatar May 05 '14 06:05 JrFolk

I saw that as well, z translate directly to the canvas's Y (the higher isomer's Z is, the lower the canvas's Y)

I'm really close, but any way I use _translatePoint, I still can't get a conversion that's seems good

dicoy-zz avatar May 05 '14 17:05 dicoy-zz